diff options
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4f040e2..f4b47ec 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -217,13 +217,13 @@ void CodeGenModule::checkAliases() { StringRef MangledName = getMangledName(GD); llvm::GlobalValue *Entry = GetGlobalValue(MangledName); llvm::GlobalAlias *Alias = cast<llvm::GlobalAlias>(Entry); - llvm::GlobalValue *GV = Alias->getAliasedGlobal(); - if (GV->isDeclaration()) { - Error = true; - getDiags().Report(AA->getLocation(), diag::err_alias_to_undefined); - } else if (!Alias->resolveAliasedGlobal(/*stopOnWeak*/ false)) { + llvm::GlobalValue *GV = Alias->resolveAliasedGlobal(/*stopOnWeak*/ false); + if (!GV) { Error = true; getDiags().Report(AA->getLocation(), diag::err_cyclic_alias); + } else if (GV->isDeclaration()) { + Error = true; + getDiags().Report(AA->getLocation(), diag::err_alias_to_undefined); } } if (!Error) |