-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] set DebugCompilationDir in PCHContainer #67744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change sets the debug compilation directory when generating debug information for PCH object containers. This allows for overriding the compilation directory in debug information in precompiled pcm files.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-modules ChangesThis change sets the debug compilation directory when generating debug information for PCH object containers. This allows for overriding the compilation directory in debug information in precompiled pcm files. Full diff: https://github.com/llvm/llvm-project/pull/67744.diff 2 Files Affected:
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
index 9ffeef026bd1b76..ee543e40b46099d 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -161,6 +161,8 @@ class PCHContainerGenerator : public ASTConsumer {
CodeGenOpts.setDebugInfo(llvm::codegenoptions::FullDebugInfo);
CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning());
CodeGenOpts.DwarfVersion = CI.getCodeGenOpts().DwarfVersion;
+ CodeGenOpts.DebugCompilationDir =
+ CI.getInvocation().getCodeGenOpts().DebugCompilationDir;
CodeGenOpts.DebugPrefixMap =
CI.getInvocation().getCodeGenOpts().DebugPrefixMap;
CodeGenOpts.DebugStrictDwarf = CI.getCodeGenOpts().DebugStrictDwarf;
diff --git a/clang/test/Modules/module-debuginfo-compdir.m b/clang/test/Modules/module-debuginfo-compdir.m
new file mode 100644
index 000000000000000..fced242624f75b3
--- /dev/null
+++ b/clang/test/Modules/module-debuginfo-compdir.m
@@ -0,0 +1,24 @@
+// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
+// REQUIRES: asserts
+
+// Modules:
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
+// RUN: -fdebug-compilation-dir=/OVERRIDE \
+// RUN: -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
+// RUN: -I %S/Inputs -I %t -emit-llvm -o %t.ll \
+// RUN: -mllvm -debug-only=pchcontainer &>%t-mod.ll
+// RUN: cat %t-mod.ll | FileCheck %s
+
+// PCH:
+// RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
+// RUN: -fdebug-compilation-dir=/OVERRIDE \
+// RUN: -o %t.pch %S/Inputs/DebugObjC.h \
+// RUN: -mllvm -debug-only=pchcontainer &>%t-pch.ll
+// RUN: cat %t-pch.ll | FileCheck %s
+
+#ifdef MODULES
+@import DebugObjC;
+#endif
+
+// CHECK: !DIFile(filename: "{{.*}}DebugObjC{{(\.h)?}}", directory: "/OVERRIDE")
|
rmaz
added a commit
to rmaz/swift
that referenced
this pull request
Sep 28, 2023
This change passes through the -file-compilation-dir flag to the ClangImporter instance as -ffile-compilation-dir. When used in conjunction with llvm/llvm-project#67744 this will allow for setting the compilation directory of pcm files using the -file-compilation-dir flag.
adrian-prantl
approved these changes
Sep 29, 2023
adrian-prantl
pushed a commit
to swiftlang/llvm-project
that referenced
this pull request
Oct 6, 2023
This change sets the debug compilation directory when generating debug information for PCH object containers. This allows for overriding the compilation directory in debug information in precompiled pcm files.
Guzhu-AMD
pushed a commit
to GPUOpen-Drivers/llvm-project
that referenced
this pull request
Oct 12, 2023
Local branch amd-gfx 6385230 Merged main:1a4b9b6f7339 into amd-gfx:31ed504cc6fe Remote branch main c14ca4c [clang] set DebugCompilationDir in PCHContainer (llvm#67744)
rmaz
added a commit
to swiftlang/swift
that referenced
this pull request
Oct 30, 2023
This change passes through the -file-compilation-dir flag to the ClangImporter instance as -ffile-compilation-dir. When used in conjunction with llvm/llvm-project#67744 this will allow for setting the compilation directory of pcm files using the -file-compilation-dir flag.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:codegen
IR generation bugs: mangling, exceptions, etc.
clang:modules
C++20 modules and Clang Header Modules
clang
Clang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change sets the debug compilation directory when generating debug information for PCH object containers. This allows for overriding the compilation directory in debug information in precompiled pcm files.