diff options
author | Eli Bendersky <eliben@google.com> | 2015-03-23 21:43:28 +0000 |
---|---|---|
committer | Eli Bendersky <eliben@google.com> | 2015-03-23 21:43:28 +0000 |
commit | 5f4d76efd365c7f816c712013a0eb9ecfa8446bb (patch) | |
tree | 8f31dd96e4f219023c9e66dd9719e5499a24c04e /clang/unittests/AST/SourceLocationTest.cpp | |
parent | f2b408c64e3d1503a3e7c63b3b48fb9c42e7aff6 (diff) | |
download | llvm-5f4d76efd365c7f816c712013a0eb9ecfa8446bb.zip llvm-5f4d76efd365c7f816c712013a0eb9ecfa8446bb.tar.gz llvm-5f4d76efd365c7f816c712013a0eb9ecfa8446bb.tar.bz2 |
Record correct source range for defaulted/deleted members.
Fixes https://llvm.org/bugs/show_bug.cgi?id=20744
struct A {
A() = default;
};
Previously the source range of the declaration of A ended at the ')'. It should
include the '= default' part as well. The same for '= delete'.
Note: this will break one of the clang-tidy fixers, which is going to be
addessed in a follow-up patch.
Differential Revision: http://reviews.llvm.org/D8465
llvm-svn: 233028
Diffstat (limited to 'clang/unittests/AST/SourceLocationTest.cpp')
-rw-r--r-- | clang/unittests/AST/SourceLocationTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp index ca5a889..98460d9 100644 --- a/clang/unittests/AST/SourceLocationTest.cpp +++ b/clang/unittests/AST/SourceLocationTest.cpp @@ -122,6 +122,18 @@ TEST(CXXConstructorDecl, NoRetFunTypeLocRange) { EXPECT_TRUE(Verifier.match("class C { C(); };", functionDecl())); } +TEST(CXXConstructorDecl, DefaultedCtorLocRange) { + RangeVerifier<CXXConstructorDecl> Verifier; + Verifier.expectRange(1, 11, 1, 23); + EXPECT_TRUE(Verifier.match("class C { C() = default; };", functionDecl())); +} + +TEST(CXXConstructorDecl, DeletedCtorLocRange) { + RangeVerifier<CXXConstructorDecl> Verifier; + Verifier.expectRange(1, 11, 1, 22); + EXPECT_TRUE(Verifier.match("class C { C() = delete; };", functionDecl())); +} + TEST(CompoundLiteralExpr, CompoundVectorLiteralRange) { RangeVerifier<CompoundLiteralExpr> Verifier; Verifier.expectRange(2, 11, 2, 22); |