diff options
Diffstat (limited to 'clang/lib/Format/NamespaceEndCommentsFixer.cpp')
-rw-r--r-- | clang/lib/Format/NamespaceEndCommentsFixer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/NamespaceEndCommentsFixer.cpp b/clang/lib/Format/NamespaceEndCommentsFixer.cpp index def551f863cd..38ab5b9df76d 100644 --- a/clang/lib/Format/NamespaceEndCommentsFixer.cpp +++ b/clang/lib/Format/NamespaceEndCommentsFixer.cpp @@ -180,9 +180,13 @@ getNamespaceToken(const AnnotatedLine *Line, if (NamespaceTok->is(tok::l_brace)) { // "namespace" keyword can be on the line preceding '{', e.g. in styles // where BraceWrapping.AfterNamespace is true. - if (StartLineIndex > 0) + if (StartLineIndex > 0) { NamespaceTok = AnnotatedLines[StartLineIndex - 1]->First; + if (AnnotatedLines[StartLineIndex - 1]->endsWith(tok::semi)) + return nullptr; + } } + return NamespaceTok->getNamespaceToken(); } |