diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-03-18 21:23:38 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-03-18 21:23:38 +0000 |
commit | 2ed42287b9b88a0bb08ab10e95e306da3f294ba9 (patch) | |
tree | 968485c50d1ca933ba0e3518d514d43c06abecbd /lib/Lex/Lexer.cpp | |
parent | 5ce872fdcdf868c60e91f4669b2c2925c5c2e6cc (diff) |
Lexer: Add extremely limited support for -traditional-cpp, ignoring BCPL
comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index b511421ee7..6f3d611fb0 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -2091,7 +2091,7 @@ LexNextToken: // If the next token is obviously a // or /* */ comment, skip it efficiently // too (without going through the big switch stmt). if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode() && - Features.BCPLComment) { + Features.BCPLComment && !Features.TraditionalCPP) { if (SkipBCPLComment(Result, CurPtr+2)) return; // There is a token to return. goto SkipIgnoredUnits; @@ -2280,8 +2280,10 @@ LexNextToken: // this as "foo / bar" and langauges with BCPL comments would lex it as // "foo". Check to see if the character after the second slash is a '*'. // If so, we will lex that as a "/" instead of the start of a comment. - if (Features.BCPLComment || - getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*') { + // However, we never do this in -traditional-cpp mode. + if ((Features.BCPLComment || + getCharAndSize(CurPtr+SizeTmp, SizeTmp2) != '*') && + !Features.TraditionalCPP) { if (SkipBCPLComment(Result, ConsumeChar(CurPtr, SizeTmp, Result))) return; // There is a token to return. |