llvm-project/clang/test/ExtractAPI/submodule-macro.m
Daniel Grumberg b1b24d7517
[clang][ExtractAPI] Fix quirks in interaction with submodules (#105868)
Extension SGFs require the module system to be enabled in order to discover which module defines the extended external type.
This patch ensures the following:
- Associate symbols with their top level module name, and that only top level modules are considered as modules for emitting extension SGFs.
- Ensure we don't drop macro definitions that came from a submodule. To this end look at all defined macros in `PPCalbacks::EndOfMainFile` instead of relying on `PPCallbacks::MacroDefined` being called to detect a macro definition.
2024-08-27 13:50:41 +01:00

26 lines
760 B
Objective-C

// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing \
// RUN: --emit-extension-symbol-graphs --symbol-graph-dir=%t/symbols -isystem %t \
// RUN: --product-name=Umbrella -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules-cache \
// RUN: -triple arm64-apple-macosx -x objective-c-header %t/Umbrella.h %t/Subheader.h
//--- Umbrella.h
#include "Subheader.h"
#import <stdbool.h>
//--- Subheader.h
#define FOO 1
//--- module.modulemap
module Umbrella {
umbrella header "Umbrella.h"
export *
module * { export * }
}
// RUN: FileCheck %s --input-file %t/symbols/Umbrella.symbols.json --check-prefix MOD
// MOD-NOT: bool
// MOD: "!testLabel": "c:@macro@FOO"