[PATCH] D55131: [CTU] Add more lit tests and better error handling

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 4 06:30:19 PST 2018


martong added inline comments.


================
Comment at: test/Analysis/Inputs/ctu-other.c:6
+  int b;
+} foobar;
+
----------------
a_sidorin wrote:
> Please use a consistent naming style across the file. There are names starting with capital, having underscores and written like this.
Ok, I renamed the things, I was trying to be consistent with the LLVM style, one exception is the name of variables still start with small case.
I also restructured the file a bit and added more comments, so it is more cleaner which things belong together to the same test.


================
Comment at: test/Analysis/ctu-main.c:3-5
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir2/ctu-other.c.ast %S/Inputs/ctu-other.c
+// RUN: cp %S/Inputs/externalFnMap2.txt %t/ctudir2/externalFnMap.txt
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -std=c89 -analyze -analyzer-checker=core,debug.ExprInspection  -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir2 -verify %s
----------------
Szelethus wrote:
> Could you please break these lines?
> ```
> // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu %S/Inputs/ctu-other.c \
> // RUN:    -emit-pch -o %t/ctudir2/ctu-other.c.ast
> //
> // RUN: cp %S/Inputs/externalFnMap2.txt %t/ctudir2/externalFnMap.txt
> //
> // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -std=c89 -analyze -verify %s
> // RUN:   -analyzer-checker=core \
> // RUN:   -analyzer-checker=debug.ExprInspection \
> // RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
> // RUN:   -analyzer-config ctu-dir=%t/ctudir2
> ```
Ok, good point.


================
Comment at: test/Analysis/ctu-main.c:4
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-pch -o %t/ctudir2/ctu-other.c.ast %S/Inputs/ctu-other.c
+// RUN: cp %S/Inputs/externalFnMap2.txt %t/ctudir2/externalFnMap.txt
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -std=c89 -analyze -analyzer-checker=core,debug.ExprInspection  -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%t/ctudir2 -verify %s
----------------
Szelethus wrote:
> This is a question rather than anything else, why do we have both externalFnMap2.txt and externalFnMap.txt?
`externalFnMap.txt` goes for `ctu-other.cpp`.
`externalFnMap2.txt` goes for `ctu-other.c`.
Perhaps we should rename them in the `Inputs` directory to include the indexed file name. E.g. `ctu-other.cpp.externalFnMap.txt`. What do you think?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55131/new/

https://reviews.llvm.org/D55131





More information about the cfe-commits mailing list