summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/NamespaceEndCommentsFixer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/NamespaceEndCommentsFixer.cpp')
-rw-r--r--clang/lib/Format/NamespaceEndCommentsFixer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/NamespaceEndCommentsFixer.cpp b/clang/lib/Format/NamespaceEndCommentsFixer.cpp
index 578dcf7b670..d0b5919c9bd 100644
--- a/clang/lib/Format/NamespaceEndCommentsFixer.cpp
+++ b/clang/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -135,7 +135,10 @@ tooling::Replacements NamespaceEndCommentsFixer::analyze(
NamespaceTok = NamespaceTok->getNextNonComment();
if (NamespaceTok->isNot(tok::kw_namespace))
continue;
- const FormatToken *RBraceTok = EndLine->First;
+ FormatToken *RBraceTok = EndLine->First;
+ if (RBraceTok->Finalized)
+ continue;
+ RBraceTok->Finalized = true;
const std::string NamespaceName = computeName(NamespaceTok);
bool AddNewline = (I + 1 < E) &&
AnnotatedLines[I + 1]->First->NewlinesBefore == 0 &&
OpenPOWER on IntegriCloud