[clang] [clang][ExtractAPI] Fix handling of anonymous TagDecls (PR #87772)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 10 08:40:27 PDT 2024
================
@@ -54,6 +54,13 @@ RecordContext *APIRecord::castToRecordContext(const APIRecord *Record) {
}
}
+void RecordContext::stealRecordChain(RecordContext &Other) {
+ First = Other.First;
+ Last = Other.Last;
+ Other.First = nullptr;
+ Other.Last = nullptr;
+}
----------------
QuietMisdreavus wrote:
The name `stealRecordChain` is fine, it makes it plain that `Other`'s record chain will be set to null and moved to this context. I'm just worried with the implementation; if this stands as it is, with no comment and no guard that the current context has no record chain already, then i'm worried about a future use of this function that leads to broken behavior.
If this were a more verbose codebase i would call it `overwriteRecordChainByStealingFrom` but that's a bit too far 😅
https://github.com/llvm/llvm-project/pull/87772
More information about the cfe-commits
mailing list