================
@@ -0,0 +1,167 @@
+// RUN: rm -rf %t && mkdir %t
+// RUN: mkdir -p %t/ctudir
+// RUN: cp "%S/Inputs/plist-macros-ctu.c" "%t/ctudir/plist-macros-ctu.c"
+// RUN: cp "%S/Inputs/plist-macros-ctu.h" "%t/ctudir/plist-macros-ctu.h"
+// RUN: echo '"%t/ctudir/plist-macros-ctu.c": ["clang",
"%t/ctudir/plist-macros-ctu.c"]' | sed -e 's/\\/\\\\/g' >
%t/ctudir/invocations.yaml
+// RUN: cp
%S/Inputs/plist-macros-with-expansion-ctu-ondemand.c.externalDefMap.txt
%t/ctudir/externalDefMap.txt
+//
+// RUN: %clang_analyze_cc1 -analyzer-checker=core \
+// RUN: -analyzer-config experimental-enable-naive-ctu-analysis=true \
+// RUN: -analyzer-config ctu-dir=%t/ctudir \
+// RUN: -analyzer-config expand-macros=true \
+// RUN: -analyzer-config ctu-invocation-list=%t/ctudir/invocations.yaml \
+// RUN: -analyzer-output=plist-multi-file -o %t.plist -verify %s
+//
+// Check the macro expansions from the plist output here, to make the test more
+// understandable.
+// RUN: FileCheck --input-file=%t.plist %s
+
+extern void F1(int **);
+extern void F2(int **);
+extern void F3(int **);
+extern void F_H(int **);
+
+void test0(void) {
+ int *X;
+ F3(&X);
+ *X = 1; // expected-warning{{Dereference of null pointer}}
+}
+
+// CHECK: <key>macro_expansions</key>
+// CHECK-NEXT: <array>
+// CHECK-NEXT: <dict>
+// CHECK-NEXT: <key>location</key>
+// CHECK-NEXT: <dict>
+// CHECK-NEXT: <key>line</key><integer>20</integer>
+// CHECK-NEXT: <key>col</key><integer>3</integer>
+// CHECK-NEXT: <key>file</key><integer>1</integer>
+// CHECK-NEXT: </dict>
+// CHECK-NEXT: <key>name</key><string>M1</string>
+// CHECK-NEXT: <key>expansion</key><string>*Z = (int *)0</string>
+// CHECK-NEXT: </dict>
+// CHECK-NEXT: </array>
----------------
steakhal wrote:
I guess the whole point is that this comes from the remote translation unit,
right?
It's just annoying a bit that the source code of that TU is not spelled out in
this file (bcs. it's in a different file, I got it). I guess, we need to live
with this.
No actions expected.
https://github.com/llvm/llvm-project/pull/176126
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits