Make TypeLoc::getAs look through AttributedTypeLoc?

Trying to use the (recently added to trunk) FunctionDecl::getExceptionSpecSourceRange, it failed on some function decl using MSVC __cdecl, as such a decl's getTypeSourceInfo()->getTypeLoc() is an AttributeTypeLoc wrapped around a FunctionTypedLoc.

For now, I patched that locally with

diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 81f0878..631453b 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -2994,8 +2994,10 @@ SourceRange FunctionDecl::getExceptionSpecSourceRange() const {
   const TypeSourceInfo *TSI = getTypeSourceInfo();
   if (!TSI)
     return SourceRange();
- FunctionTypeLoc FTL =
- TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>();
+ auto TL = TSI->getTypeLoc().IgnoreParens();
+ if (auto ATL = TL.getAs<AttributedTypeLoc>())
+ TL = ATL.getModifiedLoc();
+ FunctionTypeLoc FTL = TL.getAs<FunctionTypeLoc>();
   if (!FTL)
     return SourceRange();

but wonder what the right fix would be---change call sites of TypeLoc::getAs as done in the patch, or change TypeLoc::getAs itself? I see that there's probably the same issue with the directly preceeding definition of FunctionDecl::getreturnTypeSourceRange in Decl.cpp, for example.