Index: test/ubsan/TestCases/TypeCheck/Helpers/lit.local.cfg =================================================================== --- test/ubsan/TestCases/TypeCheck/Helpers/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Sources in this directory are helper files for tests which test functionality -# involving multiple translation units. -config.suffixes = [] Index: test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.h =================================================================== --- test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.h +++ /dev/null @@ -1,4 +0,0 @@ -struct X { - virtual ~X() {} -}; -X *libCall(); Index: test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.cpp =================================================================== --- test/ubsan/TestCases/TypeCheck/Helpers/vptr-non-unique-typeinfo-lib.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "vptr-non-unique-typeinfo-lib.h" - -X *libCall() { - return new X; -} Index: test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp =================================================================== --- test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp +++ test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp @@ -1,10 +1,23 @@ -// 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 -#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