diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 45b533945f0851ec234ca846e1af5ee1e4df0b6e (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /lib/Lex/TokenLexer.cpp | |
parent | 7e86edd64bfae4e324224452e4ea879b3371a4bd (diff) | |
download | src-45b533945f0851ec234ca846e1af5ee1e4df0b6e.tar.gz src-45b533945f0851ec234ca846e1af5ee1e4df0b6e.zip |
Vendor import of clang trunk r256633:vendor/clang/clang-trunk-r256633
Notes
Notes:
svn path=/vendor/clang/dist/; revision=292920
svn path=/vendor/clang/clang-trunk-r256633/; revision=292923; tag=vendor/clang/clang-trunk-r256633
Diffstat (limited to 'lib/Lex/TokenLexer.cpp')
-rw-r--r-- | lib/Lex/TokenLexer.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp index e7512fa2831a..c42966928e52 100644 --- a/lib/Lex/TokenLexer.cpp +++ b/lib/Lex/TokenLexer.cpp @@ -624,21 +624,22 @@ bool TokenLexer::PasteTokens(Token &Tok) { // error. This occurs with "x ## +" and other stuff. Return with Tok // unmodified and with RHS as the next token to lex. if (isInvalid) { + // Explicitly convert the token location to have proper expansion + // information so that the user knows where it came from. + SourceManager &SM = PP.getSourceManager(); + SourceLocation Loc = + SM.createExpansionLoc(PasteOpLoc, ExpandLocStart, ExpandLocEnd, 2); + // Test for the Microsoft extension of /##/ turning into // here on the // error path. if (PP.getLangOpts().MicrosoftExt && Tok.is(tok::slash) && RHS.is(tok::slash)) { - HandleMicrosoftCommentPaste(Tok); + HandleMicrosoftCommentPaste(Tok, Loc); return true; } // Do not emit the error when preprocessing assembler code. if (!PP.getLangOpts().AsmPreprocessor) { - // Explicitly convert the token location to have proper expansion - // information so that the user knows where it came from. - SourceManager &SM = PP.getSourceManager(); - SourceLocation Loc = - SM.createExpansionLoc(PasteOpLoc, ExpandLocStart, ExpandLocEnd, 2); // If we're in microsoft extensions mode, downgrade this from a hard // error to an extension that defaults to an error. This allows // disabling it. @@ -719,7 +720,9 @@ bool TokenLexer::isParsingPreprocessorDirective() const { /// macro, other active macros, and anything left on the current physical /// source line of the expanded buffer. Handle this by returning the /// first token on the next line. -void TokenLexer::HandleMicrosoftCommentPaste(Token &Tok) { +void TokenLexer::HandleMicrosoftCommentPaste(Token &Tok, SourceLocation OpLoc) { + PP.Diag(OpLoc, diag::ext_comment_paste_microsoft); + // We 'comment out' the rest of this macro by just ignoring the rest of the // tokens that have not been lexed yet, if any. |