From cae049a96287f40141e8372be2b6e64a2efa1bfe Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 19 Dec 2014 02:13:56 +0000 Subject: [PATCH] Fix layering violation, Lex shouldn't know about Decl git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224562 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Lex/Token.h | 9 ++++----- lib/Parse/ParseCXXInlineMethods.cpp | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/clang/Lex/Token.h b/include/clang/Lex/Token.h index a4b4e12557..4a53c9c1bb 100644 --- a/include/clang/Lex/Token.h +++ b/include/clang/Lex/Token.h @@ -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(PtrData); + return reinterpret_cast(PtrData); } - void setDecl(const Decl *D) { + void setEofData(const void *D) { assert(is(tok::eof)); assert(!PtrData); - PtrData = const_cast(D); + PtrData = const_cast(D); } /// getRawIdentifier - For a raw identifier token (i.e., an identifier diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp index 96d35bc249..e39f2f1627 100644 --- a/lib/Parse/ParseCXXInlineMethods.cpp +++ b/lib/Parse/ParseCXXInlineMethods.cpp @@ -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(); } -- 2.40.0