[PATCH] D15443: Fix getLocEnd for function declarations with exception specification.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 12 05:35:56 PST 2016
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
In http://reviews.llvm.org/D15443#324426, @adek05 wrote:
> Adding testcases in unittest/AST/SourceLocationTest.cpp as suggested by @aaronballman
>
> Interestingly, without my change tests for function declarations pass. Only member functions fail:
>
> tools/clang/unittests/AST/ASTTests
> ...
> [----------] 2 tests from FunctionDecl
> [ RUN ] FunctionDecl.FunctionDeclWithThrowSpecification
> [ OK ] FunctionDecl.FunctionDeclWithThrowSpecification (17 ms)
> [ RUN ] FunctionDecl.FunctionDeclWithNoExceptSpecification
> [ OK ] FunctionDecl.FunctionDeclWithNoExceptSpecification (10 ms)
> [----------] 2 tests from FunctionDecl (27 ms total)
>
> [----------] 2 tests from CXXMethodDecl
> [ RUN ] CXXMethodDecl.CXXMethodDeclWithThrowSpecification
> /Users/adek/llvm-git/tools/clang/unittests/AST/SourceLocationTest.cpp:569: Failure
> Value of: Verifier.match( "class A {\n" "void f() throw();\n" "};\n", functionDecl())
> Actual: false (Expected range <2:1-2:16>, found <input.cc:2:1-input.cc:2:17>)
> Expected: true
> [ FAILED ] CXXMethodDecl.CXXMethodDeclWithThrowSpecification (10 ms)
> [ RUN ] CXXMethodDecl.CXXMethodDeclWithNoExceptSpecification
> /Users/adek/llvm-git/tools/clang/unittests/AST/SourceLocationTest.cpp:580: Failure
> Value of: Verifier.match( "class A {\n" "void f() noexcept(false);\n" "};\n", functionDecl(), Language::Lang_CXX11)
> Actual: false (Expected range <2:1-2:24>, found <input.cc:2:1-input.cc:2:25>)
> Expected: true
> [ FAILED ] CXXMethodDecl.CXXMethodDeclWithNoExceptSpecification (10 ms)
> [----------] 2 tests from CXXMethodDecl (20 ms total)
>
>
> Not sure why would they take different codepaths, throw and noexcept are C++(11) specific so both should go through ParseDeclCXX.
It would be nice to understand why that is the case and whether there's some code sharing possibilities, but since this is such a small change, I'm not certain of the gains.
LGTM! Thanks!
http://reviews.llvm.org/D15443
More information about the cfe-commits
mailing list