diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-18 20:58:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-18 20:58:27 +0000 |
commit | 2534324a4e6b5137d7eb786f5c1b07215e1e650d (patch) | |
tree | e3d89a543b59a00229f039e81d5118a0b014fc2e /clang/lib | |
parent | 5eb8ae2453aee62a0acd56a5cb48259156d087f6 (diff) | |
download | bcm5719-llvm-2534324a4e6b5137d7eb786f5c1b07215e1e650d.tar.gz bcm5719-llvm-2534324a4e6b5137d7eb786f5c1b07215e1e650d.zip |
properly form a full token for # before calling HandleDirective.
llvm-svn: 67235
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Lex/Lexer.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index c68d21c7e79..0478eebb623 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -1595,15 +1595,13 @@ LexNextToken: if (!isLexingRawMode()) Diag(BufferPtr, diag::charize_microsoft_ext); Kind = tok::hashat; - } else { - Kind = tok::hash; // '%:' -> '#' - + } else { // '%:' -> '#' // We parsed a # character. If this occurs at the start of the line, // it's actually the start of a preprocessing directive. Callback to // the preprocessor to handle it. // FIXME: -fpreprocessed mode?? if (Result.isAtStartOfLine() && !LexingRawMode) { - BufferPtr = CurPtr; + FormTokenWithChars(Result, CurPtr, tok::hash); PP->HandleDirective(Result); // As an optimization, if the preprocessor didn't switch lexers, tail @@ -1621,6 +1619,8 @@ LexNextToken: return PP->Lex(Result); } + + Kind = tok::hash; } } else { Kind = tok::percent; @@ -1727,13 +1727,12 @@ LexNextToken: Diag(BufferPtr, diag::charize_microsoft_ext); CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); } else { - Kind = tok::hash; // We parsed a # character. If this occurs at the start of the line, // it's actually the start of a preprocessing directive. Callback to // the preprocessor to handle it. // FIXME: -fpreprocessed mode?? if (Result.isAtStartOfLine() && !LexingRawMode) { - BufferPtr = CurPtr; + FormTokenWithChars(Result, CurPtr, tok::hash); PP->HandleDirective(Result); // As an optimization, if the preprocessor didn't switch lexers, tail @@ -1750,6 +1749,8 @@ LexNextToken: } return PP->Lex(Result); } + + Kind = tok::hash; } break; |