Fix layering violation, Lex shouldn't know about Decl

llvm-svn: 224562
This commit is contained in:
David Majnemer 2014-12-19 02:13:56 +00:00
parent a865a1683a
commit ce1d30142c
2 changed files with 6 additions and 7 deletions

View 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

View 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();
}