[clang] [llvm] [PowerPC][AIX] Support #pragma comment copyright for AIX (PR #178184)

Tony Varghese via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 03:48:59 PDT 2026


================
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 %s -DTEST_EMPTY_COPYRIGHT -triple powerpc-ibm-aix -verify
+// RUN: %clang_cc1 %s -DTEST_OTHER_COMMENT_KINDS -triple powerpc-ibm-aix -verify
+// RUN: %clang_cc1 %s -triple powerpc-ibm-aix -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple powerpc-ibm-aix -verify
+
+// RUN: %clang_cc1 %s -DTEST_EMPTY_COPYRIGHT -triple powerpc64-ibm-aix -verify
+// RUN: %clang_cc1 %s -DTEST_OTHER_COMMENT_KINDS -triple powerpc64-ibm-aix -verify
+// RUN: %clang_cc1 %s -triple powerpc64-ibm-aix -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple powerpc64-ibm-aix -verify
+
+#ifdef TEST_EMPTY_COPYRIGHT
+
+// 1. Verify no diagnostics for empty copyright string
+#pragma comment(copyright, "") // expected-no-diagnostics
+int main() {return 0; }
+
+#elif defined(TEST_OTHER_COMMENT_KINDS)
+
+// 2. Verify warnings for lib/linker and silent ignore for others
+#pragma comment(lib, "m") // expected-warning {{'#pragma comment lib' ignored}}
+#pragma comment(linker, "foo") // expected-warning {{'#pragma comment linker' ignored}}
+
+// These are recognized but ignored in CodeGen
----------------
tonykuttai wrote:

This is the existing behaviour of these pragma comment kinds. 
`compiler, exestr, user` kinds are ignored by other targets as well in `clang/lib/CodeGen/CodeGenModule.cpp`

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


More information about the cfe-commits mailing list