diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-03 02:42:01 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-03 02:42:01 +0000 |
commit | 27c60b512a5f9f602602748eb592d6c6909671c4 (patch) | |
tree | af43624fbaf5c1392a5e60f01b8e7a5d9edce352 /clang/lib/CodeGen/CGCXX.cpp | |
parent | 64c1e1803311610e359e26a5f0ece867f0dabd3e (diff) | |
download | bcm5719-llvm-27c60b512a5f9f602602748eb592d6c6909671c4.tar.gz bcm5719-llvm-27c60b512a5f9f602602748eb592d6c6909671c4.zip |
Update for llvm API change.
Aliases in llvm now hold an arbitrary expression.
llvm-svn: 210063
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCXX.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 24dc89d551f..545c5ef9f82 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -142,9 +142,9 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, // which case the caller is responsible for ensuring the soundness // of these semantics. auto *Ref = cast<llvm::GlobalValue>(GetAddrOfGlobal(TargetDecl)); - auto *Aliasee = dyn_cast<llvm::GlobalObject>(Ref); - if (!Aliasee) - Aliasee = cast<llvm::GlobalAlias>(Ref)->getAliasee(); + llvm::Constant *Aliasee = Ref; + if (Ref->getType() != AliasType) + Aliasee = llvm::ConstantExpr::getBitCast(Ref, AliasType); // Instead of creating as alias to a linkonce_odr, replace all of the uses // of the aliasee. @@ -156,10 +156,7 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, // members with attribute "AlwaysInline" and expect no reference to // be generated. It is desirable to reenable this optimisation after // corresponding LLVM changes. - llvm::Constant *Replacement = Aliasee; - if (Aliasee->getType() != AliasType) - Replacement = llvm::ConstantExpr::getBitCast(Aliasee, AliasType); - Replacements[MangledName] = Replacement; + Replacements[MangledName] = Aliasee; return false; } @@ -167,7 +164,7 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, /// If we don't have a definition for the destructor yet, don't /// emit. We can't emit aliases to declarations; that's just not /// how aliases work. - if (Aliasee->isDeclaration()) + if (Ref->isDeclaration()) return true; } @@ -180,7 +177,7 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, // Create the alias with no name. auto *Alias = llvm::GlobalAlias::create(AliasType->getElementType(), 0, - Linkage, "", Aliasee); + Linkage, "", Aliasee, &getModule()); // Switch any previous uses to the alias. if (Entry) { |