[clang] [modules] Handle friend function that was a definition but became only a declaration during AST deserialization (PR #132214)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 31 19:01:03 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;
----------------
ChuanqiXu9 wrote:
But it may introduce unnecessary insertions. I still feel it is better to add another map. And this practice seems to be more scalarble to me, e.g, if we want to add other similar information, it may not be good to add all the information to the struct.
https://github.com/llvm/llvm-project/pull/132214
More information about the cfe-commits
mailing list