diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-07-09 01:00:29 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-07-09 01:00:29 +0000 |
commit | 701a3523bad654ce274345452c48ca977662b031 (patch) | |
tree | a3a9f313bb077f59bdc970f0b8b31319a73ee356 /clang/lib/Lex/PPDirectives.cpp | |
parent | baf2912b402f695cd6b957df47fdc9a50c0a5b6a (diff) | |
download | bcm5719-llvm-701a3523bad654ce274345452c48ca977662b031.tar.gz bcm5719-llvm-701a3523bad654ce274345452c48ca977662b031.zip |
Don't give # and ## special treatment when in -traditional-cpp mode. Patch by
Austin Seipp!
llvm-svn: 185896
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 026a7e72288..cb56615ddcc 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1905,6 +1905,18 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok, continue; } + // If we're in -traditional mode, then we should ignore stringification + // and token pasting. Mark the tokens as unknown so as not to confuse + // things. + if (getLangOpts().TraditionalCPP) { + Tok.setKind(tok::unknown); + MI->AddTokenToBody(Tok); + + // Get the next token of the macro. + LexUnexpandedToken(Tok); + continue; + } + if (Tok.is(tok::hashhash)) { // If we see token pasting, check if it looks like the gcc comma |