From 5f4d76efd365c7f816c712013a0eb9ecfa8446bb Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Mon, 23 Mar 2015 21:43:28 +0000 Subject: 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 --- clang/unittests/AST/SourceLocationTest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/unittests/AST/SourceLocationTest.cpp') diff --git a/clang/unittests/AST/SourceLocationTest.cpp b/clang/unittests/AST/SourceLocationTest.cpp index ca5a8892a58..98460d959c3 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 Verifier; + Verifier.expectRange(1, 11, 1, 23); + EXPECT_TRUE(Verifier.match("class C { C() = default; };", functionDecl())); +} + +TEST(CXXConstructorDecl, DeletedCtorLocRange) { + RangeVerifier Verifier; + Verifier.expectRange(1, 11, 1, 22); + EXPECT_TRUE(Verifier.match("class C { C() = delete; };", functionDecl())); +} + TEST(CompoundLiteralExpr, CompoundVectorLiteralRange) { RangeVerifier Verifier; Verifier.expectRange(2, 11, 2, 22); -- cgit v1.2.3