mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Delete duplicated verifier test.
Also add unittest to show we still detect the errors. llvm-svn: 269182
This commit is contained in:
parent
90276bb9c2
commit
e5c310130c
@ -557,9 +557,6 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
|
|||||||
&GV);
|
&GV);
|
||||||
Assert(!GV.hasComdat(), "'common' global may not be in a Comdat!", &GV);
|
Assert(!GV.hasComdat(), "'common' global may not be in a Comdat!", &GV);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Assert(GV.hasExternalLinkage() || GV.hasExternalWeakLinkage(),
|
|
||||||
"invalid linkage type for global declaration", &GV);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GV.hasName() && (GV.getName() == "llvm.global_ctors" ||
|
if (GV.hasName() && (GV.getName() == "llvm.global_ctors" ||
|
||||||
@ -1963,8 +1960,6 @@ void Verifier::visitFunction(const Function &F) {
|
|||||||
Assert(MDs.empty(), "unmaterialized function cannot have metadata", &F,
|
Assert(MDs.empty(), "unmaterialized function cannot have metadata", &F,
|
||||||
MDs.empty() ? nullptr : MDs.front().second);
|
MDs.empty() ? nullptr : MDs.front().second);
|
||||||
} else if (F.isDeclaration()) {
|
} else if (F.isDeclaration()) {
|
||||||
Assert(F.hasExternalLinkage() || F.hasExternalWeakLinkage(),
|
|
||||||
"invalid linkage type for function declaration", &F);
|
|
||||||
Assert(MDs.empty(), "function without a body cannot have metadata", &F,
|
Assert(MDs.empty(), "function without a body cannot have metadata", &F,
|
||||||
MDs.empty() ? nullptr : MDs.front().second);
|
MDs.empty() ? nullptr : MDs.front().second);
|
||||||
Assert(!F.hasPersonalityFn(),
|
Assert(!F.hasPersonalityFn(),
|
||||||
|
@ -145,6 +145,33 @@ TEST(VerifierTest, CrossModuleMetadataRef) {
|
|||||||
.startswith("Referencing global in another module!"));
|
.startswith("Referencing global in another module!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(VerifierTest, InvalidVariableLinkage) {
|
||||||
|
LLVMContext C;
|
||||||
|
Module M("M", C);
|
||||||
|
new GlobalVariable(M, Type::getInt8Ty(C), false,
|
||||||
|
GlobalValue::LinkOnceODRLinkage, nullptr, "Some Global");
|
||||||
|
std::string Error;
|
||||||
|
raw_string_ostream ErrorOS(Error);
|
||||||
|
EXPECT_TRUE(verifyModule(M, &ErrorOS));
|
||||||
|
EXPECT_TRUE(
|
||||||
|
StringRef(ErrorOS.str()).startswith("Global is external, but doesn't "
|
||||||
|
"have external or weak linkage!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(VerifierTest, InvalidFunctionLinkage) {
|
||||||
|
LLVMContext C;
|
||||||
|
Module M("M", C);
|
||||||
|
|
||||||
|
FunctionType *FTy = FunctionType::get(Type::getVoidTy(C), /*isVarArg=*/false);
|
||||||
|
Function::Create(FTy, GlobalValue::LinkOnceODRLinkage, "foo", &M);
|
||||||
|
std::string Error;
|
||||||
|
raw_string_ostream ErrorOS(Error);
|
||||||
|
EXPECT_TRUE(verifyModule(M, &ErrorOS));
|
||||||
|
EXPECT_TRUE(
|
||||||
|
StringRef(ErrorOS.str()).startswith("Global is external, but doesn't "
|
||||||
|
"have external or weak linkage!"));
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
// FIXME: This test causes an ICE in MSVC 2013.
|
// FIXME: This test causes an ICE in MSVC 2013.
|
||||||
TEST(VerifierTest, StripInvalidDebugInfo) {
|
TEST(VerifierTest, StripInvalidDebugInfo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user