[PATCH] D20428: Tracking exception specification source locations
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 8 13:41:35 PDT 2016
rsmith accepted this revision.
This revision is now accepted and ready to land.
================
Comment at: lib/AST/Decl.cpp:2938-2948
@@ -2937,1 +2937,13 @@
+SourceRange FunctionDecl::getExceptionSpecSourceRange() const {
+ const TypeSourceInfo *TSI = getTypeSourceInfo();
+ if (!TSI)
+ return SourceRange();
+ FunctionTypeLoc FTL =
+ TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>();
+ if (!FTL)
+ return SourceRange();
+
+ return FTL.getExceptionSpecRange();
+}
+
----------------
Can you factor out a function to get the `FunctionTypeLoc` from a `FunctionDecl`, when there is one (preferably as a separate change)? This is duplicated in a few places now (you can find some more by searching for `getAs<FunctionProtoTypeLoc>` in Sema), and looks slightly wrong here (we should skip calling convention attributes as well as parens).
http://reviews.llvm.org/D20428
More information about the cfe-commits
mailing list