diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/PrintPreprocessedOutput.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Lex/TokenConcatenation.cpp | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 834e5262c63..f3393bfe51c 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -342,7 +342,6 @@ void PrintPPOutputPPCallbacks::InclusionDirective(SourceLocation HashLoc, OS << "@import " << Imported->getFullModuleName() << ";" << " /* clang -E: implicit import for \"" << File->getName() << "\" */"; EmittedTokensOnThisLine = true; - setEmittedDirectiveOnThisLine(); } } @@ -658,9 +657,11 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, // -traditional-cpp the lexer keeps /all/ whitespace, including comments. SourceLocation StartLoc = Tok.getLocation(); Callbacks->MoveToLine(StartLoc.getLocWithOffset(Tok.getLength())); - } else if (Tok.isAnnotation()) { - // PrintPPOutputPPCallbacks handles producing appropriate output here. - // Ignore this token entirely. + } else if (Tok.is(tok::annot_module_include) || + Tok.is(tok::annot_module_begin) || + Tok.is(tok::annot_module_end)) { + // PrintPPOutputPPCallbacks::InclusionDirective handles producing + // appropriate output here. Ignore this token entirely. PP.Lex(Tok); continue; } else if (IdentifierInfo *II = Tok.getIdentifierInfo()) { diff --git a/clang/lib/Lex/TokenConcatenation.cpp b/clang/lib/Lex/TokenConcatenation.cpp index 9de28a875e7..0a66bba91fc 100644 --- a/clang/lib/Lex/TokenConcatenation.cpp +++ b/clang/lib/Lex/TokenConcatenation.cpp @@ -163,8 +163,8 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, return false; tok::TokenKind PrevKind = PrevTok.getKind(); - if (!PrevTok.isAnnotation() && PrevTok.getIdentifierInfo()) - PrevKind = tok::identifier; // Language keyword or named operator. + if (PrevTok.getIdentifierInfo()) // Language keyword or named operator. + PrevKind = tok::identifier; // Look up information on when we should avoid concatenation with prevtok. unsigned ConcatInfo = TokenInfo[PrevKind]; @@ -212,7 +212,7 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, // In C++11, a string or character literal followed by an identifier is a // single token. - if (!Tok.isAnnotation() && Tok.getIdentifierInfo()) + if (Tok.getIdentifierInfo()) return true; // A ud-suffix is an identifier. If the previous token ends with one, treat @@ -225,9 +225,6 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, if (Tok.is(tok::numeric_constant)) return GetFirstChar(PP, Tok) != '.'; - if (Tok.isAnnotation()) // token will be put on its own line. - return false; - if (Tok.getIdentifierInfo() || Tok.is(tok::wide_string_literal) || Tok.is(tok::utf8_string_literal) || Tok.is(tok::utf16_string_literal) || Tok.is(tok::utf32_string_literal) || Tok.is(tok::wide_char_constant) || |