llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: dyung

<details>
<summary>Changes</summary>

We would like to enable the clang CMake option CLANG_RESOURCE_DIR on our build 
bots, but found that a few tests that need updating since they make assumptions 
about compiler paths that are modified when using CLANG_RESOURCE_DIR. This is 
change 1 of 4 to update these tests individually.

Test: clang/test/Driver/driverkit-path.c

The issue is with the regex on line 36, it assumes the path to the include 
directories does not change, which when using CLANG_RESOURCE_DIR, it can.

For example, the RUN line on line 27 is `%clang %s -target 
x86_64-apple-driverkit19.0 -isysroot %S/Inputs/DriverKit19.0.sdk -x c++ -###`, 
which when not using CLANG_RESOURCE_DIR, it generates the following output 
(edited for brevity and clarity):
```
"-isysroot" 
"/Users/dyung/src/git/llvm-project/clang/test/Driver/Inputs/DriverKit19.0.sdk"
"-internal-isystem" 
"/Users/dyung/src/git/llvm-project/clang/test/Driver/Inputs/DriverKit19.0.sdk/System/DriverKit/usr/local/include"
"-internal-isystem" 
"/Users/dyung/src/git/llvm-project/21776-baseline/lib/clang/23/include"
"-internal-externc-isystem" 
"/Users/dyung/src/git/llvm-project/clang/test/Driver/Inputs/DriverKit19.0.sdk/System/DriverKit/usr/include"
```
Note in the second instance of `-internal-isystem`, the path to the include 
directory includes `lib/clang/23`.

Now consider the case we would like to use where the compiler is built with 
`-DCLANG_RESOURCE_DIR=../lib/clang`. The output of the previous command is now 
the following output (edited for brevity and clarity):
```
"-isysroot" 
"/Users/dyung/src/git/llvm-project/clang/test/Driver/Inputs/DriverKit19.0.sdk"
"-internal-isystem" 
"/Users/dyung/src/git/llvm-project/clang/test/Driver/Inputs/DriverKit19.0.sdk/System/DriverKit/usr/local/include"
"-internal-isystem" 
"/Users/dyung/src/git/llvm-project/21776-relative/bin/../lib/clang/include"
"-internal-externc-isystem" 
"/Users/dyung/src/git/llvm-project/clang/test/Driver/Inputs/DriverKit19.0.sdk/System/DriverKit/usr/include"
```
Note here in the second instance of `-internal-isystem`, the path to the 
include directory is now `bin/../lib/clang`. In particular, the clang version 
number is no longer present in the path.

My proposed fix here is to update the regex so that it works both with and 
without the clang version number in the path to the include directory. While it 
won't necessarily work for any arbitrary value of CLANG_RESOURCE_DIR that 
someone might try to use, this is the value we would like to use and so we wish 
to update the test so that we can enable it on our build bots.

---
Full diff: https://github.com/llvm/llvm-project/pull/197154.diff


1 Files Affected:

- (modified) clang/test/Driver/driverkit-path.c (+1-1) 


``````````diff
diff --git a/clang/test/Driver/driverkit-path.c 
b/clang/test/Driver/driverkit-path.c
index bc96201753165..aa7d7244fab33 100644
--- a/clang/test/Driver/driverkit-path.c
+++ b/clang/test/Driver/driverkit-path.c
@@ -33,7 +33,7 @@ int main() { return 0; }
 //
 // INC: "-isysroot" "[[SDKROOT]]"
 // INC: "-internal-isystem" "[[SDKROOT]]/System/DriverKit/usr/local/include"
-// INC: "-internal-isystem" "{{.+}}/lib{{(64)?}}/clang/{{[^/ ]+}}/include"
+// INC: "-internal-isystem" "{{.+}}/lib{{(64)?}}/clang{{/?[^"]*}}/include"
 // INC: "-internal-externc-isystem" "[[SDKROOT]]/System/DriverKit/usr/include"
 // INC: "-internal-iframework" 
"[[SDKROOT]]/System/DriverKit/System/Library/Frameworks"
 // INC: "-internal-iframework" 
"[[SDKROOT]]/System/DriverKit/System/Library/SubFrameworks"

``````````

</details>


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

Reply via email to