summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Lexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-17 23:56:52 +0000
committerChris Lattner <sabre@nondot.org>2009-04-17 23:56:52 +0000
commitb40289b2b8453e22869928540c2978d8ffd6d74e (patch)
treeb70f761856dbaaf9e95a450eb22ee22928a69b64 /clang/lib/Lex/Lexer.cpp
parentca556cb3e3658637fc1eb3ff68bf348041ac959d (diff)
downloadbcm5719-llvm-b40289b2b8453e22869928540c2978d8ffd6d74e.tar.gz
bcm5719-llvm-b40289b2b8453e22869928540c2978d8ffd6d74e.zip
Fix two problems from PR3916, and one problem I noticed while hacking
on the code. llvm-svn: 69404
Diffstat (limited to 'clang/lib/Lex/Lexer.cpp')
-rw-r--r--clang/lib/Lex/Lexer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index d04b1c2b69e..490a0b53049 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -674,7 +674,7 @@ void Lexer::LexStringLiteral(Token &Result, const char *CurPtr, bool Wide) {
/// after having lexed the '<' character. This is used for #include filenames.
void Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) {
const char *NulCharacter = 0; // Does this string contain the \0 character?
-
+ const char *AfterLessPos = CurPtr;
char C = getAndAdvanceChar(CurPtr, Result);
while (C != '>') {
// Skip escaped characters.
@@ -683,9 +683,9 @@ void Lexer::LexAngledStringLiteral(Token &Result, const char *CurPtr) {
C = getAndAdvanceChar(CurPtr, Result);
} else if (C == '\n' || C == '\r' || // Newline.
(C == 0 && CurPtr-1 == BufferEnd)) { // End of file.
- if (!isLexingRawMode() && !Features.AsmPreprocessor)
- Diag(BufferPtr, diag::err_unterminated_angled_string);
- FormTokenWithChars(Result, CurPtr-1, tok::unknown);
+ // If the filename is unterminated, then it must just be a lone <
+ // character. Return this as such.
+ FormTokenWithChars(Result, AfterLessPos, tok::less);
return;
} else if (C == 0) {
NulCharacter = CurPtr-1;
@@ -1635,7 +1635,7 @@ LexNextToken:
case '<':
Char = getCharAndSize(CurPtr, SizeTmp);
if (ParsingFilename) {
- return LexAngledStringLiteral(Result, CurPtr+SizeTmp);
+ return LexAngledStringLiteral(Result, CurPtr);
} else if (Char == '<' &&
getCharAndSize(CurPtr+SizeTmp, SizeTmp2) == '=') {
Kind = tok::lesslessequal;
OpenPOWER on IntegriCloud