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

Igor Kudrin via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 22:35: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);
----------------
igorkudrin wrote:

Thanks! Updated. It's so confusing when different subprojects of LLVM have different preferences...

BTW, what do you think about `shouldReportTypeMismatch`? Should it be treated as a variable or a function? The coding standard does not describe callable variables specifically, and there are both variants in relatively recent Clang code.

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


More information about the cfe-commits mailing list