summaryrefslogtreecommitdiff
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-06-17 07:06:44 +0000
committerChris Lattner <sabre@nondot.org>2011-06-17 07:06:44 +0000
commitd589099eec8d120b5a7227072c4e717856e2276f (patch)
tree4d87ce41a738f60f8c6df1df4895d22c6293510c /lib/AsmParser
parent424545e9509318e56be88021babec26cbfab8cc8 (diff)
downloadllvm-d589099eec8d120b5a7227072c4e717856e2276f.tar.gz
llvm-d589099eec8d120b5a7227072c4e717856e2276f.tar.bz2
llvm-d589099eec8d120b5a7227072c4e717856e2276f.tar.xz
make the asmparser reject function and type redefinitions. 'Merging' hasn't been
needed since llvm-gcc 3.4 days. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/LLParser.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index ab3b86e018..01b3877adb 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -352,18 +352,14 @@ bool LLParser::ParseNamedType() {
cast<DerivedType>(FI->second.first.get())->refineAbstractTypeTo(Ty);
Ty = FI->second.first.get();
ForwardRefTypes.erase(FI);
+ return false;
}
// Inserting a name that is already defined, get the existing name.
const Type *Existing = M->getTypeByName(Name);
assert(Existing && "Conflict but no matching type?!");
- // Otherwise, this is an attempt to redefine a type. That's okay if
- // the redefinition is identical to the original.
- // FIXME: REMOVE REDEFINITIONS IN LLVM 3.0
- if (Existing == Ty) return false;
-
- // Any other kind of (non-equivalent) redefinition is an error.
+ // Otherwise, this is an attempt to redefine a type, report the error.
return Error(NameLoc, "redefinition of type named '" + Name + "' of type '" +
Ty->getDescription() + "'");
}
@@ -2761,21 +2757,9 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
ForwardRefVals.erase(FRVI);
} else if ((Fn = M->getFunction(FunctionName))) {
- // If this function already exists in the symbol table, then it is
- // multiply defined. We accept a few cases for old backwards compat.
- // FIXME: Remove this stuff for LLVM 3.0.
- if (Fn->getType() != PFT || Fn->getAttributes() != PAL ||
- (!Fn->isDeclaration() && isDefine)) {
- // If the redefinition has different type or different attributes,
- // reject it. If both have bodies, reject it.
- return Error(NameLoc, "invalid redefinition of function '" +
- FunctionName + "'");
- } else if (Fn->isDeclaration()) {
- // Make sure to strip off any argument names so we can't get conflicts.
- for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
- AI != AE; ++AI)
- AI->setName("");
- }
+ // Reject redefinitions.
+ return Error(NameLoc, "invalid redefinition of function '" +
+ FunctionName + "'");
} else if (M->getNamedValue(FunctionName)) {
return Error(NameLoc, "redefinition of function '@" + FunctionName + "'");
}