DHowett-MSFT added inline comments.

================
Comment at: clang/lib/CodeGen/CGObjCGNU.cpp:1231
+            break;
+
+        auto Storage = llvm::GlobalValue::DefaultStorageClass;
----------------
After we get the `ObjCInterfaceDecl`, we have to make sure it's the one 
corresponding to the `@interface` and not one for a forward declaration 
(`@class`).

```                  
+        // The first Interface we find may be a @class,
+        // which should only be treated as the source of
+        // truth in the absence of a true declaration.
+        const ObjCInterfaceDecl *OIDDef = OID->getDefinition();
+        if (OIDDef != nullptr)
+          OID = OIDDef;
+
```

Failure to do so can result in us either failing to import the `CLASS_REF` or, 
if it has been exported as `CONSTANT`, attempt a method dispatch against a 
pointer to our own import table.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58724/new/

https://reviews.llvm.org/D58724



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to