[clang] [llvm] [PowerPC][AIX] Support #pragma comment copyright for AIX (PR #178184)
Wael Yehia via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 24 21:14:07 PDT 2026
================
@@ -3541,6 +3543,39 @@ void CodeGenModule::AddDependentLib(StringRef Lib) {
LinkerOptionsMetadata.push_back(llvm::MDNode::get(C, MDOpts));
}
+/// Process copyright pragma and create LLVM metadata.
+/// #pragma comment(copyright, "string") embeds copyright information into a
+/// loadable program-data section of the object file for inclusion in the linked
+/// module.
+///
+/// Example: #pragma comment(copyright, "Copyright string")
+///
+/// This should only be called once per translation unit.
+void CodeGenModule::ProcessPragmaComment(PragmaMSCommentKind Kind,
+ StringRef Comment,
+ bool isFromASTFile) {
+ // Ensure we are only processing Copyright Pragmas
+ assert(Kind == PCK_Copyright &&
+ "Unexpected pragma comment kind, ProcessPragmaComment should only be "
+ "called for PCK_Copyright");
+ // Target Guard: Only AIX supports PCK_Copyright currently.
+ assert(getTriple().isOSAIX() &&
+ "pragma comment copyright is supported only when targeting AIX");
+
+ // Deserialization Guard: Only process if copyright originated in this TU.
+ if (isFromASTFile)
----------------
w2yehia wrote:
I suspect `bool isFromASTFile` has to do with PCH or C++ Modules (which I'm not familiar with)? If it is, then were is the interaction between pragma comment copyright (or pragmas in general) and Modules documented?
https://github.com/llvm/llvm-project/pull/178184
More information about the llvm-commits
mailing list