[clang] 5c6752d - [CGObjCMac] Check global value type instead of poitner type

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 07:39:55 PDT 2022


Author: Nikita Popov
Date: 2022-03-23T15:39:39+01:00
New Revision: 5c6752d4ade99ecdaca391cf14b7d7e5c9a75fc1

URL: https://github.com/llvm/llvm-project/commit/5c6752d4ade99ecdaca391cf14b7d7e5c9a75fc1
DIFF: https://github.com/llvm/llvm-project/commit/5c6752d4ade99ecdaca391cf14b7d7e5c9a75fc1.diff

LOG: [CGObjCMac] Check global value type instead of poitner type

As we're going to reassign the initializer, we actually need the
value types to match, not just the pointer types. This is only
relevant with opaque pointers.

Added: 
    

Modified: 
    clang/lib/CodeGen/CGObjCMac.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index cbd7e82e60bd2..94d495a993835 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -7408,7 +7408,7 @@ CGObjCNonFragileABIMac::GetClassGlobal(StringRef Name,
            : llvm::GlobalValue::ExternalLinkage;
 
   llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);
-  if (!GV || GV->getType() != ObjCTypes.ClassnfABITy->getPointerTo()) {
+  if (!GV || GV->getValueType() != ObjCTypes.ClassnfABITy) {
     auto *NewGV = new llvm::GlobalVariable(ObjCTypes.ClassnfABITy, false, L,
                                            nullptr, Name);
 


        


More information about the cfe-commits mailing list