Skip to content

Commit 776b86b

Browse files
author
z1.cciauto
committed
merge main into amd-staging
2 parents 7f42812 + a27d34b commit 776b86b

File tree

238 files changed

+7455
-2477
lines changed

Some content is hidden

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

238 files changed

+7455
-2477
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ Bug Fixes in This Version
390390

391391
Bug Fixes to Compiler Builtins
392392
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
393+
- Fix an ambiguous reference to the builtin `type_info` (available when using
394+
`-fms-compatibility`) with modules. (#GH38400)
393395

394396
Bug Fixes to Attribute Support
395397
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/ASTContext.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
12901290
// Implicitly-declared type 'struct _GUID'.
12911291
mutable TagDecl *MSGuidTagDecl = nullptr;
12921292

1293+
// Implicitly-declared type 'struct type_info'.
1294+
mutable TagDecl *MSTypeInfoTagDecl = nullptr;
1295+
12931296
/// Keep track of CUDA/HIP device-side variables ODR-used by host code.
12941297
/// This does not include extern shared variables used by device host
12951298
/// functions as addresses of shared variables are per warp, therefore
@@ -2388,6 +2391,15 @@ class ASTContext : public RefCountedBase<ASTContext> {
23882391
return getTagDeclType(MSGuidTagDecl);
23892392
}
23902393

2394+
/// Retrieve the implicitly-predeclared 'struct type_info' declaration.
2395+
TagDecl *getMSTypeInfoTagDecl() const {
2396+
// Lazily create this type on demand - it's only needed for MS builds.
2397+
if (!MSTypeInfoTagDecl) {
2398+
MSTypeInfoTagDecl = buildImplicitRecord("type_info");
2399+
}
2400+
return MSTypeInfoTagDecl;
2401+
}
2402+
23912403
/// Return whether a declaration to a builtin is allowed to be
23922404
/// overloaded/redeclared.
23932405
bool canBuiltinBeRedeclared(const FunctionDecl *) const;

clang/include/clang/AST/DeclID.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ enum PredefinedDeclIDs {
7777
/// The internal '__NSConstantString' tag type.
7878
PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID,
7979

80+
/// The predeclared 'type_info' struct.
81+
PREDEF_DECL_BUILTIN_MS_TYPE_INFO_TAG_ID,
82+
8083
#define BuiltinTemplate(BTName) PREDEF_DECL##BTName##_ID,
8184
#include "clang/Basic/BuiltinTemplates.inc"
8285

clang/include/clang/AST/OpenACCClause.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,23 +837,43 @@ class OpenACCClauseWithVarList : public OpenACCClauseWithExprs {
837837

838838
class OpenACCPrivateClause final
839839
: public OpenACCClauseWithVarList,
840-
private llvm::TrailingObjects<OpenACCPrivateClause, Expr *> {
840+
private llvm::TrailingObjects<OpenACCPrivateClause, Expr *, VarDecl *> {
841841
friend TrailingObjects;
842842

843843
OpenACCPrivateClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
844-
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
844+
ArrayRef<Expr *> VarList,
845+
ArrayRef<VarDecl *> InitRecipes, SourceLocation EndLoc)
845846
: OpenACCClauseWithVarList(OpenACCClauseKind::Private, BeginLoc,
846847
LParenLoc, EndLoc) {
847-
setExprs(getTrailingObjects(VarList.size()), VarList);
848+
assert(VarList.size() == InitRecipes.size());
849+
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
850+
llvm::uninitialized_copy(InitRecipes, getTrailingObjects<VarDecl *>());
848851
}
849852

850853
public:
851854
static bool classof(const OpenACCClause *C) {
852855
return C->getClauseKind() == OpenACCClauseKind::Private;
853856
}
857+
// Gets a list of 'made up' `VarDecl` objects that can be used by codegen to
858+
// ensure that we properly initialize each of these variables.
859+
ArrayRef<VarDecl *> getInitRecipes() {
860+
return ArrayRef<VarDecl *>{getTrailingObjects<VarDecl *>(),
861+
getExprs().size()};
862+
}
863+
864+
ArrayRef<VarDecl *> getInitRecipes() const {
865+
return ArrayRef<VarDecl *>{getTrailingObjects<VarDecl *>(),
866+
getExprs().size()};
867+
}
868+
854869
static OpenACCPrivateClause *
855870
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
856-
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
871+
ArrayRef<Expr *> VarList, ArrayRef<VarDecl *> InitRecipes,
872+
SourceLocation EndLoc);
873+
874+
size_t numTrailingObjects(OverloadToken<Expr *>) const {
875+
return getExprs().size();
876+
}
857877
};
858878

859879
class OpenACCFirstPrivateClause final

clang/include/clang/Basic/Attr.td

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,22 +1059,13 @@ def AVRSignal : InheritableAttr, TargetSpecificAttr<TargetAVR> {
10591059
def AsmLabel : InheritableAttr {
10601060
let Spellings = [CustomKeyword<"asm">, CustomKeyword<"__asm__">];
10611061
let Args = [
1062-
// Label specifies the mangled name for the decl.
1063-
StringArgument<"Label">,
1064-
1065-
// IsLiteralLabel specifies whether the label is literal (i.e. suppresses
1066-
// the global C symbol prefix) or not. If not, the mangle-suppression prefix
1067-
// ('\01') is omitted from the decl name at the LLVM IR level.
1068-
//
1069-
// Non-literal labels are used by some external AST sources like LLDB.
1070-
BoolArgument<"IsLiteralLabel", /*optional=*/0, /*fake=*/1>
1071-
];
1062+
// Label specifies the mangled name for the decl.
1063+
StringArgument<"Label">, ];
10721064
let SemaHandler = 0;
10731065
let Documentation = [AsmLabelDocs];
1074-
let AdditionalMembers =
1075-
[{
1066+
let AdditionalMembers = [{
10761067
bool isEquivalent(AsmLabelAttr *Other) const {
1077-
return getLabel() == Other->getLabel() && getIsLiteralLabel() == Other->getIsLiteralLabel();
1068+
return getLabel() == Other->getLabel();
10781069
}
10791070
}];
10801071
}

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ def warn_drv_fraw_string_literals_in_cxx11 : Warning<
407407
"ignoring '-f%select{no-|}0raw-string-literals', which is only valid for C and C++ standards before C++11">,
408408
InGroup<UnusedCommandLineArgument>;
409409

410+
def err_drv_libclc_not_found : Error<"no libclc library '%0' found in the clang resource directory">;
411+
410412
def err_drv_invalid_malign_branch_EQ : Error<
411413
"invalid argument '%0' to -malign-branch=; each element must be one of: %1">;
412414

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13531,7 +13531,8 @@ def err_acc_device_type_multiple_archs
1353113531
def warn_acc_var_referenced_lacks_op
1353213532
: Warning<"variable of type %0 referenced in OpenACC '%1' clause does not "
1353313533
"have a %enum_select<AccVarReferencedReason>{%DefCtor{default "
13534-
"constructor}|%Dtor{destructor}}2; reference has no effect">,
13534+
"constructor}|%CopyCtor{copy constructor}|%Dtor{destructor}}2; "
13535+
"reference has no effect">,
1353513536
InGroup<DiagGroup<"openacc-var-lacks-operation">>,
1353613537
DefaultError;
1353713538

clang/include/clang/Driver/CommonArgs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs,
236236
StringRef BitcodeSuffix, const llvm::Triple &Triple,
237237
const ToolChain &HostTC);
238238

239+
void addOpenCLBuiltinsLib(const Driver &D, const llvm::opt::ArgList &DriverArgs,
240+
llvm::opt::ArgStringList &CC1Args);
241+
239242
void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
240243
const llvm::opt::ArgList &Args,
241244
llvm::opt::ArgStringList &CmdArgs,

clang/include/clang/Driver/Options.td

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,21 @@ def fno_hip_emit_relocatable : Flag<["-"], "fno-hip-emit-relocatable">,
14271427
HelpText<"Do not override toolchain to compile HIP source to relocatable">;
14281428
}
14291429

1430+
// Clang specific/exclusive options for OpenACC.
1431+
def openacc_macro_override
1432+
: Separate<["-"], "fexperimental-openacc-macro-override">,
1433+
Visibility<[ClangOption, CC1Option]>,
1434+
Group<f_Group>,
1435+
HelpText<"Overrides the _OPENACC macro value for experimental testing "
1436+
"during OpenACC support development">;
1437+
def openacc_macro_override_EQ
1438+
: Joined<["-"], "fexperimental-openacc-macro-override=">,
1439+
Alias<openacc_macro_override>;
1440+
1441+
// End Clang specific/exclusive options for OpenACC.
1442+
1443+
def libclc_lib_EQ : Joined<["--"], "libclc-lib=">, Group<opencl_Group>,
1444+
HelpText<"Namespec of libclc OpenCL bitcode library to link">;
14301445
def libomptarget_amdgpu_bc_path_EQ : Joined<["--"], "libomptarget-amdgpu-bc-path=">, Group<i_Group>,
14311446
HelpText<"Path to libomptarget-amdgcn bitcode library">;
14321447
def libomptarget_amdgcn_bc_path_EQ : Joined<["--"], "libomptarget-amdgcn-bc-path=">, Group<i_Group>,

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ class SemaOpenACC : public SemaBase {
176176

177177
void checkFor();
178178

179-
// void checkRangeFor(); ?? ERICH
180-
// const ValueDecl *checkInit();
181-
// void checkCond(const ValueDecl *Init);
182-
// void checkInc(const ValueDecl *Init);
183179
public:
184180
// Checking for non-instantiation version of a Range-for.
185181
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
@@ -241,6 +237,10 @@ class SemaOpenACC : public SemaBase {
241237
SourceLocation ClauseLoc,
242238
ArrayRef<const OpenACCClause *> Clauses);
243239

240+
// Creates a VarDecl with a proper default init for the purposes of a
241+
// `private` clause, so it can be used to generate a recipe later.
242+
VarDecl *CreateInitRecipe(const Expr *VarExpr);
243+
244244
public:
245245
ComputeConstructInfo &getActiveComputeConstructInfo() {
246246
return ActiveComputeConstructInfo;

0 commit comments

Comments
 (0)