summaryrefslogtreecommitdiffstats
path: root/clang/Lex
diff options
context:
space:
mode:
Diffstat (limited to 'clang/Lex')
-rw-r--r--clang/Lex/Lexer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/Lex/Lexer.cpp b/clang/Lex/Lexer.cpp
index 9cf0dae0a0c..967d4e76758 100644
--- a/clang/Lex/Lexer.cpp
+++ b/clang/Lex/Lexer.cpp
@@ -928,6 +928,15 @@ LexNextToken:
// CurPtr - Cache BufferPtr in an automatic variable.
const char *CurPtr = BufferPtr;
+ // Small amounts of horizontal whitespace is very common between tokens.
+ if ((*CurPtr == ' ') || (*CurPtr == '\t')) {
+ ++CurPtr;
+ while ((*CurPtr == ' ') || (*CurPtr == '\t'))
+ ++CurPtr;
+ BufferPtr = CurPtr;
+ Result.SetFlag(LexerToken::LeadingSpace);
+ }
+
unsigned SizeTmp, SizeTmp2; // Temporaries for use in cases below.
// Read a character, advancing over it.
OpenPOWER on IntegriCloud