[PATCH] D64628: [CrossTU] Test change only: improve ctu-main.c

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 03:55:23 PDT 2019


balazske created this revision.
Herald added subscribers: cfe-commits, gamesh411, Szelethus, dkrupp.
Herald added a project: clang.

New lines are added to test ctu-main.c to make code execute when a
function with invalid source range is encountered on bug path
with NoStoreFuncVisitor.


Repository:
  rC Clang

https://reviews.llvm.org/D64628

Files:
  test/Analysis/ctu-main.c


Index: test/Analysis/ctu-main.c
===================================================================
--- test/Analysis/ctu-main.c
+++ test/Analysis/ctu-main.c
@@ -45,11 +45,18 @@
   g(0); // expected-warning at Inputs/ctu-other.c:29 {{Access to field 'a' results in a dereference of a null pointer (loaded from variable 'ctx')}}
 }
 
+void h(int);
+
 // The external function prototype is incomplete.
 // warning:implicit functions are prohibited by c99
 void testImplicit() {
-  int res = identImplicit(6);   // external implicit functions are not inlined
+  int res = identImplicit(6);
   clang_analyzer_eval(res == 6); // expected-warning{{TRUE}}
+
+  // Call something with uninitialized from the same function in which the implicit was called.
+  // This is necessary to reproduce a special bug in NoStoreFuncVisitor.
+  int uninitialized;
+  h(uninitialized); // expected-warning at ctu-main.c:59 {{1st function call argument is an uninitialized value}}
 }
 
 // Tests the import of functions that have a struct parameter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64628.209455.patch
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190712/86b0845e/attachment.bin>


More information about the cfe-commits mailing list