[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / ClangScanDeps / modules-inferred.m
blob4d18a20949205f2bed5ad66cbd95367367c3d2c2
1 // This test checks that inferred frameworks/modules are accounted for in the
2 // scanner and can be explicitly built by Clang.
4 // RUN: rm -rf %t
5 // RUN: split-file %s %t
7 //--- frameworks/Inferred.framework/Headers/Inferred.h
8 typedef int inferred;
10 //--- frameworks/Inferred.framework/Frameworks/Sub.framework/Headers/Sub.h
12 //--- frameworks/module.modulemap
13 framework module * {}
15 //--- tu.m
16 #include <Inferred/Inferred.h>
18 inferred a = 0;
20 //--- cdb.json.template
22   "directory": "DIR",
23   "file": "DIR/tu.m",
24   "command": "clang -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -F DIR/frameworks -c DIR/tu.m -o DIR/tu.o"
27 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
28 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/result.json
29 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
31 // CHECK:      {
32 // CHECK-NEXT:   "modules": [
33 // CHECK-NEXT:     {
34 // CHECK-NEXT:       "clang-module-deps": [],
35 // CHECK-NEXT:       "clang-modulemap-file": "[[PREFIX]]/frameworks/module.modulemap",
36 // CHECK-NEXT:       "command-line": [
37 // CHECK:            ],
38 // CHECK-NEXT:       "context-hash": "{{.*}}",
39 // CHECK-NEXT:       "file-deps": [
40 // CHECK-NEXT:         "[[PREFIX]]/frameworks/Inferred.framework/Frameworks/Sub.framework/Headers/Sub.h",
41 // CHECK-NEXT:         "[[PREFIX]]/frameworks/Inferred.framework/Headers/Inferred.h",
42 // CHECK-NEXT:         "[[PREFIX]]/frameworks/module.modulemap"
43 // CHECK-NEXT:       ],
44 // CHECK-NEXT:       "name": "Inferred"
45 // CHECK-NEXT:     }
46 // CHECK-NEXT:   ],
47 // CHECK-NEXT:   "translation-units": [
48 // CHECK-NEXT:     {
49 // CHECK-NEXT:       "commands": [
50 // CHECK-NEXT:         {
51 // CHECK-NEXT:           "clang-context-hash": "{{.*}}",
52 // CHECK-NEXT:           "clang-module-deps": [
53 // CHECK-NEXT:             {
54 // CHECK-NEXT:               "context-hash": "{{.*}}",
55 // CHECK-NEXT:               "module-name": "Inferred"
56 // CHECK-NEXT:             }
57 // CHECK-NEXT:           ],
58 // CHECK-NEXT:           "command-line": [
59 // CHECK:                ],
60 // CHECK:                "file-deps": [
61 // CHECK-NEXT:             "[[PREFIX]]/tu.m"
62 // CHECK-NEXT:           ],
63 // CHECK-NEXT:           "input-file": "[[PREFIX]]/tu.m"
64 // CHECK-NEXT:         }
65 // CHECK:            ]
66 // CHECK:          }
67 // CHECK:        ]
68 // CHECK:      }
70 // RUN: %deps-to-rsp %t/result.json --module-name=Inferred > %t/Inferred.cc1.rsp
71 // RUN: %deps-to-rsp %t/result.json --tu-index=0 > %t/tu.rsp
72 // RUN: %clang @%t/Inferred.cc1.rsp -pedantic -Werror
73 // RUN: %clang @%t/tu.rsp -pedantic -Werror