[PATCH] D11789: Modify DeclaratorChuck::getFunction to be passed an Exception Specification SourceRange
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 6 16:23:27 PDT 2015
rsmith added inline comments.
================
Comment at: include/clang/Sema/DeclSpec.h:1262
@@ +1261,3 @@
+
+ /// \brief The end location of the keyword introducing the spec, if any.
+ unsigned ExceptionSpecLocEnd;
----------------
Drop bogus "keyword introducing the" here, and drop either the same words from the previous comment or the word "beginning".
================
Comment at: lib/Sema/SemaDecl.cpp:7450
@@ +7449,3 @@
+ SourceRange Range;
+ if (FPT->hasExceptionSpec() && D.isFunctionDeclarator()) {
+ Range = D.getFunctionTypeInfo().getExceptionSpecRange();
----------------
The `D.isFunctionDeclarator()` check should be nested within this, as should the `Range` variable:
if (FPT->hasExceptionSpec()) {
SourceRange Range;
if (D.isFunctionDeclarator())
Range = D.getFunctionTypeInfo().getExceptionSpecRange();
PartialDiagnostic PD = ...
================
Comment at: lib/Sema/SemaDecl.cpp:7454-7456
@@ +7453,5 @@
+ PDiag(diag::err_function_concept_exception_spec);
+ if (Range.isValid()) {
+ PD << FixItHint::CreateRemoval(Range);
+ }
+ Diag(NewFD->getLocation(), PD);
----------------
You don't need this `if`; a `FixItHint` with an invalid range has no effect.
================
Comment at: test/SemaCXX/cxx-concept-declaration.cpp:9-10
@@ -8,1 +8,4 @@
+template<typename T> concept bool C3() { return true; }
+static_assert(noexcept(C3<int>()), "function concept should be treated as if noexcept(true) specified");
+
----------------
This isn't quite enough; `noexcept` will also return `true` if the expression is a constant expression. Maybe replace the `return true` with `return (throw 0, true)`.
http://reviews.llvm.org/D11789
More information about the cfe-commits
mailing list