Index: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/lit.local.cfg =================================================================== --- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/lit.local.cfg +++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/lit.local.cfg @@ -1,3 +0,0 @@ -# Sources in this directory are helper files for tests which test functionality -# involving multiple translation units. -config.suffixes = [] Index: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.h =================================================================== --- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.h +++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.h @@ -1,4 +0,0 @@ -struct X { - virtual ~X() {} -}; -X *libCall(); Index: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.cpp =================================================================== --- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.cpp +++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.cpp @@ -1,5 +0,0 @@ -#include "vptr-non-unique-typeinfo-lib.h" - -X *libCall() { - return new X; -} Index: compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp =================================================================== --- compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp +++ compiler-rt/trunk/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp @@ -1,12 +1,25 @@ -// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers %p/Helpers/vptr-non-unique-typeinfo-lib.cpp -fPIC -shared -o %t-lib.so +// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -fPIC -shared -o %t-lib.so -DBUILD_SO // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -O3 -o %t %t-lib.so // RUN: %run %t // // REQUIRES: cxxabi -#include "vptr-non-unique-typeinfo-lib.h" +struct X { + virtual ~X() {} +}; +X *libCall(); + +#ifdef BUILD_SO + +X *libCall() { + return new X; +} + +#else int main() { X *px = libCall(); delete px; } + +#endif