Skip to content

Commit f3b73e5

Browse files
Merge pull request #36 from adrian-prantl/cherry
Cherry-pick bugfixes
2 parents 9aa6c13 + c54d96a commit f3b73e5

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,11 @@ void CGDebugInfo::CreateCompileUnit() {
536536
// file to determine the real absolute path for the file.
537537
std::string MainFileDir;
538538
if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
539-
MainFileDir = remapDIPath(MainFile->getDir()->getName());
540-
if (MainFileDir != ".") {
539+
MainFileDir = MainFile->getDir()->getName();
540+
if (!llvm::sys::path::is_absolute(MainFileName)) {
541541
llvm::SmallString<1024> MainFileDirSS(MainFileDir);
542542
llvm::sys::path::append(MainFileDirSS, MainFileName);
543-
MainFileName = MainFileDirSS.str();
543+
MainFileName = llvm::sys::path::remove_leading_dotslash(MainFileDirSS);
544544
}
545545
// If the main file name provided is identical to the input file name, and
546546
// if the input file is a preprocessed source, use the module name for

clang/lib/Driver/ToolChains/Clang.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -3400,7 +3400,6 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
34003400
Args.getLastArg(options::OPT_ggnu_pubnames, options::OPT_gno_gnu_pubnames,
34013401
options::OPT_gpubnames, options::OPT_gno_pubnames);
34023402
if (DwarfFission != DwarfFissionKind::None ||
3403-
DebuggerTuning == llvm::DebuggerKind::LLDB ||
34043403
(PubnamesArg && checkDebugInfoOption(PubnamesArg, Args, D, TC)))
34053404
if (!PubnamesArg ||
34063405
(!PubnamesArg->getOption().matches(options::OPT_gno_gnu_pubnames) &&

clang/test/Driver/debug-options.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
// RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s
194194
// RUN: %clang -### -c -fdebug-ranges-base-address -fno-debug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s
195195
//
196-
// RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=GPUB %s
196+
// RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s
197197
// RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s
198198
//
199199
// RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// REQUIRES: asserts
2+
3+
// Modules:
4+
// RUN: rm -rf %t
5+
// RUN: mkdir %t
6+
// RUN: cd %t
7+
8+
// RUN: %clang_cc1 -fmodule-format=obj -emit-pch \
9+
// RUN: -triple %itanium_abi_triple \
10+
// RUN: -fdebug-prefix-map=%t=BUILD \
11+
// RUN: -fdebug-prefix-map=%S=SOURCE \
12+
// RUN: -o %t/prefix.ll %S/debug-info-limited-struct.h \
13+
// RUN: -mllvm -debug-only=pchcontainer &>%t-container.ll
14+
// RUN: cat %t-container.ll | FileCheck %s
15+
16+
// CHECK: distinct !DICompileUnit(
17+
// CHECK-SAME: language: DW_LANG_C99,
18+
// CHECK-SAME: file: ![[FILE:[0-9]+]],
19+
// CHECK: ![[FILE]] = !DIFile(
20+
// CHECK-SAME: filename: "SOURCE/debug-info-limited-struct.h",
21+
// CHECK-SAME: directory: "BUILD"
22+

0 commit comments

Comments
 (0)