diff options
author | Renato Golin <renato.golin@linaro.org> | 2015-04-15 08:44:40 +0000 |
---|---|---|
committer | Renato Golin <renato.golin@linaro.org> | 2015-04-15 08:44:40 +0000 |
commit | c640ff63e236d48d90a29f548799ea8342a7aa04 (patch) | |
tree | ce154142ed83f16c4f3a2d221dab1afe8614e7f5 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 96acdf60a3d5008a56c48513e4a0dfa0e7fc22d3 (diff) | |
download | bcm5719-llvm-c640ff63e236d48d90a29f548799ea8342a7aa04.tar.gz bcm5719-llvm-c640ff63e236d48d90a29f548799ea8342a7aa04.zip |
Revert "[CodeGen] Fix crash with duplicated mangled name."
This reverts commit r234767, as it was breaking all ARM buildbots for two days and the
assert is not in the code, making it difficult to spot the error, which would keep the
bots red for a few more days. New errors were silently introduced because of this bug,
and we don't want this to escalate.
llvm-svn: 234983
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4dd965f24a7..f60a68ab011 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1372,15 +1372,6 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) { /*DontDefer=*/false); return; } - - if (llvm::GlobalValue *GV = GetGlobalValue(getMangledName(GD))) - if (!GV->isDeclaration()) { - getDiags().Report(FD->getLocation(), diag::err_duplicate_mangled_name); - GlobalDecl OldGD = Manglings.lookup(GV->getName()); - if (auto *Prev = OldGD.getDecl()) - getDiags().Report(Prev->getLocation(), diag::note_previous_definition); - return; - } } else { const auto *VD = cast<VarDecl>(Global); assert(VD->isFileVarDecl() && "Cannot emit local var decl as global."); @@ -2414,6 +2405,14 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD, } } + if (!GV->isDeclaration()) { + getDiags().Report(D->getLocation(), diag::err_duplicate_mangled_name); + GlobalDecl OldGD = Manglings.lookup(GV->getName()); + if (auto *Prev = OldGD.getDecl()) + getDiags().Report(Prev->getLocation(), diag::note_previous_definition); + return; + } + if (GV->getType()->getElementType() != Ty) { // If the types mismatch then we have to rewrite the definition. assert(GV->isDeclaration() && "Shouldn't replace non-declaration"); |