[clang] [compiler-rt] Reland "[Clang][CodeGen] Report when an alias points to an incompatible target" (PR #195550)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 06:33:09 PDT 2026


================
@@ -804,6 +804,70 @@ void CodeGenModule::checkAliases() {
       continue;
     }
 
+    if (!IsIFunc) {
+      GlobalDecl AliaseeGD;
+      if (!lookupRepresentativeDecl(GV->getName(), AliaseeGD) ||
+          !isa<VarDecl, FunctionDecl>(AliaseeGD.getDecl())) {
+        Diags.Report(Location, diag::err_alias_to_undefined)
+            << IsIFunc << IsIFunc;
+        Error = true;
+        continue;
+      }
+
+      bool aliasIsFuncDecl = isa<FunctionDecl>(D);
+      bool aliaseeIsFunc = isa<llvm::Function, llvm::GlobalIFunc>(GV);
----------------
AaronBallman wrote:

```suggestion
      bool AliasIsFuncDecl = isa<FunctionDecl>(D);
      bool AliaseeIsFunc = isa<llvm::Function, llvm::GlobalIFunc>(GV);
```
Per our coding standards

https://github.com/llvm/llvm-project/pull/195550


More information about the cfe-commits mailing list