[clang] [clang][ASTImporter] Invalidate ImportedTypes cache on Decl import failure (PR #214008)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 7 05:14:36 PDT 2026
================
@@ -10038,6 +10038,13 @@ Expected<Decl *> ASTImporter::Import(Decl *FromD) {
auto *ToD = CreatedToD;
ImportedDecls.erase(Pos);
+ // Also scrub the imported type mapping, if applicable. Import(Type*) can
+ // cache a type mapping to a declaration that ultimately fails.
+ if (const auto *FromTD = dyn_cast<TagDecl>(FromD))
+ if (const Type *FromTy =
+ getFromContext().getCanonicalTagType(FromTD).getTypePtr())
+ ImportedTypes.erase(FromTy);
----------------
steakhal wrote:
It is likely subjective but how I read the llvm style guide is that if a single guarded statement does not align perfectly intuitively under the guarding if, then one must always use braces.
Here since there is a line break in the condition it disqualifies. Because that is discualified, the parent `if` is also disqualified from eliding the braces.
https://github.com/llvm/llvm-project/pull/214008
More information about the cfe-commits
mailing list