Files
clang-p2996/clang/test/CodeGenCXX/modules-ts.cppm
David Blaikie 4d92301075 Fix modules codegen to be compatible with modules-ts
The Module::WithCodegen flag was only being set when the module was
parsed from a ModuleMap. Instead set it late, in the ASTWriter to match
the layer where the MODULAR_CODEGEN_DECLs list is determined (the
WithCodegen flag essentially means "are this module's decls in
MODULAR_CODEGEN_DECLs").

When simultaneous emission of AST file and modular object is implemented
this may need to change - the Module::WithCodegen flag will need to be
set earlier, and ideally the MODULAR_CODEGEN_DECLs gathering will
consult this flag (that's not possible right now since Decls destined
for an AST File don't have a Module - only if they're /read/ from a
Module is that true - I expect that would need to change as well).

llvm-svn: 293692
2017-01-31 21:28:19 +00:00

24 lines
872 B
C++

// RUN: %clang_cc1 -fmodules-ts -std=c++1z -triple=x86_64-linux-gnu -fmodules-codegen -emit-module-interface %s -o %t.pcm
// RUN: %clang_cc1 -fmodules-ts -std=c++1z -triple=x86_64-linux-gnu %t.pcm -emit-llvm -o - | FileCheck %s
module FooBar;
export {
// CHECK-LABEL: define i32 @_Z1fv(
int f() { return 0; }
}
// CHECK-LABEL: define weak_odr void @_Z2f2v(
inline void f2() { }
// FIXME: Emit global variables and their initializers with this TU.
// Emit an initialization function that other TUs can call, with guard variable.
// FIXME: Mangle non-exported symbols so they don't collide with
// non-exported symbols from other modules?
// FIXME: Formally-internal-linkage symbols that are used from an exported
// symbol need a mangled name and external linkage.
// FIXME: const-qualified variables don't have implicit internal linkage when owned by a module.