aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-05 21:34:55 +0000
committerManuel Klimek <klimek@google.com>2013-01-05 21:34:55 +0000
commit6f8424b79863fc9810393c95ecdee97895ab6f26 (patch)
treef16e8af4f0eee195c64c0f16a18911cb14049fdd /lib/Format/UnwrappedLineParser.cpp
parentd8180cf9877cd793949ae94edbf2ee84341041c5 (diff)
Fixes PR14811: Crash when formatting some macros
A preprocessor directive cannot be started while we're parsing one. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171635 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--lib/Format/UnwrappedLineParser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 04d1b36582..c1bafa9a3b 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -469,7 +469,7 @@ void UnwrappedLineParser::nextToken() {
void UnwrappedLineParser::readToken() {
FormatTok = Tokens->getNextToken();
- while (FormatTok.Tok.is(tok::hash)) {
+ while (!Line.InPPDirective && FormatTok.Tok.is(tok::hash)) {
// FIXME: This is incorrect - the correct way is to create a
// data structure that will construct the parts around the preprocessor
// directive as a structured \c UnwrappedLine.