summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorMatthias Gehre <M.Gehre@gmx.de>2017-04-04 20:11:13 +0000
committerMatthias Gehre <M.Gehre@gmx.de>2017-04-04 20:11:13 +0000
commitddae2516b8596647e9741affa0280cd6e6e41bdb (patch)
tree80e34685a2c047b003d507c745aa78559a3485bc /clang/lib/Format
parent8465d083921c56ac35d2c292da316dd470641ef2 (diff)
downloadbcm5719-llvm-ddae2516b8596647e9741affa0280cd6e6e41bdb.tar.gz
bcm5719-llvm-ddae2516b8596647e9741affa0280cd6e6e41bdb.zip
[clang-format] fix crash in NamespaceEndCommentsFixer (PR32438)
Summary: The new test case was crashing before. Now it passes as expected. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D31441 llvm-svn: 299465
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/NamespaceEndCommentsFixer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/NamespaceEndCommentsFixer.cpp b/clang/lib/Format/NamespaceEndCommentsFixer.cpp
index af751100ece..88cf123c189 100644
--- a/clang/lib/Format/NamespaceEndCommentsFixer.cpp
+++ b/clang/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -133,7 +133,7 @@ tooling::Replacements NamespaceEndCommentsFixer::analyze(
// Detect "(inline)? namespace" in the beginning of a line.
if (NamespaceTok->is(tok::kw_inline))
NamespaceTok = NamespaceTok->getNextNonComment();
- if (NamespaceTok->isNot(tok::kw_namespace))
+ if (!NamespaceTok || NamespaceTok->isNot(tok::kw_namespace))
continue;
FormatToken *RBraceTok = EndLine->First;
if (RBraceTok->Finalized)
OpenPOWER on IntegriCloud