Skip to content

Commit 99a81d1

Browse files
authored
merge main into amd-staging (llvm#4219)
2 parents 34df860 + e481de0 commit 99a81d1

File tree

171 files changed

+8046
-2767
lines changed

Some content is hidden

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

171 files changed

+8046
-2767
lines changed

clang/bindings/python/clang/cindex.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,13 +1435,13 @@ def is_unexposed(self):
14351435
OMP_SCOPE_DIRECTIVE = 306
14361436

14371437
# OpenMP reverse directive.
1438-
OMPReverseDirective = 307
1438+
OMP_REVERSE_DIRECTIVE = 307
14391439

14401440
# OpenMP interchange directive.
1441-
OMPInterchangeDirective = 308
1441+
OMP_INTERCHANGE_DIRECTIVE = 308
14421442

14431443
# OpenMP assume directive.
1444-
OMPAssumeDirective = 309
1444+
OMP_ASSUME_DIRECTIVE = 309
14451445

14461446
# OpenMP stripe directive.
14471447
OMP_STRIPE_DIRECTIVE = 310
@@ -1450,43 +1450,43 @@ def is_unexposed(self):
14501450
OPEN_ACC_COMPUTE_DIRECTIVE = 320
14511451

14521452
# OpenACC Loop Construct.
1453-
OpenACCLoopConstruct = 321
1453+
OPEN_ACC_LOOP_CONSTRUCT = 321
14541454

14551455
# OpenACC Combined Constructs.
1456-
OpenACCCombinedConstruct = 322
1456+
OPEN_ACC_COMBINED_CONSTRUCT = 322
14571457

14581458
# OpenACC data Construct.
1459-
OpenACCDataConstruct = 323
1459+
OPEN_ACC_DATA_CONSTRUCT = 323
14601460

14611461
# OpenACC enter data Construct.
1462-
OpenACCEnterDataConstruct = 324
1462+
OPEN_ACC_ENTER_DATA_CONSTRUCT = 324
14631463

14641464
# OpenACC exit data Construct.
1465-
OpenACCExitDataConstruct = 325
1465+
OPEN_ACC_EXIT_DATA_CONSTRUCT = 325
14661466

14671467
# OpenACC host_data Construct.
1468-
OpenACCHostDataConstruct = 326
1468+
OPEN_ACC_HOST_DATA_CONSTRUCT = 326
14691469

14701470
# OpenACC wait Construct.
1471-
OpenACCWaitConstruct = 327
1471+
OPEN_ACC_WAIT_CONSTRUCT = 327
14721472

14731473
# OpenACC init Construct.
1474-
OpenACCInitConstruct = 328
1474+
OPEN_ACC_INIT_CONSTRUCT = 328
14751475

14761476
# OpenACC shutdown Construct.
1477-
OpenACCShutdownConstruct = 329
1477+
OPEN_ACC_SHUTDOWN_CONSTRUCT = 329
14781478

14791479
# OpenACC set Construct.
1480-
OpenACCSetConstruct = 330
1480+
OPEN_ACC_SET_CONSTRUCT = 330
14811481

14821482
# OpenACC update Construct.
1483-
OpenACCUpdateConstruct = 331
1483+
OPEN_ACC_UPDATE_CONSTRUCT = 331
14841484

14851485
# OpenACC atomic Construct.
1486-
OpenACCAtomicConstruct = 332
1486+
OPEN_ACC_ATOMIC_CONSTRUCT = 332
14871487

14881488
# OpenACC cache Construct.
1489-
OpenACCCacheConstruct = 333
1489+
OPEN_ACC_CACHE_CONSTRUCT = 333
14901490

14911491
###
14921492
# Other Kinds

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,9 @@ Sanitizers
834834

835835
Python Binding Changes
836836
----------------------
837-
- Exposed `clang_getCursorLanguage` via `Cursor.language`.
837+
- Exposed ``clang_getCursorLanguage`` via ``Cursor.language``.
838+
- Add all missing ``CursorKind``s, ``TypeKind``s and
839+
``ExceptionSpecificationKind``s from ``Index.h``
838840

839841
OpenMP Support
840842
--------------

clang/include/clang/Basic/Builtins.def

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767

6868
// The third value provided to the macro specifies information about attributes
6969
// of the function. These must be kept in sync with the predicates in the
70-
// Builtin::Context class. Currently we have:
70+
// Builtin::Context class. Note: In the descriptions below, {num} is a
71+
// placeholder for an integer. Currently we have:
7172
// n -> nothrow
7273
// r -> noreturn
7374
// U -> pure
@@ -83,23 +84,23 @@
8384
// h -> this function requires a specific header or an explicit declaration.
8485
// i -> this is a runtime library implemented function without the
8586
// '__builtin_' prefix. It will be implemented in compiler-rt or libgcc.
86-
// p:N: -> this is a printf-like function whose Nth argument is the format
87-
// string.
88-
// P:N: -> similar to the p:N: attribute, but the function is like vprintf
89-
// in that it accepts its arguments as a va_list rather than
90-
// through an ellipsis
91-
// s:N: -> this is a scanf-like function whose Nth argument is the format
92-
// string.
93-
// S:N: -> similar to the s:N: attribute, but the function is like vscanf
94-
// in that it accepts its arguments as a va_list rather than
95-
// through an ellipsis
87+
// p:{num}: -> this is a printf-like function whose {num}th argument is the
88+
// format string.
89+
// P:{num}: -> similar to the p:{num}: attribute, but the function is like
90+
// vprintf in that it accepts its arguments as a va_list rather than
91+
// through an ellipsis
92+
// s:{num}: -> this is a scanf-like function whose {num}th argument is the
93+
// format string.
94+
// S:{num}: -> similar to the s:{num}: attribute, but the function is like
95+
// vscanf in that it accepts its arguments as a va_list rather than
96+
// through an ellipsis
9697
// e -> const, but only when -fno-math-errno and FP exceptions are ignored
9798
// g -> const when FP exceptions are ignored
9899
// j -> returns_twice (like setjmp)
99100
// u -> arguments are not evaluated for their side-effects
100-
// V:N: -> requires vectors of at least N bits to be legal
101-
// C<N,M_0,...,M_k> -> callback behavior: argument N is called with argument
102-
// M_0, ..., M_k as payload
101+
// V:{num}: -> requires vectors of at least {num} bits to be legal
102+
// C<{num},M_0,...,M_k> -> callback behavior: argument {num} is called with
103+
// argument M_0, ..., M_k as payload
103104
// z -> this is a function in (possibly-versioned) namespace std
104105
// E -> this function can be constant evaluated by Clang frontend
105106
// G -> this is a C++20 consteval function

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,16 @@ void AMDGPUToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {
916916
CC1Args.push_back("-Werror=atomic-alignment");
917917
}
918918

919+
void AMDGPUToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
920+
ArgStringList &CC1Args) const {
921+
if (DriverArgs.hasArg(options::OPT_nostdinc) ||
922+
DriverArgs.hasArg(options::OPT_nostdlibinc))
923+
return;
924+
925+
if (std::optional<std::string> Path = getStdlibIncludePath())
926+
addSystemInclude(DriverArgs, CC1Args, *Path);
927+
}
928+
919929
StringRef
920930
AMDGPUToolChain::getGPUArch(const llvm::opt::ArgList &DriverArgs) const {
921931
return getProcessorFromTargetID(

clang/lib/Driver/ToolChains/AMDGPU.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUToolChain : public Generic_ELF {
122122
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
123123
llvm::opt::ArgStringList &CC1Args,
124124
Action::OffloadKind DeviceOffloadKind) const override;
125+
void
126+
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
127+
llvm::opt::ArgStringList &CC1Args) const override;
125128

126129
/// Return whether denormals should be flushed, and treated as 0 by default
127130
/// for the subtarget.

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,26 +1148,15 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
11481148
if (!Args.hasArg(options::OPT_nostdinc) &&
11491149
Args.hasFlag(options::OPT_offload_inc, options::OPT_no_offload_inc,
11501150
true) &&
1151-
!Args.hasArg(options::OPT_nobuiltininc)) {
1152-
// Without an offloading language we will include these headers directly.
1153-
// Offloading languages will instead only use the declarations stored in
1154-
// the resource directory at clang/lib/Headers/llvm_libc_wrappers.
1155-
if (getToolChain().getTriple().isGPU() &&
1156-
C.getActiveOffloadKinds() == Action::OFK_None) {
1157-
SmallString<128> P(llvm::sys::path::parent_path(D.Dir));
1158-
llvm::sys::path::append(P, "include");
1159-
llvm::sys::path::append(P, getToolChain().getTripleString());
1160-
CmdArgs.push_back("-internal-isystem");
1161-
CmdArgs.push_back(Args.MakeArgString(P));
1162-
} else if (C.getActiveOffloadKinds() == Action::OFK_OpenMP) {
1163-
// TODO: CUDA / HIP include their own headers for some common functions
1164-
// implemented here. We'll need to clean those up so they do not conflict.
1165-
SmallString<128> P(D.ResourceDir);
1166-
llvm::sys::path::append(P, "include");
1167-
llvm::sys::path::append(P, "llvm_libc_wrappers");
1168-
CmdArgs.push_back("-internal-isystem");
1169-
CmdArgs.push_back(Args.MakeArgString(P));
1170-
}
1151+
!Args.hasArg(options::OPT_nobuiltininc) &&
1152+
(C.getActiveOffloadKinds() == Action::OFK_OpenMP)) {
1153+
// TODO: CUDA / HIP include their own headers for some common functions
1154+
// implemented here. We'll need to clean those up so they do not conflict.
1155+
SmallString<128> P(D.ResourceDir);
1156+
llvm::sys::path::append(P, "include");
1157+
llvm::sys::path::append(P, "llvm_libc_wrappers");
1158+
CmdArgs.push_back("-internal-isystem");
1159+
CmdArgs.push_back(Args.MakeArgString(P));
11711160
}
11721161

11731162
// Add system include arguments for all targets but IAMCU.

clang/lib/Driver/ToolChains/Cuda.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,16 @@ void NVPTXToolChain::addClangTargetOptions(
786786
const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
787787
Action::OffloadKind DeviceOffloadingKind) const {}
788788

789+
void NVPTXToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
790+
ArgStringList &CC1Args) const {
791+
if (DriverArgs.hasArg(options::OPT_nostdinc) ||
792+
DriverArgs.hasArg(options::OPT_nostdlibinc))
793+
return;
794+
795+
if (std::optional<std::string> Path = getStdlibIncludePath())
796+
addSystemInclude(DriverArgs, CC1Args, *Path);
797+
}
798+
789799
bool NVPTXToolChain::supportsDebugInfoOption(const llvm::opt::Arg *A) const {
790800
const Option &O = A->getOption();
791801
return (O.matches(options::OPT_gN_Group) &&

clang/lib/Driver/ToolChains/Cuda.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ class LLVM_LIBRARY_VISIBILITY NVPTXToolChain : public ToolChain {
8787
addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
8888
llvm::opt::ArgStringList &CC1Args,
8989
Action::OffloadKind DeviceOffloadKind) const override;
90+
void
91+
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
92+
llvm::opt::ArgStringList &CC1Args) const override;
9093

9194
// Never try to use the integrated assembler with CUDA; always fork out to
9295
// ptxas.

clang/test/Driver/Inputs/basic_gpu_tree/bin/keep

Whitespace-only changes.

clang/test/Driver/Inputs/basic_gpu_tree/include/amdgcn-amd-amdhsa/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)