[clang] [modules] Handle friend function that was a definition but became only a declaration during AST deserialization (PR #132214)
Dmitry Polukhin via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 28 04:34:06 PDT 2025
================
@@ -1390,7 +1390,19 @@ class ASTReader
/// predefines buffer may contain additional definitions.
std::string SuggestedPredefines;
- llvm::DenseMap<const Decl *, bool> DefinitionSource;
+ struct DefinitionSourceFlags {
+ ExtKind HasExternalDefinitions : 2;
+
+ /// Indicates if given function declaration was a definition but its body
+ /// was removed due to declaration merging.
+ bool ThisDeclarationWasADefinition : 1;
+
+ DefinitionSourceFlags()
+ : HasExternalDefinitions(EK_ReplyHazy),
+ ThisDeclarationWasADefinition(false) {}
+ };
+
+ llvm::DenseMap<const Decl *, DefinitionSourceFlags> DefinitionSource;
----------------
dmpolukhin wrote:
I think memory overhead for another map will be higher. The value_type was bool but in reality at least 4-8 bytes were allocated for it so converting it to struct with 3 bits only shouldn't take extra space.
https://github.com/llvm/llvm-project/pull/132214
More information about the cfe-commits
mailing list