diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-26 22:09:03 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-26 22:09:03 +0000 |
commit | c3b054d250cdca485c71845089c316e10610ebad (patch) | |
tree | abae0246ec9156cc1a7cbb947b2b0dfe95fa3189 /test/SemaCXX/linkage.cpp | |
parent | bca07a4524feb4edec581062d631a13116320a24 (diff) |
Diffstat (limited to 'test/SemaCXX/linkage.cpp')
-rw-r--r-- | test/SemaCXX/linkage.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/SemaCXX/linkage.cpp b/test/SemaCXX/linkage.cpp index ba56318fbd68c..6b73d596e01ba 100644 --- a/test/SemaCXX/linkage.cpp +++ b/test/SemaCXX/linkage.cpp @@ -3,7 +3,7 @@ // compared against the earlier cached value. If we had a way of // testing linkage directly in Sema, that would be better. -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -Werror -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s // PR8926 namespace test0 { @@ -64,5 +64,33 @@ namespace test3 { extern "C" void test3(A a) {} } +namespace { + // CHECK: define void @test4( + extern "C" void test4(void) {} +} + +// PR9316: Ensure that even non-namespace-scope function declarations in +// a C declaration context respect that over the anonymous namespace. +extern "C" { + namespace { + struct X { + int f() { + extern int g(); + extern int a; + + // Test both for mangling in the code generation and warnings from use + // of internal, undefined names via -Werror. + // CHECK: call i32 @g( + // CHECK: load i32* @a, + return g() + a; + } + }; + } + // Force the above function to be emitted by codegen. + int test(X& x) { + return x.f(); + } +} + // CHECK: define linkonce_odr i8* @_ZN5test21A1BILj0EE3fooEv( // CHECK: define linkonce_odr i8* @_ZN5test11A3fooILj0EEEPvv( |