File tree Expand file tree Collapse file tree 4 files changed +33
-0
lines changed
Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -2273,6 +2273,7 @@ class SwiftAPIDigesterInvocation {
22732273 std::string ResourceDir;
22742274 std::string ModuleCachePath;
22752275 bool DisableFailOnError;
2276+ std::vector<std::string> ClangImporterArgs;
22762277
22772278public:
22782279 SwiftAPIDigesterInvocation (const std::string &ExecPath)
@@ -2375,6 +2376,7 @@ class SwiftAPIDigesterInvocation {
23752376 ParsedArgs.getAllArgValues (OPT_use_interface_for_module);
23762377 ResourceDir = ParsedArgs.getLastArgValue (OPT_resource_dir).str ();
23772378 ModuleCachePath = ParsedArgs.getLastArgValue (OPT_module_cache_path).str ();
2379+ ClangImporterArgs = ParsedArgs.getAllArgValues (OPT_Xcc);
23782380 DebugMapping = ParsedArgs.hasArg (OPT_debug_mapping);
23792381 DisableFailOnError = ParsedArgs.hasArg (OPT_disable_fail_on_error);
23802382
@@ -2456,6 +2458,11 @@ class SwiftAPIDigesterInvocation {
24562458 InitInvoke.getLangOptions ().Target .isOSDarwin ();
24572459 InitInvoke.getClangImporterOptions ().ModuleCachePath = ModuleCachePath;
24582460
2461+ // Pass -Xcc arguments to the Clang importer
2462+ for (const auto &arg : ClangImporterArgs) {
2463+ InitInvoke.getClangImporterOptions ().ExtraArgs .push_back (arg);
2464+ }
2465+
24592466 if (!SwiftVersion.empty ()) {
24602467 using version::Version;
24612468 bool isValid = false ;
Original file line number Diff line number Diff line change 1+ @import ObjectiveC;
2+
3+ #ifdef MY_MACRO
4+ @interface Hidden : NSObject
5+ @end
6+ #endif
7+
8+ @interface NotHidden : NSObject
9+ @end
Original file line number Diff line number Diff line change 1+ module XccTest {
2+ header "XccTest.h"
3+ export *
4+ }
Original file line number Diff line number Diff line change 1+ // REQUIRES: VENDOR=apple
2+
3+ // RUN: %empty-directory(%t)
4+ // RUN: %empty-directory(%t.module-cache)
5+
6+ // RUN: %api-digester -dump-sdk -module XccTest -o %t.with-define.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %S/Inputs/XccTest -Xcc -DMY_MACRO
7+ // RUN: %api-digester -dump-sdk -module XccTest -o %t.without-define.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %S/Inputs/XccTest
8+
9+ // RUN: grep -q "Hidden" %t.with-define.json
10+ // RUN: grep -q "NotHidden" %t.with-define.json
11+
12+ // RUN: not grep -q "Hidden" %t.without-define.json
13+ // RUN: grep -q "NotHidden" %t.without-define.json
You can’t perform that action at this time.
0 commit comments