diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-01-30 18:09:55 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-01-30 18:09:55 +0000 |
commit | 5944ecd64c6863ab278425c39149014993ef5c4d (patch) | |
tree | 1fe028c00f91f5b5bf6666d7710158478ca1d04f /clang/lib/Lex/TokenConcatenation.cpp | |
parent | a1f31460d8266bd9b5b9890af375646fff18c0e9 (diff) | |
download | bcm5719-llvm-5944ecd64c6863ab278425c39149014993ef5c4d.tar.gz bcm5719-llvm-5944ecd64c6863ab278425c39149014993ef5c4d.zip |
Fix assertion failures on annot_* tokens in clang -E
In particular, #pragma clang __debug, and #include implicitly changed
into @import were causing assertion failures.
llvm-svn: 200475
Diffstat (limited to 'clang/lib/Lex/TokenConcatenation.cpp')
-rw-r--r-- | clang/lib/Lex/TokenConcatenation.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Lex/TokenConcatenation.cpp b/clang/lib/Lex/TokenConcatenation.cpp index 0a66bba91fc..9de28a875e7 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.getIdentifierInfo()) // Language keyword or named operator. - PrevKind = tok::identifier; + if (!PrevTok.isAnnotation() && PrevTok.getIdentifierInfo()) + PrevKind = tok::identifier; // Language keyword or named operator. // 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.getIdentifierInfo()) + if (!Tok.isAnnotation() && Tok.getIdentifierInfo()) return true; // A ud-suffix is an identifier. If the previous token ends with one, treat @@ -225,6 +225,9 @@ 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) || |