Skip to content

Commit b7f0edb

Browse files
authored
[clang] UEFI targets must use CodeView. (llvm#124660)
1 parent a27f3b2 commit b7f0edb

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

clang/lib/Driver/ToolChains/UEFI.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class LLVM_LIBRARY_VISIBILITY UEFI : public ToolChain {
5555
void
5656
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
5757
llvm::opt::ArgStringList &CC1Args) const override;
58+
59+
llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override {
60+
return llvm::codegenoptions::DIF_CodeView;
61+
}
5862
};
5963

6064
} // namespace toolchains

clang/unittests/Driver/ToolChainTest.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "clang/Frontend/CompilerInstance.h"
2222
#include "llvm/ADT/ArrayRef.h"
2323
#include "llvm/ADT/StringExtras.h"
24+
#include "llvm/Frontend/Debug/Options.h"
2425
#include "llvm/MC/TargetRegistry.h"
2526
#include "llvm/Support/TargetSelect.h"
2627
#include "llvm/Support/VirtualFileSystem.h"
@@ -595,6 +596,22 @@ TEST(ToolChainTest, UEFICallingConventionTest) {
595596
TargetInfo::CallingConvKind::CCK_MicrosoftWin64);
596597
}
597598

599+
TEST(ToolChainTest, UEFIDefaultDebugFormatTest) {
600+
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
601+
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
602+
struct TestDiagnosticConsumer : public DiagnosticConsumer {};
603+
DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer);
604+
IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
605+
new llvm::vfs::InMemoryFileSystem);
606+
Driver CCDriver("/home/test/bin/clang", "x86_64-unknown-uefi", Diags,
607+
"clang LLVM compiler", InMemoryFileSystem);
608+
CCDriver.setCheckInputsExist(false);
609+
std::unique_ptr<Compilation> CC(
610+
CCDriver.BuildCompilation({"/home/test/bin/clang", "foo.cpp"}));
611+
EXPECT_EQ(CC->getDefaultToolChain().getDefaultDebugFormat(),
612+
llvm::codegenoptions::DIF_CodeView);
613+
}
614+
598615
TEST(GetDriverMode, PrefersLastDriverMode) {
599616
static constexpr const char *Args[] = {"clang-cl", "--driver-mode=foo",
600617
"--driver-mode=bar", "foo.cpp"};

0 commit comments

Comments
 (0)