From 01692f0fd276b6e935da06174aed22770d5db477 Mon Sep 17 00:00:00 2001 From: David Blaikie <dblaikie@gmail.com> Date: Wed, 12 Apr 2017 21:14:04 +0000 Subject: [PATCH] Modular Codegen: Include testing for inline asm as well as some commentary on the implementaiton choice. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300106 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Modules/Inputs/codegen/foo.h | 2 ++ test/Modules/codegen.test | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/test/Modules/Inputs/codegen/foo.h b/test/Modules/Inputs/codegen/foo.h index e77e8d1824e..bd3b6489e71 100644 --- a/test/Modules/Inputs/codegen/foo.h +++ b/test/Modules/Inputs/codegen/foo.h @@ -28,3 +28,5 @@ inline void inst_decl() { (void)sizeof(&inst<int>); inst<float>(); } + +asm("narf"); diff --git a/test/Modules/codegen.test b/test/Modules/codegen.test index e8faa12fd94..1bdea5df431 100644 --- a/test/Modules/codegen.test +++ b/test/Modules/codegen.test @@ -6,6 +6,20 @@ RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-codegen -fmodules-debuginfo - RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - %t/foo.pcm | FileCheck --check-prefix=FOO --check-prefix=BOTH %s RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -fmodules -fmodule-file=%t/foo.pcm %S/Inputs/codegen/use.cpp | FileCheck --check-prefix=BOTH --check-prefix=USE %s +For want of any better definition, inline asm goes "everywhere" the same as it +if it were in a header (with the disadvantage that the inline asm will be +included in the program if the module is used, even if the header containing +the inline asm is never included - unlike a non-modular build). + +This is inconsistent with how namespace scope static variables are handled - +where they only appear in the code that includes a header. This functionality +was implemented to workaround/support the initialization of iostreams +(implemented as a namespace scope static in the header - only to be provided +when that specific header is included in the program). + +FOO: module asm "narf" +USE: module asm "narf" + FOO: $_Z2f1PKcz = comdat any FOO: $_ZN13implicit_dtorD1Ev = comdat any USE: $_Z4instIiEvv = comdat any -- GitLab