[PATCH] D89481: [scan-build] Fix clang++ pathname again

Stephan Bergmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 28 07:24:35 PDT 2020


sberg updated this revision to Diff 301273.
sberg edited the summary of this revision.
sberg added a comment.

Is there a reason why "NoQ accepted this revision." kept this at "Needs Review" rather than moving it to "This revision is now accepted and ready to land."?

Anyway, I added a test now.  Hope the use of `REQUIRES: shell` is appropriate guarding for using `sh` and `basename` (and as such would subsume the `// FIXME: Actually, "perl". REQUIRES: shell` found in other test files in that directory using `%scan-build`, or should it better also carry that FIXME comment for a perl requirement, as scan-build is written in perl?).  (I didn't find out how `'shell'` gets added to `available_features` for these tests.  I only found it in `clang-tools-extra/test/lit.cfg.py` and `compiler-rt/test/lit.common.cfg.py`, but which should not be relevant here?  Also, I didn't manage to verify this doesn't break anything on Windows; while my Linux build dir (at least after once having done `cmake --build . --target check-all`) has a `tools/clang/test/Analysis/scan-build` dir that I can test with `bin/llvm-lit -v tools/clang/test/Analysis/scan-build`, I don't get that directory at all on Windows.)


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

https://reviews.llvm.org/D89481

Files:
  clang/test/Analysis/scan-build/cxx-name.test
  clang/test/Analysis/scan-build/lit.local.cfg
  clang/tools/scan-build/bin/scan-build


Index: clang/tools/scan-build/bin/scan-build
===================================================================
--- clang/tools/scan-build/bin/scan-build
+++ clang/tools/scan-build/bin/scan-build
@@ -1925,7 +1925,7 @@
     $ClangCXX =~ s/.exe$/++.exe/;
   }
   else {
-    $ClangCXX =~ s/\-\d+\.\d+$//;
+    $ClangCXX =~ s/\-\d+(\.\d+)?$//;
     $ClangCXX .= "++";
   }
 }
Index: clang/test/Analysis/scan-build/lit.local.cfg
===================================================================
--- clang/test/Analysis/scan-build/lit.local.cfg
+++ clang/test/Analysis/scan-build/lit.local.cfg
@@ -15,4 +15,4 @@
                                                     'tools',
                                                     'scan-build',
                                                     'bin')),
-                                 config.clang)))
+                                 os.path.realpath(config.clang))))
Index: clang/test/Analysis/scan-build/cxx-name.test
===================================================================
--- /dev/null
+++ clang/test/Analysis/scan-build/cxx-name.test
@@ -0,0 +1,9 @@
+REQUIRES: shell
+
+RUN: %scan-build sh -c 'echo "CLANG_CXX=/$(basename "$CLANG_CXX")/"' | FileCheck %s
+
+Check that scan-build sets the CLANG_CXX environment variable (meant to be
+consumed by ccc-analyzer) to an appropriate pathname for the clang++ executable,
+derived from the pathname of the clang executable:
+
+CHECK: CLANG_CXX=/clang++{{(\.exe)?}}/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89481.301273.patch
Type: text/x-patch
Size: 1476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201028/e3aa042b/attachment.bin>


More information about the cfe-commits mailing list