[PATCH] D11789: Modify DeclaratorChuck::getFunction to be passed an Exception Specification SourceRange

Nathan Wilson nwilson20 at gmail.com
Wed Aug 5 19:28:41 PDT 2015


nwilson added a comment.

I'll make the fixes based on the comments, but had question about the FunctionTypeInfo in the meantime.


================
Comment at: lib/Sema/SemaDecl.cpp:7447-7450
@@ -7446,1 +7446,6 @@
 
+      if (const FunctionProtoType *FPT = R->getAs<FunctionProtoType>()) {
+        if (FPT->hasExceptionSpec()) {
+          auto LocBeg = D.getFunctionTypeInfo().getExceptionSpecLocBeg();
+          auto LocEnd = D.getFunctionTypeInfo().getExceptionSpecLocEnd();
+          Diag(LocBeg, diag::err_function_concept_exception_spec)
----------------
rsmith wrote:
> This will assert if there isn't a `FunctionTypeInfo` for the declaration, which can theoretically happen if it's declared via an (ill-formed today) `typedef`. (It also might not provide a source range if the exception specification is implicit, for instance because the function template is a destructor or deallocation function, but passing an empty SourceRange to the FixItHint should just result it in being ignored.)
Hmm, I'm not sure if we'd run into that case because I don't believe we can have a `concept` specified as a typedef (check is yet to be added) and a check exists for being in a non-namespace scope. Do you think a check should still be added verifying that the FunctionTypeInfo exists?


http://reviews.llvm.org/D11789





More information about the cfe-commits mailing list