summaryrefslogtreecommitdiffstats
path: root/clang/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
commit09e0797953efdbc8eebabfd10a45ae56cb33f8bf (patch)
tree5c838dbe2073e7ebacb7957391fee11b23ce96bb /clang/lib/Format/UnwrappedLineParser.cpp
parent219c7d9f6491c4963e62c1d21d3e45713fbfea0c (diff)
downloadbcm5719-llvm-09e0797953efdbc8eebabfd10a45ae56cb33f8bf.tar.gz
bcm5719-llvm-09e0797953efdbc8eebabfd10a45ae56cb33f8bf.zip
Fixes PR14811: Crash when formatting some macros
A preprocessor directive cannot be started while we're parsing one. llvm-svn: 171635
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 04d1b365821..c1bafa9a3b1 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud