Skip to content

Commit 1f9be61

Browse files
Merge branch 'main' into issue_165161
2 parents 8d583eb + beadb9e commit 1f9be61

File tree

8 files changed

+68
-25
lines changed

8 files changed

+68
-25
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void CGDebugInfo::setLocation(SourceLocation Loc) {
345345
if (Loc.isInvalid())
346346
return;
347347

348-
CurLoc = CGM.getContext().getSourceManager().getExpansionLoc(Loc);
348+
CurLoc = CGM.getContext().getSourceManager().getFileLoc(Loc);
349349

350350
// If we've changed files in the middle of a lexical scope go ahead
351351
// and create a new lexical scope with file node if it's different
@@ -572,7 +572,7 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
572572
FileName = TheCU->getFile()->getFilename();
573573
CSInfo = TheCU->getFile()->getChecksum();
574574
} else {
575-
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
575+
PresumedLoc PLoc = SM.getPresumedLoc(SM.getFileLoc(Loc));
576576
FileName = PLoc.getFilename();
577577

578578
if (FileName.empty()) {
@@ -599,7 +599,8 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
599599
if (CSKind)
600600
CSInfo.emplace(*CSKind, Checksum);
601601
}
602-
return createFile(FileName, CSInfo, getSource(SM, SM.getFileID(Loc)));
602+
return createFile(FileName, CSInfo,
603+
getSource(SM, SM.getFileID(SM.getFileLoc(Loc))));
603604
}
604605

605606
llvm::DIFile *CGDebugInfo::createFile(
@@ -654,7 +655,7 @@ unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) {
654655
if (Loc.isInvalid())
655656
return 0;
656657
SourceManager &SM = CGM.getContext().getSourceManager();
657-
return SM.getPresumedLoc(Loc).getLine();
658+
return SM.getPresumedLoc(SM.getFileLoc(Loc)).getLine();
658659
}
659660

660661
unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc, bool Force) {
@@ -666,7 +667,8 @@ unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc, bool Force) {
666667
if (Loc.isInvalid() && CurLoc.isInvalid())
667668
return 0;
668669
SourceManager &SM = CGM.getContext().getSourceManager();
669-
PresumedLoc PLoc = SM.getPresumedLoc(Loc.isValid() ? Loc : CurLoc);
670+
PresumedLoc PLoc =
671+
SM.getPresumedLoc(Loc.isValid() ? SM.getFileLoc(Loc) : CurLoc);
670672
return PLoc.isValid() ? PLoc.getColumn() : 0;
671673
}
672674

@@ -5002,7 +5004,7 @@ void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc) {
50025004
// Update our current location
50035005
setLocation(Loc);
50045006

5005-
if (CurLoc.isInvalid() || CurLoc.isMacroID() || LexicalBlockStack.empty())
5007+
if (CurLoc.isInvalid() || LexicalBlockStack.empty())
50065008
return;
50075009

50085010
llvm::MDNode *Scope = LexicalBlockStack.back();
@@ -6278,7 +6280,8 @@ void CGDebugInfo::EmitGlobalAlias(const llvm::GlobalValue *GV,
62786280
void CGDebugInfo::AddStringLiteralDebugInfo(llvm::GlobalVariable *GV,
62796281
const StringLiteral *S) {
62806282
SourceLocation Loc = S->getStrTokenLoc(0);
6281-
PresumedLoc PLoc = CGM.getContext().getSourceManager().getPresumedLoc(Loc);
6283+
SourceManager &SM = CGM.getContext().getSourceManager();
6284+
PresumedLoc PLoc = SM.getPresumedLoc(SM.getFileLoc(Loc));
62826285
if (!PLoc.isValid())
62836286
return;
62846287

clang/lib/Driver/ToolChains/ZOS.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void zos::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
7575

7676
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
7777
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
78-
Exec, CmdArgs, Inputs));
78+
Exec, CmdArgs, Inputs, Output));
7979
}
8080

8181
static std::string getLEHLQ(const ArgList &Args) {
@@ -213,7 +213,7 @@ void zos::Linker::ConstructJob(Compilation &C, const JobAction &JA,
213213

214214
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
215215
C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
216-
Exec, CmdArgs, Inputs));
216+
Exec, CmdArgs, Inputs, Output));
217217
}
218218

