[clang] [clang][dataflow] Copy only the fields present in the current derived… (PR #162100)

Samira Bakon via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 6 10:32:23 PDT 2025


================
@@ -64,7 +64,8 @@ TEST(RecordOpsTest, CopyRecord) {
   runDataflow(
       Code,
       [](QualType Ty) -> llvm::StringMap<QualType> {
-        if (Ty.getAsString() != "S")
+        std::string TypeAsString = Ty.getAsString();
----------------
bazuzi wrote:

The new calls in `copyRecord` to `getSyntheticFields` were passing in the type such that it was stringified with the "struct", which caused these existing callbacks to return empty maps.

I don't think the API exposing the extension point for synthetic fields sets any sort of limits or expectations for whether the type passed to the callback is canonicalized, so I was hesitant to change the implementation to meet the expectations of a few brittle tests.

https://github.com/llvm/llvm-project/pull/162100


More information about the cfe-commits mailing list