@@ -220,8 +220,9 @@ class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
220220 // / Gives the external AST source an opportunity to complete
221221 // / the redeclaration chain for a declaration. Called each time we
222222 // / need the most recent declaration of a declaration after the
223- // / generation count is incremented.
224- virtual void CompleteRedeclChain (const Decl *D);
223+ // / generation count is incremented. Returns true if the redeclaration
224+ // / chain completion was completed.
225+ virtual bool CompleteRedeclChain (const Decl *D);
225226
226227 // / Gives the external AST source an opportunity to complete
227228 // / an incomplete type.
@@ -437,7 +438,7 @@ struct LazyOffsetPtr {
437438// / A lazy value (of type T) that is within an AST node of type Owner,
438439// / where the value might change in later generations of the external AST
439440// / source.
440- template <typename Owner, typename T, void (ExternalASTSource::*Update)(Owner)>
441+ template <typename Owner, typename T, bool (ExternalASTSource::*Update)(Owner)>
441442struct LazyGenerationalUpdatePtr {
442443 // / A cache of the value of this pointer, in the most recent generation in
443444 // / which we queried it.
@@ -487,9 +488,9 @@ struct LazyGenerationalUpdatePtr {
487488 // / Get the value of this pointer, updating its owner if necessary.
488489 T get (Owner O) {
489490 if (auto *LazyVal = Value.template dyn_cast <LazyData *>()) {
490- if (LazyVal->LastGeneration != LazyVal->ExternalSource ->getGeneration ()) {
491+ if (LazyVal->LastGeneration != LazyVal->ExternalSource ->getGeneration () &&
492+ (LazyVal->ExternalSource ->*Update)(O)) {
491493 LazyVal->LastGeneration = LazyVal->ExternalSource ->getGeneration ();
492- (LazyVal->ExternalSource ->*Update)(O);
493494 }
494495 return LazyVal->LastValue ;
495496 }
@@ -516,7 +517,7 @@ namespace llvm {
516517// / Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be
517518// / placed into a PointerUnion.
518519template <typename Owner, typename T,
519- void (clang::ExternalASTSource::*Update)(Owner)>
520+ bool (clang::ExternalASTSource::*Update)(Owner)>
520521struct PointerLikeTypeTraits <
521522 clang::LazyGenerationalUpdatePtr<Owner, T, Update>> {
522523 using Ptr = clang::LazyGenerationalUpdatePtr<Owner, T, Update>;
0 commit comments