]> granicus.if.org Git - clang/commitdiff
Revert "[opaque pointer type] update for LLVM API change"
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 14 Sep 2015 18:02:04 +0000 (18:02 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 14 Sep 2015 18:02:04 +0000 (18:02 +0000)
This was the wrong direction to take anyway (because ultimately the
GlobalValue needed the pointee type again and /it/ used
PointerType::getElementType eventually anyway)... let's go a different way.

This reverts commit r236161.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247586 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCXX.cpp
lib/CodeGen/CGObjCGNU.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/ItaniumCXXABI.cpp
lib/CodeGen/MicrosoftCXXABI.cpp

index 07eb91582affd0f68ea62fc3b3314a3bd84ff303..0314b7c619a0bd8bf47473a38c98865911661421 100644 (file)
@@ -185,8 +185,8 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
     return true;
 
   // Create the alias with no name.
-  auto *Alias =
-      llvm::GlobalAlias::create(AliasType, Linkage, "", Aliasee, &getModule());
+  auto *Alias = llvm::GlobalAlias::create(AliasType->getElementType(), 0,
+                                          Linkage, "", Aliasee, &getModule());
 
   // Switch any previous uses to the alias.
   if (Entry) {
index 6bbf2ef5b085ebd615eedd38d71915b958ec2ee5..54721a0cb154ef9fe30dd877afe38eeeef1890ed 100644 (file)
@@ -1065,7 +1065,7 @@ llvm::Value *CGObjCGNU::GetSelector(CodeGenFunction &CGF, Selector Sel,
   }
   if (!SelValue) {
     SelValue = llvm::GlobalAlias::create(
-        SelectorTy, llvm::GlobalValue::PrivateLinkage,
+        SelectorTy->getElementType(), 0, llvm::GlobalValue::PrivateLinkage,
         ".objc_selector_" + Sel.getAsString(), &TheModule);
     Types.emplace_back(TypeEncoding, SelValue);
   }
@@ -1278,14 +1278,14 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGenFunction &CGF,
     if (IsClassMessage)  {
       if (!MetaClassPtrAlias) {
         MetaClassPtrAlias = llvm::GlobalAlias::create(
-            IdTy, llvm::GlobalValue::InternalLinkage,
+            IdTy->getElementType(), 0, llvm::GlobalValue::InternalLinkage,
             ".objc_metaclass_ref" + Class->getNameAsString(), &TheModule);
       }
       ReceiverClass = MetaClassPtrAlias;
     } else {
       if (!ClassPtrAlias) {
         ClassPtrAlias = llvm::GlobalAlias::create(
-            IdTy, llvm::GlobalValue::InternalLinkage,
+            IdTy->getElementType(), 0, llvm::GlobalValue::InternalLinkage,
             ".objc_class_ref" + Class->getNameAsString(), &TheModule);
       }
       ReceiverClass = ClassPtrAlias;
index 660f18a694e05674441b28f9aa37e2852c59cb5e..ea420229c74ff37eaeb0601582f2a80c93ee6ea7 100644 (file)
@@ -2772,7 +2772,7 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) {
 
   // Create the new alias itself, but don't set a name yet.
   auto *GA = llvm::GlobalAlias::create(
-      cast<llvm::PointerType>(Aliasee->getType()),
+      cast<llvm::PointerType>(Aliasee->getType())->getElementType(), 0,
       llvm::Function::ExternalLinkage, "", Aliasee, &getModule());
 
   if (Entry) {
index fa714d7ddc77eeda393b4c954769f4640f1200fb..0b69ff6c18f1165b5238e9b4c844776739905232 100644 (file)
@@ -3354,8 +3354,8 @@ static void emitConstructorDestructorAlias(CodeGenModule &CGM,
   llvm::PointerType *AliasType = Aliasee->getType();
 
   // Create the alias with no name.
-  auto *Alias = llvm::GlobalAlias::create(AliasType, Linkage, "", Aliasee,
-                                          &CGM.getModule());
+  auto *Alias = llvm::GlobalAlias::create(
+      AliasType->getElementType(), 0, Linkage, "", Aliasee, &CGM.getModule());
 
   // Switch any previous uses to the alias.
   if (Entry) {
index a981dd6e6d2b3fdc9cc7ae973eda2c05d1c2eba4..172ddda50c8677f8018cf3dfcb0416eba8716780 100644 (file)
@@ -1734,8 +1734,9 @@ llvm::GlobalVariable *MicrosoftCXXABI::getAddrOfVTable(const CXXRecordDecl *RD,
         C->setSelectionKind(llvm::Comdat::Largest);
     }
     VFTable = llvm::GlobalAlias::create(
-        cast<llvm::PointerType>(VTableGEP->getType()), VFTableLinkage,
-        VFTableName.str(), VTableGEP, &CGM.getModule());
+        cast<llvm::SequentialType>(VTableGEP->getType())->getElementType(),
+        /*AddressSpace=*/0, VFTableLinkage, VFTableName.str(), VTableGEP,
+        &CGM.getModule());
     VFTable->setUnnamedAddr(true);
   } else {
     // We don't need a GlobalAlias to be a symbol for the VTable if we won't