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

Tony Varghese via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 9 23:08:06 PST 2026


================
@@ -3514,6 +3520,31 @@ void CodeGenModule::AddDependentLib(StringRef Lib) {
   LinkerOptionsMetadata.push_back(llvm::MDNode::get(C, MDOpts));
 }
 
+/// Process copyright pragma and create LLVM metadata.
+/// #pragma comment(copyright, "string") embed copyright
+/// information into the object file's loader section.
+///
+/// Example: #pragma comment(copyright, "Copyright IBM Corp. 2024")
+///
+/// This should only be called once per translation unit.
+void CodeGenModule::ProcessPragmaComment(PragmaMSCommentKind Kind,
+                                         StringRef Comment) {
+  // Ensure we are only processing Copyright Pragmas
+  assert(Kind == PCK_Copyright &&
+         "Unexpected pragma comment kind, ProcessPragmaComment should only be "
+         "called for PCK_Copyright");
+
+  // Only one copyright pragma allowed per translation unit
+  if (LoadTimeComment) {
----------------
tonykuttai wrote:

My bad. Added the assert. Got confused with the code flow. 

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


More information about the cfe-commits mailing list