r224562 - Fix layering violation, Lex shouldn't know about Decl
David Majnemer
david.majnemer at gmail.com
Thu Dec 18 18:13:56 PST 2014
Author: majnemer
Date: Thu Dec 18 20:13:56 2014
New Revision: 224562
URL: http://llvm.org/viewvc/llvm-project?rev=224562&view=rev
Log:
Fix layering violation, Lex shouldn't know about Decl
Modified:
cfe/trunk/include/clang/Lex/Token.h
cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
Modified: cfe/trunk/include/clang/Lex/Token.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Token.h?rev=224562&r1=224561&r2=224562&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/Token.h (original)
+++ cfe/trunk/include/clang/Lex/Token.h Thu Dec 18 20:13:56 2014
@@ -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
Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=224562&r1=224561&r2=224562&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Thu Dec 18 20:13:56 2014
@@ -218,7 +218,7 @@ void Parser::ParseCXXNonStaticMemberInit
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
ConsumeAnyToken();
}
// Make sure this is *our* artificial EOF token.
- if (Tok.getDecl() == MI.Field)
+ if (Tok.getEofData() == MI.Field)
ConsumeAnyToken();
}
More information about the cfe-commits
mailing list