
Many of our supported configurations support modules but do not have any first-class syntax to perform a module import. This leaves us with a problem: there is no way to represent the expansion of a #include that imports a module in the -E output for such languages. (We don't want to just leave it as a #include because that requires the consumer of the preprocessed source to have the same file system layout and include paths as the creator.) This patch adds a new pragma: #pragma clang module import MODULE.NAME.HERE that imports a module, and changes -E and -frewrite-includes to use it when rewriting a #include that maps to a module import. We don't make any attempt to use a native language syntax import if one exists, to get more consistent output. (If in the future, @import and #include have different semantics in some way, the pragma will track the #include semantics.) llvm-svn: 301725
13 lines
668 B
C++
13 lines
668 B
C++
// RUN: rm -rf %t
|
|
|
|
// RUN: not %clang_cc1 -fmodules -fmodule-name=file -I%S/Inputs/preprocess -x c++-module-map %S/Inputs/preprocess/module.modulemap -E 2>&1 | FileCheck %s --check-prefix=MISSING-FWD
|
|
// MISSING-FWD: module 'fwd' is needed
|
|
|
|
// RUN: %clang_cc1 -fmodules -fmodule-name=file -fmodules-cache-path=%t -I%S/Inputs/preprocess -x c++-module-map %S/Inputs/preprocess/module.modulemap -E | FileCheck %s
|
|
// CHECK: # 1 "<module-includes>"
|
|
// CHECK: # 1 "{{.*}}file.h" 1
|
|
// CHECK: struct __FILE;
|
|
// CHECK: #pragma clang module import fwd /* clang -E: implicit import for #include "fwd.h" */
|
|
// CHECK: typedef struct __FILE FILE;
|
|
// CHECK: # 2 "<module-includes>" 2
|