]> granicus.if.org Git - clang/commitdiff
Fix layering violation, Lex shouldn't know about Decl
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 19 Dec 2014 02:13:56 +0000 (02:13 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 19 Dec 2014 02:13:56 +0000 (02:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224562 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Lex/Token.h
lib/Parse/ParseCXXInlineMethods.cpp

index a4b4e125575573cb841e97163e45ba0ca54743ae..4a53c9c1bb190ad97ca094b47994a96a48ce2523 100644 (file)
@@ -23,7 +23,6 @@
 
 namespace clang {
 
-class Decl;
 class IdentifierInfo;
 
 /// Token - This structure provides full information about a lexed token.
@@ -174,14 +173,14 @@ public:
     PtrData = (void*) II;
   }
 
-  const Decl *getDecl() const {
+  const void *getEofData() const {
     assert(is(tok::eof));
-    return reinterpret_cast<const Decl *>(PtrData);
+    return reinterpret_cast<const void *>(PtrData);
   }
-  void setDecl(const Decl *D) {
+  void setEofData(const void *D) {
     assert(is(tok::eof));
     assert(!PtrData);
-    PtrData = const_cast<Decl *>(D);
+    PtrData = const_cast<void *>(D);
   }
 
   /// getRawIdentifier - For a raw identifier token (i.e., an identifier
index 96d35bc249c869d6c099f7ac7faaabcb74c5c72a..e39f2f1627bc6151c367e9bee157113db55fa481 100644 (file)
@@ -218,7 +218,7 @@ void Parser::ParseCXXNonStaticMemberInitializer(Decl *VarD) {
   Eof.startToken();
   Eof.setKind(tok::eof);
   Eof.setLocation(Tok.getLocation());
-  Eof.setDecl(VarD);
+  Eof.setEofData(VarD);
   Toks.push_back(Eof);
 }
 
@@ -624,7 +624,7 @@ void Parser::ParseLexedMemberInitializer(LateParsedMemberInitializer &MI) {
       ConsumeAnyToken();
   }
   // Make sure this is *our* artificial EOF token.
-  if (Tok.getDecl() == MI.Field)
+  if (Tok.getEofData() == MI.Field)
     ConsumeAnyToken();
 }