summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/extern_c.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-03-08 00:03:56 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-03-08 00:03:56 +0000
commit9bca298f6d9dadb1f304ad63becfe28a0eda1b0b (patch)
treef7090390710aff9cf1cca5469935e4d82cd69add /clang/test/Modules/extern_c.cpp
parent7f928f14f4235e0cb593857aca4fcedea157c4de (diff)
downloadbcm5719-llvm-9bca298f6d9dadb1f304ad63becfe28a0eda1b0b.tar.gz
bcm5719-llvm-9bca298f6d9dadb1f304ad63becfe28a0eda1b0b.zip
Module [extern_c] attribute: inherit to submodules, don't write 'extern "C"'
blocks when building in C mode, and serialize and deserialize the attribute. llvm-svn: 203317
Diffstat (limited to 'clang/test/Modules/extern_c.cpp')
-rw-r--r--clang/test/Modules/extern_c.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/clang/test/Modules/extern_c.cpp b/clang/test/Modules/extern_c.cpp
index 7ef47098129..ba466f2a53a 100644
--- a/clang/test/Modules/extern_c.cpp
+++ b/clang/test/Modules/extern_c.cpp
@@ -9,6 +9,12 @@
// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_CXX
// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_C -DEXTERN_CXX
// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs %s -DCXX_HEADER -DEXTERN_C -DNAMESPACE
+// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs -x c %s
+// RUN: %clang_cc1 -fmodules -verify -fmodules-cache-path=%t -I %S/Inputs/elsewhere -I %S/Inputs %s -DEXTERN_C -DINDIRECT
+
+#ifdef INDIRECT
+#include "c-header-indirect.h"
+#endif
#ifdef NAMESPACE
namespace M {
@@ -34,7 +40,7 @@ extern "C++" {
// expected-error@-3 {{import of C++ module 'cxx_library' appears within extern "C" language linkage specification}}
// expected-note@-17 {{extern "C" language linkage specification begins here}}
#elif defined(NAMESPACE)
-// expected-error-re@-6 {{import of module '{{c_library|cxx_library}}' appears within namespace 'M'}}
+// expected-error-re@-6 {{import of module '{{c_library.inner|cxx_library}}' appears within namespace 'M'}}
// expected-note@-24 {{namespace 'M' begins here}}
#endif
@@ -51,16 +57,25 @@ extern "C++" {
using namespace M;
#endif
+#ifdef __cplusplus
namespace N {
- int k = f();
+#endif
+ void g() {
+ int k = f();
+ }
+#ifdef __cplusplus
extern "C" {
+#endif
int f;
#if !defined(CXX_HEADER)
// expected-error@-2 {{redefinition of 'f' as different kind of symbol}}
// expected-note@c-header.h:1 {{previous}}
#endif
+
+#ifdef __cplusplus
}
}
+#endif
-suppress_expected_no_diagnostics_error; // expected-error {{}}
+suppress_expected_no_diagnostics_error error_here; // expected-error {{}}
OpenPOWER on IntegriCloud