aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2025-06-05 10:52:01 -0700
committerGitHub <noreply@github.com>2025-06-05 10:52:01 -0700
commitd1b0b4bb4405c144e23be3d5c0459b03f95bd5ac (patch)
treee420f9df26dcfeafbb9c00b9bc72e04caf19d6e7 /clang/lib/CodeGen/CodeGenModule.cpp
parentdef37f7e3a66601e044ce49c034293e7e32d2a3b (diff)
downloadllvm-d1b0b4bb4405c144e23be3d5c0459b03f95bd5ac.zip
llvm-d1b0b4bb4405c144e23be3d5c0459b03f95bd5ac.tar.gz
llvm-d1b0b4bb4405c144e23be3d5c0459b03f95bd5ac.tar.bz2
Add -funique-source-file-identifier option.
This option complements -funique-source-file-names and allows the user to use a different unique identifier than the source file path. Reviewers: teresajohnson Reviewed By: teresajohnson Pull Request: https://github.com/llvm/llvm-project/pull/142901
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 84166dd..c005d33 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1146,8 +1146,13 @@ void CodeGenModule::Release() {
1);
}
- if (CodeGenOpts.UniqueSourceFileNames) {
- getModule().addModuleFlag(llvm::Module::Max, "Unique Source File Names", 1);
+ if (!CodeGenOpts.UniqueSourceFileIdentifier.empty()) {
+ getModule().addModuleFlag(
+ llvm::Module::Append, "Unique Source File Identifier",
+ llvm::MDTuple::get(
+ TheModule.getContext(),
+ llvm::MDString::get(TheModule.getContext(),
+ CodeGenOpts.UniqueSourceFileIdentifier)));
}
if (LangOpts.Sanitize.has(SanitizerKind::KCFI)) {