mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
reject things like "declare internal @foo"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42140 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
742f9b6682
commit
6693da003b
@ -310,10 +310,15 @@ void Verifier::visitGlobalValue(GlobalValue &GV) {
|
||||
}
|
||||
|
||||
void Verifier::visitGlobalVariable(GlobalVariable &GV) {
|
||||
if (GV.hasInitializer())
|
||||
if (GV.hasInitializer()) {
|
||||
Assert1(GV.getInitializer()->getType() == GV.getType()->getElementType(),
|
||||
"Global variable initializer type does not match global "
|
||||
"variable type!", &GV);
|
||||
} else {
|
||||
Assert1(GV.hasExternalLinkage() || GV.hasDLLImportLinkage() ||
|
||||
GV.hasExternalWeakLinkage(),
|
||||
"invalid linkage type for global declaration", &GV);
|
||||
}
|
||||
|
||||
visitGlobalValue(GV);
|
||||
}
|
||||
@ -467,7 +472,11 @@ void Verifier::visitFunction(Function &F) {
|
||||
"Functions cannot take aggregates as arguments by value!", I);
|
||||
}
|
||||
|
||||
if (!F.isDeclaration()) {
|
||||
if (F.isDeclaration()) {
|
||||
Assert1(F.hasExternalLinkage() || F.hasDLLImportLinkage() ||
|
||||
F.hasExternalWeakLinkage(),
|
||||
"invalid linkage type for function declaration", &F);
|
||||
} else {
|
||||
// Verify that this function (which has a body) is not named "llvm.*". It
|
||||
// is not legal to define intrinsics.
|
||||
if (F.getName().size() >= 5)
|
||||
|
Loading…
Reference in New Issue
Block a user