diff options
author | John McCall <rjmccall@apple.com> | 2011-02-19 02:53:41 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-19 02:53:41 +0000 |
commit | 15e310a3b970b64a84cb30f0005bc396b4d978cb (patch) | |
tree | a07be31cb50547b6d1a6f71a6397f500a58e300d /test/CodeGenCXX/thunks.cpp | |
parent | 370e6e984cc32167228b66eaf9610c010da0d794 (diff) |
Warn about code that uses variables and functions with internal linkage
without defining them. This should be an error, but I'm paranoid about
"uses" that end up not actually requiring a definition. I'll revisit later.
Also, teach IR generation to not set internal linkage on variable
declarations, just for safety's sake. Doing so produces an invalid module
if the variable is not ultimately defined.
Also, fix several places in the test suite where we were using internal
functions without definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126016 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/thunks.cpp')
-rw-r--r-- | test/CodeGenCXX/thunks.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/test/CodeGenCXX/thunks.cpp b/test/CodeGenCXX/thunks.cpp index 238032cc6d..a74cc053db 100644 --- a/test/CodeGenCXX/thunks.cpp +++ b/test/CodeGenCXX/thunks.cpp @@ -88,31 +88,29 @@ void C::f() { } } // Check that the thunk gets internal linkage. -namespace { - -struct A { - virtual void f(); -}; - -struct B { - virtual void f(); -}; - -struct C : A, B { - virtual void c(); - - virtual void f(); -}; +namespace Test4B { + struct A { + virtual void f(); + }; -void C::f() { } + struct B { + virtual void f(); + }; -} + namespace { + struct C : A, B { + virtual void c(); + virtual void f(); + }; + } + void C::c() {} + void C::f() {} -// Force C::f to be used. -void f() { - C c; - - c.f(); + // Force C::f to be used. + void f() { + C c; + c.f(); + } } namespace Test5 { @@ -283,4 +281,4 @@ namespace Test11 { // This is from Test5: // CHECK: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv -// CHECK: define internal void @_ZThn8_N12_GLOBAL__N_11C1fEv( +// CHECK: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv( |