219219
ToolChain::RuntimeLibType ZOS::GetDefaultRuntimeLibType() const {

clang/test/CodeGenCXX/ubsan-coroutines.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// This test merely verifies that emitting the object file does not cause a
22
// crash when the LLVM coroutines passes are run.
33
// RUN: %clang_cc1 -emit-obj -std=c++2a -fsanitize=null %s -o %t.o
4+
// UNSUPPORTED: target={{.*}}-zos{{.*}}
45

56
namespace std {
67
template <typename R, typename... T> struct coroutine_traits {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// RUN: %clang_cc1 %s -debug-info-kind=standalone -emit-llvm -o - | FileCheck %s
2+
3+
#define GLOBAL(num) global## num
4+
#define DECL_GLOBAL(x) int x
5+
#define SAME_ORDER(x, y) x; y
6+
#define SWAP_ORDER(x,y) y; x
7+
8+
9+
10+
SAME_ORDER(
11+
int
12+
// CHECK: DIGlobalVariable(name: "global",{{.*}} line: [[@LINE+1]]
13+
GLOBAL // <- global
14+
() = 42,
15+
const char* s() {
16+
// CHECK: DIGlobalVariable({{.*}}line: [[@LINE+1]],{{.*}} type: [[TYPEID:![0-9]+]]
17+
return "1234567890";
18+
}
19+
)
20+
21+
SWAP_ORDER(
22+
int GLOBAL( // <- global2
23+
2) = 43,
24+
// CHECK: DIGlobalVariable(name: "global3",{{.*}} line: [[@LINE+3]]
25+
// CHECK: DIGlobalVariable(name: "global2",{{.*}} line: [[@LINE-3]]
26+
DECL_GLOBAL(
27+
GLOBAL( // <- global3
28+
3)) = 44
29+
);
30+
31+
32+
DECL_GLOBAL(
33+
// CHECK: DIGlobalVariable(name: "global4",{{.*}} line: [[@LINE+1]]
34+
GLOBAL( // <- global4
35+
4));

clang/test/Driver/fat-archive-unbundle-ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// REQUIRES: x86-registered-target
2-
// UNSUPPORTED: target={{.*-windows.*}}, target={{.*}}-macosx{{.*}}, target={{.*-darwin.*}}, target={{.*}}-aix{{.*}}
2+
// UNSUPPORTED: target={{.*-windows.*}}, target={{.*}}-macosx{{.*}}, target={{.*-darwin.*}}, target={{.*}}-aix{{.*}}, target={{.*}}-zos{{.*}}
33

44
// Generate dummy fat object
55
// RUN: %clang -O0 --target=%itanium_abi_triple %s -c -o %t.host.o

clang/test/Headers/cuda_with_openmp.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Reported in https://bugs.llvm.org/show_bug.cgi?id=48014
33
///==========================================================================///
44

5-
// REQUIRES: nvptx-registered-target
5+
// REQUIRES: nvptx-registered-target, host-supports-cuda
66

77
// RUN: %clang -x cuda -fopenmp -c %s -o - --cuda-path=%S/../Driver/Inputs/CUDA/usr/local/cuda -nocudalib -isystem %S/Inputs/include -isystem %S/../../lib/Headers -fsyntax-only
88

lldb/source/Host/windows/ProcessLauncherWindows.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "llvm/Support/Program.h"
1717

1818
#include <string>
19-
#include <unordered_set>
2019
#include <vector>
2120

2221
using namespace lldb;
@@ -92,13 +91,13 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
9291
startupinfo.hStdOutput =
9392
stdout_handle ? stdout_handle : ::GetStdHandle(STD_OUTPUT_HANDLE);
9493

95-
std::unordered_set<HANDLE> inherited_handles;
94+
std::vector<HANDLE> inherited_handles;
9695
if (startupinfo.hStdError)
97-
inherited_handles.insert(startupinfo.hStdError);
96+
inherited_handles.push_back(startupinfo.hStdError);
9897
if (startupinfo.hStdInput)
99-
inherited_handles.insert(startupinfo.hStdInput);
98+
inherited_handles.push_back(startupinfo.hStdInput);
10099
if (startupinfo.hStdOutput)
101-
inherited_handles.insert(startupinfo.hStdOutput);
100+
inherited_handles.push_back(startupinfo.hStdOutput);
102101

103102
SIZE_T attributelist_size = 0;
104103
InitializeProcThreadAttributeList(/*lpAttributeList=*/nullptr,
@@ -121,15 +120,13 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
121120
const FileAction *act = launch_info.GetFileActionAtIndex(i);
122121
if (act->GetAction() == FileAction::eFileActionDuplicate &&
123122
act->GetFD() == act->GetActionArgument())
124-
inherited_handles.insert(reinterpret_cast<HANDLE>(act->GetFD()));
123+
inherited_handles.push_back(reinterpret_cast<HANDLE>(act->GetFD()));
125124
}
126125
if (!inherited_handles.empty()) {
127-
std::vector<HANDLE> handles(inherited_handles.begin(),
128-
inherited_handles.end());
129126
if (!UpdateProcThreadAttribute(
130127
startupinfoex.lpAttributeList, /*dwFlags=*/0,
131-
PROC_THREAD_ATTRIBUTE_HANDLE_LIST, handles.data(),
132-
handles.size() * sizeof(HANDLE),
128+
PROC_THREAD_ATTRIBUTE_HANDLE_LIST, inherited_handles.data(),
129+
inherited_handles.size() * sizeof(HANDLE),
133130
/*lpPreviousValue=*/nullptr, /*lpReturnSize=*/nullptr)) {
134131
error = Status(::GetLastError(), eErrorTypeWin32);
135132
return HostProcess();

llvm/test/lit.cfg.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,10 +753,17 @@ def host_unwind_supports_jit():
753753
config.available_features.add("unix-sockets")
754754

755755
# .debug_frame is not emitted for targeting Windows x64, aarch64/arm64, AIX, or Apple Silicon Mac.
756-
if not re.match(
757-
r"^(x86_64|aarch64|arm64|powerpc|powerpc64).*-(windows-cygnus|windows-gnu|windows-msvc|aix)",
758-
config.target_triple,
759-
) and not re.match(r"^arm64(e)?-apple-(macos|darwin)", config.target_triple):
756+
if (
757+
not re.match(
758+
r"^(x86_64|aarch64|arm64|powerpc|powerpc64).*-(windows-cygnus|windows-gnu|windows-msvc|aix)",
759+
config.target_triple,
760+
)
761+
and not re.match(
762+
r"^arm64(e)?-apple-(macos|darwin)",
763+
config.target_triple,
764+
)
765+
and not re.match(r".*-zos.*", config.target_triple)
766+
):
760767
config.available_features.add("debug_frame")
761768

762769
if config.enable_backtrace:

0 commit comments

Comments
 (0)