Skip to content

Commit b69879b

Browse files
committed
merge main into amd-staging
Change-Id: I4e9a6e2e9d0873407f2b41263412d9e5316004b3
2 parents c243099 + 2f4eac6 commit b69879b

File tree

78 files changed

+1705
-997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1705
-997
lines changed

clang-tools-extra/clangd/ModulesBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ bool IsModuleFileUpToDate(PathRef ModuleFilePath,
199199

200200
SourceManager SourceMgr(*Diags, FileMgr);
201201

202-
HeaderSearch HeaderInfo(HSOpts, SourceMgr, *Diags, LangOpts,
202+
HeaderSearch HeaderInfo(std::move(HSOpts), SourceMgr, *Diags, LangOpts,
203203
/*Target=*/nullptr);
204204

205205
TrivialModuleLoader ModuleLoader;

clang/lib/Driver/Driver.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4561,7 +4561,13 @@ Driver::getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args,
45614561
ToolChain::getOpenMPTriple(Arg->getValue(0)) == TC->getTriple()) {
45624562
Arg->claim();
45634563
unsigned Index = Args.getBaseArgs().MakeIndex(Arg->getValue(1));
4564+
unsigned Prev = Index;
45644565
ExtractedArg = getOpts().ParseOneArg(Args, Index);
4566+
if (!ExtractedArg || Index > Prev + 1) {
4567+
TC->getDriver().Diag(diag::err_drv_invalid_Xopenmp_target_with_args)
4568+
<< Arg->getAsString(Args);
4569+
continue;
4570+
}
45654571
Arg = ExtractedArg.get();
45664572
}
45674573

clang/lib/Driver/ToolChain.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,8 +1607,10 @@ llvm::opt::DerivedArgList *ToolChain::TranslateOpenMPTargetArgs(
16071607
Prev = Index;
16081608
std::unique_ptr<Arg> XOpenMPTargetArg(Opts.ParseOneArg(Args, Index));
16091609
if (!XOpenMPTargetArg || Index > Prev + 1) {
1610-
getDriver().Diag(diag::err_drv_invalid_Xopenmp_target_with_args)
1611-
<< A->getAsString(Args);
1610+
if (!A->isClaimed()) {
1611+
getDriver().Diag(diag::err_drv_invalid_Xopenmp_target_with_args)
1612+
<< A->getAsString(Args);
1613+
}
16121614
continue;
16131615
}
16141616
if (XOpenMPTargetNoTriple && XOpenMPTargetArg &&

clang/lib/Driver/ToolChains/Arch/ARM.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,26 @@ bool arm::isARMAProfile(const llvm::Triple &Triple) {
5252
return llvm::ARM::parseArchProfile(Arch) == llvm::ARM::ProfileKind::A;
5353
}
5454

55+
/// Is the triple {arm,armeb,thumb,thumbeb}-none-none-{eabi,eabihf} ?
56+
bool arm::isARMEABIBareMetal(const llvm::Triple &Triple) {
57+
auto arch = Triple.getArch();
58+
if (arch != llvm::Triple::arm && arch != llvm::Triple::thumb &&
59+
arch != llvm::Triple::armeb && arch != llvm::Triple::thumbeb)
60+
return false;
61+
62+
if (Triple.getVendor() != llvm::Triple::UnknownVendor)
63+
return false;
64+
65+
if (Triple.getOS() != llvm::Triple::UnknownOS)
66+
return false;
67+
68+
if (Triple.getEnvironment() != llvm::Triple::EABI &&
69+
Triple.getEnvironment() != llvm::Triple::EABIHF)
70+
return false;
71+
72+
return true;
73+
}
74+
5575
// Get Arch/CPU from args.
5676
void arm::getARMArchCPUFromArgs(const ArgList &Args, llvm::StringRef &Arch,
5777
llvm::StringRef &CPU, bool FromAs) {

clang/lib/Driver/ToolChains/Arch/ARM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ int getARMSubArchVersionNumber(const llvm::Triple &Triple);
7575
bool isARMMProfile(const llvm::Triple &Triple);
7676
bool isARMAProfile(const llvm::Triple &Triple);
7777
bool isARMBigEndian(const llvm::Triple &Triple, const llvm::opt::ArgList &Args);
78+
bool isARMEABIBareMetal(const llvm::Triple &Triple);
7879

7980
} // end namespace arm
8081
} // end namespace tools

clang/lib/Driver/ToolChains/BareMetal.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -128,27 +128,6 @@ BareMetal::BareMetal(const Driver &D, const llvm::Triple &Triple,
128128
}
129129
}
130130

131-
/// Is the triple {arm,armeb,thumb,thumbeb}-none-none-{eabi,eabihf} ?
132-
static bool isARMBareMetal(const llvm::Triple &Triple) {
133-
if (Triple.getArch() != llvm::Triple::arm &&
134-
Triple.getArch() != llvm::Triple::thumb &&
135-
Triple.getArch() != llvm::Triple::armeb &&
136-
Triple.getArch() != llvm::Triple::thumbeb)
137-
return false;
138-
139-
if (Triple.getVendor() != llvm::Triple::UnknownVendor)
140-
return false;
141-
142-
if (Triple.getOS() != llvm::Triple::UnknownOS)
143-
return false;
144-
145-
if (Triple.getEnvironment() != llvm::Triple::EABI &&
146-
Triple.getEnvironment() != llvm::Triple::EABIHF)
147-
return false;
148-
149-
return true;
150-
}
151-
152131
/// Is the triple {aarch64.aarch64_be}-none-elf?
153132
static bool isAArch64BareMetal(const llvm::Triple &Triple) {
154133
if (Triple.getArch() != llvm::Triple::aarch64 &&
@@ -267,7 +246,7 @@ void BareMetal::findMultilibs(const Driver &D, const llvm::Triple &Triple,
267246
}
268247

269248
bool BareMetal::handlesTarget(const llvm::Triple &Triple) {
270-
return isARMBareMetal(Triple) || isAArch64BareMetal(Triple) ||
249+
return arm::isARMEABIBareMetal(Triple) || isAArch64BareMetal(Triple) ||
271250
isRISCVBareMetal(Triple) || isPPCBareMetal(Triple);
272251
}
273252

@@ -561,7 +540,7 @@ void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
561540
// The R_ARM_TARGET2 relocation must be treated as R_ARM_REL32 on arm*-*-elf
562541
// and arm*-*-eabi (the default is R_ARM_GOT_PREL, used on arm*-*-linux and
563542
// arm*-*-*bsd).
564-
if (isARMBareMetal(TC.getTriple()))
543+
if (arm::isARMEABIBareMetal(TC.getTriple()))
565544
CmdArgs.push_back("--target2=rel");
566545

567546
CmdArgs.push_back("-o");

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "Arch/SystemZ.h"
2121
#include "Arch/VE.h"
2222
#include "Arch/X86.h"
23+
#include "BareMetal.h"
2324
#include "HIPAMD.h"
2425
#include "Hexagon.h"
2526
#include "MSP430.h"
@@ -155,6 +156,9 @@ static bool useFramePointerForTargetByDefault(const llvm::opt::ArgList &Args,
155156
}
156157
}
157158

159+
if (arm::isARMEABIBareMetal(Triple))
160+
return false;
161+
158162
return true;
159163
}
160164

clang/test/Driver/frame-pointer-elim.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,58 @@
162162
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
163163
// RUN: not %clang -### --target=riscv64-linux-android -mbig-endian -O1 -S %s 2>&1 | \
164164
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
165+
166+
// On ARM backend bare metal targets, frame pointer is omitted
167+
// RUN: %clang -### --target=arm-arm-none-eabi -S %s 2>&1 | \
168+
// RUN: FileCheck --check-prefix=KEEP-NONE %s
169+
// RUN: %clang -### --target=arm-arm-none-eabihf -S %s 2>&1 | \
170+
// RUN: FileCheck --check-prefix=KEEP-NONE %s
171+
// RUN: %clang -### --target=arm-arm-none-eabi -S -fno-omit-frame-pointer %s 2>&1 | \
172+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
173+
// RUN: %clang -### --target=arm-arm-none-eabihf -S -fno-omit-frame-pointer %s 2>&1 | \
174+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
175+
// RUN: %clang -### --target=arm-arm-none-eabi -S -O1 %s 2>&1 | \
176+
// RUN: FileCheck --check-prefix=KEEP-NONE %s
177+
// RUN: %clang -### --target=arm-arm-none-eabihf -S -O1 %s 2>&1 | \
178+
// RUN: FileCheck --check-prefix=KEEP-NONE %s
179+
// RUN: %clang -### --target=arm-arm-none-eabi -S -O1 -fno-omit-frame-pointer %s 2>&1 | \
180+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
181+
// RUN: %clang -### --target=arm-arm-none-eabihf -S -O1 -fno-omit-frame-pointer %s 2>&1 | \
182+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
183+
// RUN: %clang -### --target=armeb-arm-none-eabi -S %s 2>&1 | \
184+
// RUN: FileCheck --check-prefix=KEEP-NONE %s
185+
// RUN: %clang -### --target=thumb-arm-none-eabi -S %s 2>&1 | \
186+
// RUN: FileCheck --check-prefix=KEEP-NONE %s
187+
// RUN: %clang -### --target=thumbeb-arm-none-eabi -S %s 2>&1 | \
188+
// RUN: FileCheck --check-prefix=KEEP-NONE %s
189+
190+
// Check that for Apple bare metal targets, we're keeping frame pointers by default
191+
// RUN: %clang -### --target=thumbv6m-apple-none-macho -S %s 2>&1 | \
192+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
193+
// RUN: %clang -### --target=thumbv6m-apple-none-macho -S -fno-omit-frame-pointer %s 2>&1 | \
194+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
195+
// RUN: %clang -### --target=arm-apple-none-macho -S %s 2>&1 | \
196+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
197+
// RUN: %clang -### --target=arm-apple-none-macho -S -fno-omit-frame-pointer %s 2>&1 | \
198+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
199+
// RUN: %clang -### --target=thumbv6m-apple-none-macho -S -O1 %s 2>&1 | \
200+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
201+
// RUN: %clang -### --target=thumbv6m-apple-none-macho -S -O1 -fno-omit-frame-pointer %s 2>&1 | \
202+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
203+
// RUN: %clang -### --target=arm-apple-none-macho -S -O1 %s 2>&1 | \
204+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
205+
// RUN: %clang -### --target=arm-apple-none-macho -S -O1 -fno-omit-frame-pointer %s 2>&1 | \
206+
// RUN: FileCheck --check-prefix=KEEP-ALL %s
207+
208+
// AArch64 bare metal targets behave like hosted targets
209+
// RUN: %clang -### --target=aarch64-none-elf -S %s 2>&1 | \
210+
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
211+
// RUN: %clang -### --target=aarch64-none-elf -S -O1 %s 2>&1 | \
212+
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
213+
// RUN: %clang -### --target=aarch64-none-elf -S -fno-omit-frame-pointer %s 2>&1 | \
214+
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
215+
// RUN: %clang -### --target=aarch64-none-elf -S -O1 -fno-omit-frame-pointer %s 2>&1 | \
216+
// RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s
217+
165218
void f0() {}
166219
void f1() { f0(); }

clang/test/Driver/openmp-offload.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,15 @@
8686

8787
/// Check -Xopenmp-target triggers error when an option requiring arguments is passed to it.
8888
// RUN: not %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target -Xopenmp-target -mcpu=pwr8 %s 2>&1 \
89-
// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-NESTED-ERROR %s
89+
// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-NESTED-ERROR_0 %s
9090

91-
// CHK-FOPENMP-TARGET-NESTED-ERROR: clang{{.*}} error: invalid -Xopenmp-target argument: '-Xopenmp-target -Xopenmp-target', options requiring arguments are unsupported
91+
// CHK-FOPENMP-TARGET-NESTED-ERROR_0: error: invalid -Xopenmp-target argument: '-Xopenmp-target -Xopenmp-target', options requiring arguments are unsupported
92+
93+
/// Check -Xopenmp-target= triggers error when an option requiring arguments is passed to it.
94+
// RUN: not %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -Xopenmp-target=powerpc64le-ibm-linux-gnu -Xopenmp-target -mcpu=pwr8 %s 2>&1 \
95+
// RUN: | FileCheck -check-prefix=CHK-FOPENMP-TARGET-NESTED-ERROR_1 %s
96+
97+
// CHK-FOPENMP-TARGET-NESTED-ERROR_1: error: invalid -Xopenmp-target argument: '-Xopenmp-target=powerpc64le-ibm-linux-gnu -Xopenmp-target', options requiring arguments are unsupported
9298

9399
/// ###########################################################################
94100

libcxx/include/__memory/allocator_traits.h

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4444

4545
// __pointer
4646
template <class _Tp>
47-
using __pointer_member = typename _Tp::pointer;
47+
using __pointer_member _LIBCPP_NODEBUG = typename _Tp::pointer;
4848

4949
template <class _Tp, class _Alloc>
50-
using __pointer = __detected_or_t<_Tp*, __pointer_member, __libcpp_remove_reference_t<_Alloc> >;
50+
using __pointer _LIBCPP_NODEBUG = __detected_or_t<_Tp*, __pointer_member, __libcpp_remove_reference_t<_Alloc> >;
5151

5252
// __const_pointer
5353
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_const_pointer, const_pointer);
@@ -58,7 +58,7 @@ struct __const_pointer {
5858
template <class _Tp, class _Ptr, class _Alloc>
5959
struct __const_pointer<_Tp, _Ptr, _Alloc, false> {
6060
#ifdef _LIBCPP_CXX03_LANG
61-
using type = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
61+
using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>::other;
6262
#else
6363
using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
6464
#endif
@@ -96,10 +96,10 @@ struct __const_void_pointer<_Ptr, _Alloc, false> {
9696

9797
// __size_type
9898
template <class _Tp>
99-
using __size_type_member = typename _Tp::size_type;
99+
using __size_type_member _LIBCPP_NODEBUG = typename _Tp::size_type;
100100

101101
template <class _Alloc, class _DiffType>
102-
using __size_type = __detected_or_t<__make_unsigned_t<_DiffType>, __size_type_member, _Alloc>;
102+
using __size_type _LIBCPP_NODEBUG = __detected_or_t<__make_unsigned_t<_DiffType>, __size_type_member, _Alloc>;
103103

104104
// __alloc_traits_difference_type
105105
_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_alloc_traits_difference_type, difference_type);
@@ -114,33 +114,37 @@ struct __alloc_traits_difference_type<_Alloc, _Ptr, true> {
114114

115115
// __propagate_on_container_copy_assignment
116116
template <class _Tp>
117-
using __propagate_on_container_copy_assignment_member = typename _Tp::propagate_on_container_copy_assignment;
117+
using __propagate_on_container_copy_assignment_member _LIBCPP_NODEBUG =
118+
typename _Tp::propagate_on_container_copy_assignment;
118119

119120
template <class _Alloc>
120-
using __propagate_on_container_copy_assignment =
121+
using __propagate_on_container_copy_assignment _LIBCPP_NODEBUG =
121122
__detected_or_t<false_type, __propagate_on_container_copy_assignment_member, _Alloc>;
122123

123124
// __propagate_on_container_move_assignment
124125
template <class _Tp>
125-
using __propagate_on_container_move_assignment_member = typename _Tp::propagate_on_container_move_assignment;
126+
using __propagate_on_container_move_assignment_member _LIBCPP_NODEBUG =
127+
typename _Tp::propagate_on_container_move_assignment;
126128

127129
template <class _Alloc>
128-
using __propagate_on_container_move_assignment =
130+
using __propagate_on_container_move_assignment _LIBCPP_NODEBUG =
129131
__detected_or_t<false_type, __propagate_on_container_move_assignment_member, _Alloc>;
130132

131133
// __propagate_on_container_swap
132134
template <class _Tp>
133-
using __propagate_on_container_swap_member = typename _Tp::propagate_on_container_swap;
135+
using __propagate_on_container_swap_member _LIBCPP_NODEBUG = typename _Tp::propagate_on_container_swap;
134136

135137
template <class _Alloc>
136-
using __propagate_on_container_swap = __detected_or_t<false_type, __propagate_on_container_swap_member, _Alloc>;
138+
using __propagate_on_container_swap _LIBCPP_NODEBUG =
139+
__detected_or_t<false_type, __propagate_on_container_swap_member, _Alloc>;
137140

138141
// __is_always_equal
139142
template <class _Tp>
140-
using __is_always_equal_member = typename _Tp::is_always_equal;
143+
using __is_always_equal_member _LIBCPP_NODEBUG = typename _Tp::is_always_equal;
141144

142145
template <class _Alloc>
143-
using __is_always_equal = __detected_or_t<typename is_empty<_Alloc>::type, __is_always_equal_member, _Alloc>;
146+
using __is_always_equal _LIBCPP_NODEBUG =
147+
__detected_or_t<typename is_empty<_Alloc>::type, __is_always_equal_member, _Alloc>;
144148

145149
// __allocator_traits_rebind
146150
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
@@ -165,7 +169,7 @@ struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false> {
165169
_LIBCPP_SUPPRESS_DEPRECATED_POP
166170

167171
template <class _Alloc, class _Tp>
168-
using __allocator_traits_rebind_t = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
172+
using __allocator_traits_rebind_t _LIBCPP_NODEBUG = typename __allocator_traits_rebind<_Alloc, _Tp>::type;
169173

170174
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
171175

@@ -355,12 +359,12 @@ template <class _Traits, class _Tp>
355359
using __rebind_alloc _LIBCPP_NODEBUG = typename _Traits::template rebind_alloc<_Tp>;
356360
#else
357361
template <class _Traits, class _Tp>
358-
using __rebind_alloc = typename _Traits::template rebind_alloc<_Tp>::other;
362+
using __rebind_alloc _LIBCPP_NODEBUG = typename _Traits::template rebind_alloc<_Tp>::other;
359363
#endif
360364

361365
template <class _Alloc>
362366
struct __check_valid_allocator : true_type {
363-
using _Traits = std::allocator_traits<_Alloc>;
367+
using _Traits _LIBCPP_NODEBUG = std::allocator_traits<_Alloc>;
364368
static_assert(is_same<_Alloc, __rebind_alloc<_Traits, typename _Traits::value_type> >::value,
365369
"[allocator.requirements] states that rebinding an allocator to the same type should result in the "
366370
"original allocator");

0 commit comments

Comments
 (0)