================
@@ -1440,4 +1471,48 @@ TEST_F(PointerFlowTest, ReturnRefPtr) {
   EXPECT_EQ(*Sum, makeEdges(__LINE__, {{{"foo", 1U, true}, {"f", 1U, true}}}));
 }
 
+//////////////////////////////////////////////////////////////
+//          System-header contributor opt-out gate.         //
+//          Spec: tu-summary-extraction,                    //
+//          "System-header contributor opt-out flag".       //
+//////////////////////////////////////////////////////////////
+
+// Default: ExtractFromSystemHeaders == true. A function decl in a
+// `#pragma clang system_header`-marked included header IS enumerated
+// as a contributor and produces an EntitySummary.
+TEST_F(PointerFlowTest, SystemHeader_ExtractDefault) {
+  const char *SysHeader = "int *sys_gp; void sys_fn(int *p) { sys_gp = p; }\n";
+  const char *Main = R"cpp(
+    #include <sys.h>
+    int *user_gp;
+    void user_fn(int *p) { user_gp = p; }
+  )cpp";
+  ASSERT_TRUE(setUpTestWithSystemHeader(Main, SysHeader,
+                                        /*ExtractFromSystemHeaders=*/true));
+  // sys_fn is in a system header but the default (extract-true) enumerates
+  // it as a contributor — summary is non-null.
+  EXPECT_NE(getEntitySummary("sys_fn"), nullptr);
+  // user_fn is enumerated either way (positive control).
+  EXPECT_NE(getEntitySummary("user_fn"), nullptr);
----------------
steakhal wrote:

I think given how small this test is, it should be clear what to expect.
```suggestion
  EXPECT_TRUE(getEntitySummary("sys_fn"));
  EXPECT_TRUE(getEntitySummary("user_fn"));
```

https://github.com/llvm/llvm-project/pull/205446
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to