llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Jonas Hahnfeld (hahnjo)

<details>
<summary>Changes</summary>

`ExternalASTSource::incrementGeneration` returns the `OldGeneration`, which 
must be taken into account in case it is delegated to the topmost external 
source.

This obsoletes a long-standing downstream patch in Cling that was previously 
submitted in https://reviews.llvm.org/D39714.

---
Full diff: https://github.com/llvm/llvm-project/pull/219189.diff


1 Files Affected:

- (modified) clang/lib/AST/ExternalASTSource.cpp (+9-8) 


``````````diff
diff --git a/clang/lib/AST/ExternalASTSource.cpp 
b/clang/lib/AST/ExternalASTSource.cpp
index e8c1004089713..1888ffd6bd27c 100644
--- a/clang/lib/AST/ExternalASTSource.cpp
+++ b/clang/lib/AST/ExternalASTSource.cpp
@@ -118,19 +118,20 @@ void ExternalASTSource::FindExternalLexicalDecls(
 void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const {}
 
 uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) {
-  uint32_t OldGeneration = CurrentGeneration;
-
   // Make sure the generation of the topmost external source for the context is
   // incremented. That might not be us.
   auto *P = C.getExternalSource();
-  if (P && P != this)
+  if (P && P != this) {
+    // The call itself returns the OldGeneration of the topmost external 
source.
     CurrentGeneration = P->incrementGeneration(C);
-  else {
-    // FIXME: Only bump the generation counter if the current generation number
-    // has been observed?
-    if (!++CurrentGeneration)
-      llvm::reportFatalUsageError("generation counter overflowed");
   }
 
+  uint32_t OldGeneration = CurrentGeneration;
+
+  // FIXME: Only bump the generation counter if the current generation number
+  // has been observed?
+  if (!++CurrentGeneration)
+    llvm::reportFatalUsageError("generation counter overflowed");
+
   return OldGeneration;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/219189
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to