aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 215ac18..8ed3df7 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1484,6 +1484,13 @@ void Sema::ActOnEndOfTranslationUnit() {
Consumer.CompleteTentativeDefinition(VD);
}
+ // In incremental mode, tentative definitions belong to the current
+ // partial translation unit (PTU). Once they have been completed and
+ // emitted to codegen, drop them to prevent re-emission in future PTUs.
+ if (PP.isIncrementalProcessingEnabled())
+ TentativeDefinitions.erase(TentativeDefinitions.begin(ExternalSource.get()),
+ TentativeDefinitions.end());
+
for (auto *D : ExternalDeclarations) {
if (!D || D->isInvalidDecl() || D->getPreviousDecl() || !D->isUsed())
continue;