llvm-project/clang/test/Modules/clang-pragmas.c
Michael Spencer 1c4e0f6a54
[clang] Add #pragma clang __debug module_lookup (#129158)
This can be used to trigger implicit module map lookup without also
importing the module. This can be useful for debugging as it avoids
loading the module map from the AST file, which has slightly different
semantics.
2025-03-03 13:28:10 -08:00

23 lines
565 B
C

// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -I%t %t/tu.c -fsyntax-only \
// RUN: -verify 2>&1 | FileCheck %s
//--- module.modulemap
module A {
header "A.h"
}
//--- A.h
//--- tu.c
#pragma clang __debug module_map A // expected-warning{{unknown module 'A'}}
#pragma clang __debug module_lookup B // expected-warning{{unable to find module 'B'}}
#pragma clang __debug module_lookup A // does header search for A
#pragma clang __debug module_map A // now finds module A
// CHECK: module A
// CHECK: module A