[flang] Fix crash in HLFIR generation (#118399)
[llvm-project.git] / clang / test / ClangScanDeps / pr61006.cppm
blobf75edd38c81ba99c6206f57ee0b2714dd8edc01d
1 // The slash direction in linux and windows are different.
2 // Also the command to create symbolic link is different.
3 // UNSUPPORTED: system-windows
4 //
5 // RUN: rm -fr %t
6 // RUN: mkdir -p %t
7 // RUN: split-file %s %t
8 //
9 // RUN: EXPECTED_RESOURCE_DIR=`%clang -print-resource-dir` && \
10 // RUN: ln -s %clang++ %t/clang++ && \
11 // RUN: sed "s|EXPECTED_RESOURCE_DIR|$EXPECTED_RESOURCE_DIR|g; s|DIR|%/t|g" %t/P1689.json.in > %t/P1689.json && \
12 // RUN: clang-scan-deps -compilation-database %t/P1689.json -format=p1689 | FileCheck %t/a.cpp -DPREFIX=%/t && \
13 // RUN: clang-scan-deps -format=p1689 \
14 // RUN:   -- %t/clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/a.cpp -o %t/a.o \
15 // RUN:      -resource-dir $EXPECTED_RESOURCE_DIR | FileCheck %t/a.cpp -DPREFIX=%/t
17 //--- P1689.json.in
20   "directory": "DIR",
21   "command": "DIR/clang++ -std=c++20 -c -fprebuilt-module-path=DIR DIR/a.cpp -o DIR/a.o -resource-dir EXPECTED_RESOURCE_DIR",
22   "file": "DIR/a.cpp",
23   "output": "DIR/a.o"
27 //--- a.cpp
28 #include "a.h"
29 import b;
31 // CHECK: {
32 // CHECK-NEXT:   "revision": 0,
33 // CHECK-NEXT:   "rules": [
34 // CHECK-NEXT:     {
35 // CHECK-NEXT:       "primary-output": "[[PREFIX]]/a.o",
36 // CHECK-NEXT:       "requires": [
37 // CHECK-NEXT:         {
38 // CHECK-NEXT:           "logical-name": "b"
39 // CHECK-NEXT:         }
40 // CHECK-NEXT:       ]
41 // CHECK-NEXT:     }
42 // CHECK-NEXT:   ],
43 // CHECK-NEXT:   "version": 1
44 // CHECK-NEXT: }
46 //--- a.h