]> granicus.if.org Git - clang/commitdiff
When parsing cached C++ method declarations/definitions, save the
authorDouglas Gregor <dgregor@apple.com>
Wed, 16 Jun 2010 23:45:56 +0000 (23:45 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 16 Jun 2010 23:45:56 +0000 (23:45 +0000)
"previous token" location at the end of the class definition. This
eliminates a badly-placed error + Fix-It when the ';' following a
class definition is missing. Fixes <rdar://problem/8066414>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106175 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp
test/SemaCXX/class.cpp

index fe3122645b1e5766ccb3e0dfb851e05d5506bb85..bfc5b05e737f0147831531a240cd1fc45ffbd5dd 100644 (file)
@@ -1619,8 +1619,10 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
     // We are not inside a nested class. This class and its nested classes
     // are complete and we can parse the delayed portions of method
     // declarations and the lexed inline method definitions.
+    SourceLocation SavedPrevTokLocation = PrevTokLocation;
     ParseLexedMethodDeclarations(getCurrentClass());
     ParseLexedMethodDefs(getCurrentClass());
+    PrevTokLocation = SavedPrevTokLocation;
   }
 
   if (TagDecl)
index b5cecbcf937b9b62b85219cd037f7ca3b00e7e31..9d9508b8ef4a6b9208fdaef78b85e29c7ea5c4dc 100644 (file)
@@ -159,3 +159,9 @@ namespace PR7196 {
     }
   };
 }
+
+namespace rdar8066414 {
+  class C {
+    C() {}
+  } // expected-error{{expected ';' after class}}
+}