diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-08 08:47:38 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-08 08:47:38 +0000 |
commit | 39a9792d54f26189967fa12036cf5860d8c62884 (patch) | |
tree | 7fa21cac8bc66bcc01c6c83b5c3fb3950ee4f016 /tools | |
parent | e7c326b3f886d3cb97e93344a5ad076536046a29 (diff) | |
download | llvm-39a9792d54f26189967fa12036cf5860d8c62884.tar.gz llvm-39a9792d54f26189967fa12036cf5860d8c62884.tar.bz2 llvm-39a9792d54f26189967fa12036cf5860d8c62884.tar.xz |
For PR1187:
Always rename, never give a redef error. We could check for collapsed type
planes and generate an error if that's not the cause, but the 99.9999
percentile case will be that its the result of collapsed type planes. So,
rather than doing an expensive check, just rename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-upgrade/UpgradeParser.y | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y index e73141c9fa..8a213707ab 100644 --- a/tools/llvm-upgrade/UpgradeParser.y +++ b/tools/llvm-upgrade/UpgradeParser.y @@ -2626,10 +2626,24 @@ FunctionHeaderH if (Conflict && PFT == Conflict->getType()) { if (!CurFun.isDeclare && !Conflict->isDeclaration()) { // We have two function definitions that conflict, same type, same - // name. This wasn't allowed in 1.9, its not allowed here either - error("Redefinition of function '" + FunctionName + "' of type '" + - PFT->getDescription() + "'"); - + // name. We should really check to make sure that this is the result + // of integer type planes collapsing and generate an error if it is + // not, but we'll just rename on the assumption that it is. However, + // let's do it intelligently and rename the internal linkage one + // if there is one. + std::string NewName(makeNameUnique(FunctionName)); + if (Conflict->hasInternalLinkage()) { + Conflict->setName(NewName); + RenameMapKey Key = std::make_pair(FunctionName,Conflict->getType()); + CurModule.RenameMap[Key] = NewName; + Fn = new Function(FT, CurFun.Linkage, FunctionName, M); + InsertValue(Fn, CurModule.Values); + } else { + Fn = new Function(FT, CurFun.Linkage, NewName, M); + InsertValue(Fn, CurModule.Values); + RenameMapKey Key = std::make_pair(FunctionName,PFT); + CurModule.RenameMap[Key] = NewName; + } } else { // If they are not both definitions, then just use the function we // found since the types are the same. |