Skip to content

Commit 52b4e0f

Browse files
authored
merge main into amd-staging (llvm#1897)
2 parents 26395f7 + 4b34fd8 commit 52b4e0f

File tree

210 files changed

+7484
-5505
lines changed

Some content is hidden

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

210 files changed

+7484
-5505
lines changed

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def find_compilation_database(path: str) -> str:
8787

8888

8989
def get_tidy_invocation(
90-
f: str,
90+
f: Optional[str],
9191
clang_tidy_binary: str,
9292
checks: str,
9393
tmpdir: Optional[str],
@@ -147,7 +147,8 @@ def get_tidy_invocation(
147147
start.append(f"--warnings-as-errors={warnings_as_errors}")
148148
if allow_no_checks:
149149
start.append("--allow-no-checks")
150-
start.append(f)
150+
if f:
151+
start.append(f)
151152
return start
152153

153154

@@ -490,7 +491,7 @@ async def main() -> None:
490491

491492
try:
492493
invocation = get_tidy_invocation(
493-
"",
494+
None,
494495
clang_tidy_binary,
495496
args.checks,
496497
None,

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ Improvements to clang-tidy
103103
- Fixed bug in :program:`clang-tidy` by which `HeaderFilterRegex` did not take
104104
effect when passed via the `.clang-tidy` file.
105105

106+
- Fixed bug in :program:`run_clang_tidy.py` where the program would not
107+
correctly display the checks enabled by the top-level `.clang-tidy` file.
108+
106109
New checks
107110
^^^^^^^^^^
108111

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ Arm and AArch64 Support
628628
- The ``+nosimd`` attribute is now fully supported for ARM. Previously, this had no effect when being used with
629629
ARM targets, however this will now disable NEON instructions being generated. The ``simd`` option is
630630
also now printed when the ``--print-supported-extensions`` option is used.
631+
- When a feature that depends on NEON (``simd``) is used, NEON is now automatically enabled.
632+
- When NEON is disabled (``+nosimd``), all features that depend on NEON will now be disabled.
631633

632634
- Support for __ptrauth type qualifier has been added.
633635

clang/include/clang/AST/OperationKinds.def

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ CAST_OPERATION(ArrayToPointerDecay)
119119
CAST_OPERATION(FunctionToPointerDecay)
120120

121121
/// CK_NullToPointer - Null pointer constant to pointer, ObjC
122-
/// pointer, or block pointer. The result of this conversion can
123-
/// still be a null pointer constant if it has type std::nullptr_t.
122+
/// pointer, block pointer, or std::nullptr_t.
124123
/// (void*) 0
125124
/// void (^block)() = 0;
126125
CAST_OPERATION(NullToPointer)

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ def err_modules_embed_file_not_found :
260260
DefaultFatal;
261261
def err_module_header_file_not_found :
262262
Error<"module header file '%0' not found">, DefaultFatal;
263+
def err_frontend_action_unsupported_input_format
264+
: Error<"%0 does not support input file format of file '%1': "
265+
"'%select{Source|ModuleMap|Precompiled|Unknown}2'">,
266+
DefaultFatal;
263267

264268
def err_test_module_file_extension_version : Error<
265269
"test module file extension '%0' has different version (%1.%2) than expected "

clang/include/clang/Basic/HeaderInclude.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@ enum HeaderIncludeFormatKind { HIFMT_None, HIFMT_Textual, HIFMT_JSON };
2323

2424
/// Whether header information is filtered or not. If HIFIL_Only_Direct_System
2525
/// is used, only information on system headers directly included from
26-
/// non-system headers is emitted.
27-
enum HeaderIncludeFilteringKind { HIFIL_None, HIFIL_Only_Direct_System };
26+
/// non-system files is emitted. The HIFIL_Direct_Per_File filtering shows the
27+
/// direct imports and includes for each non-system source and header file
28+
/// separately.
29+
enum HeaderIncludeFilteringKind {
30+
HIFIL_None,
31+
HIFIL_Only_Direct_System,
32+
HIFIL_Direct_Per_File
33+
};
2834

2935
inline HeaderIncludeFormatKind
3036
stringToHeaderIncludeFormatKind(const char *Str) {
@@ -40,6 +46,7 @@ inline bool stringToHeaderIncludeFiltering(const char *Str,
4046
llvm::StringSwitch<std::pair<bool, HeaderIncludeFilteringKind>>(Str)
4147
.Case("none", {true, HIFIL_None})
4248
.Case("only-direct-system", {true, HIFIL_Only_Direct_System})
49+
.Case("direct-per-file", {true, HIFIL_Direct_Per_File})
4350
.Default({false, HIFIL_None});
4451
Kind = P.second;
4552
return P.first;
@@ -64,6 +71,8 @@ headerIncludeFilteringKindToString(HeaderIncludeFilteringKind K) {
6471
return "none";
6572
case HIFIL_Only_Direct_System:
6673
return "only-direct-system";
74+
case HIFIL_Direct_Per_File:
75+
return "direct-per-file";
6776
}
6877
llvm_unreachable("Unknown HeaderIncludeFilteringKind enum");
6978
}

clang/include/clang/CIR/Dialect/IR/CIRTypes.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,18 @@ def CIR_ArrayType : CIR_Type<"Array", "array",
292292
`CIR.array` represents C/C++ constant arrays.
293293
}];
294294

295-
let parameters = (ins "mlir::Type":$eltType, "uint64_t":$size);
295+
let parameters = (ins "mlir::Type":$elementType, "uint64_t":$size);
296296

297297
let builders = [
298298
TypeBuilderWithInferredContext<(ins
299-
"mlir::Type":$eltType, "uint64_t":$size
299+
"mlir::Type":$elementType, "uint64_t":$size
300300
), [{
301-
return $_get(eltType.getContext(), eltType, size);
301+
return $_get(elementType.getContext(), elementType, size);
302302
}]>,
303303
];
304304

305305
let assemblyFormat = [{
306-
`<` $eltType `x` $size `>`
306+
`<` $elementType `x` $size `>`
307307
}];
308308
}
309309

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7953,7 +7953,8 @@ def header_include_format_EQ : Joined<["-"], "header-include-format=">,
79537953
MarshallingInfoEnum<DependencyOutputOpts<"HeaderIncludeFormat">, "HIFMT_Textual">;
79547954
def header_include_filtering_EQ : Joined<["-"], "header-include-filtering=">,
79557955
HelpText<"set the flag that enables filtering header information">,
7956-
Values<"none,only-direct-system">, NormalizedValues<["HIFIL_None", "HIFIL_Only_Direct_System"]>,
7956+
Values<"none,only-direct-system,direct-per-file">,
7957+
NormalizedValues<["HIFIL_None", "HIFIL_Only_Direct_System", "HIFIL_Direct_Per_File"]>,
79577958
MarshallingInfoEnum<DependencyOutputOpts<"HeaderIncludeFiltering">, "HIFIL_None">;
79587959
def show_includes : Flag<["--"], "show-includes">,
79597960
HelpText<"Print cl.exe style /showIncludes to stdout">;

clang/include/clang/Frontend/FrontendActions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ class GenerateModuleFromModuleMapAction : public GenerateModuleAction {
156156
/// files) for C++20 Named Modules.
157157
class GenerateModuleInterfaceAction : public GenerateModuleAction {
158158
protected:
159+
bool PrepareToExecuteAction(CompilerInstance &CI) override;
159160
bool BeginSourceFileAction(CompilerInstance &CI) override;
160161

161162
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -125,38 +125,78 @@ class SemaOpenACC : public SemaBase {
125125
/// 'loop' clause enforcement, where this is 'blocked' by a compute construct.
126126
llvm::SmallVector<OpenACCReductionClause *> ActiveReductionClauses;
127127

128-
// Type to check the info about the 'for stmt'.
129-
struct ForStmtBeginChecker {
128+
// Type to check the 'for' (or range-for) statement for compatibility with the
129+
// 'loop' directive.
130+
class ForStmtBeginChecker {
130131
SemaOpenACC &SemaRef;
131132
SourceLocation ForLoc;
132-
bool IsRangeFor = false;
133-
std::optional<const CXXForRangeStmt *> RangeFor = nullptr;
134-
const Stmt *Init = nullptr;
135-
bool InitChanged = false;
136-
std::optional<const Stmt *> Cond = nullptr;
137-
std::optional<const Stmt *> Inc = nullptr;
133+
bool IsInstantiation = false;
134+
135+
struct RangeForInfo {
136+
const CXXForRangeStmt *Uninstantiated = nullptr;
137+
const CXXForRangeStmt *CurrentVersion = nullptr;
138+
// GCC 7.x requires this constructor, else the construction of variant
139+
// doesn't work correctly.
140+
RangeForInfo() : Uninstantiated{nullptr}, CurrentVersion{nullptr} {}
141+
RangeForInfo(const CXXForRangeStmt *Uninst, const CXXForRangeStmt *Cur)
142+
: Uninstantiated{Uninst}, CurrentVersion{Cur} {}
143+
};
144+
145+
struct ForInfo {
146+
const Stmt *Init = nullptr;
147+
const Stmt *Condition = nullptr;
148+
const Stmt *Increment = nullptr;
149+
};
150+
151+
struct CheckForInfo {
152+
ForInfo Uninst;
153+
ForInfo Current;
154+
};
155+
156+
std::variant<RangeForInfo, CheckForInfo> Info;
138157
// Prevent us from checking 2x, which can happen with collapse & tile.
139158
bool AlreadyChecked = false;
140159

141-
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
142-
std::optional<const CXXForRangeStmt *> S)
143-
: SemaRef(SemaRef), ForLoc(ForLoc), IsRangeFor(true), RangeFor(S) {}
160+
void checkRangeFor();
161+
162+
bool checkForInit(const Stmt *InitStmt, const ValueDecl *&InitVar,
163+
bool Diag);
164+
bool checkForCond(const Stmt *CondStmt, const ValueDecl *InitVar,
165+
bool Diag);
166+
bool checkForInc(const Stmt *IncStmt, const ValueDecl *InitVar, bool Diag);
144167

168+
void checkFor();
169+
170+
// void checkRangeFor(); ?? ERICH
171+
// const ValueDecl *checkInit();
172+
// void checkCond(const ValueDecl *Init);
173+
// void checkInc(const ValueDecl *Init);
174+
public:
175+
// Checking for non-instantiation version of a Range-for.
145176
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
146-
const Stmt *I, bool InitChanged,
147-
std::optional<const Stmt *> C,
148-
std::optional<const Stmt *> Inc)
149-
: SemaRef(SemaRef), ForLoc(ForLoc), IsRangeFor(false), Init(I),
150-
InitChanged(InitChanged), Cond(C), Inc(Inc) {}
151-
// Do the checking for the For/Range-For. Currently this implements the 'not
152-
// seq' restrictions only, and should be called either if we know we are a
153-
// top-level 'for' (the one associated via associated-stmt), or extended via
154-
// 'collapse'.
155-
void check();
177+
const CXXForRangeStmt *RangeFor)
178+
: SemaRef(SemaRef), ForLoc(ForLoc), IsInstantiation(false),
179+
Info(RangeForInfo{nullptr, RangeFor}) {}
180+
// Checking for an instantiation of the range-for.
181+
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
182+
const CXXForRangeStmt *OldRangeFor,
183+
const CXXForRangeStmt *RangeFor)
184+
: SemaRef(SemaRef), ForLoc(ForLoc), IsInstantiation(true),
185+
Info(RangeForInfo{OldRangeFor, RangeFor}) {}
186+
// Checking for a non-instantiation version of a traditional for.
187+
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
188+
const Stmt *Init, const Stmt *Cond, const Stmt *Inc)
189+
: SemaRef(SemaRef), ForLoc(ForLoc), IsInstantiation(false),
190+
Info(CheckForInfo{{}, {Init, Cond, Inc}}) {}
191+
// Checking for an instantiation version of a traditional for.
192+
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
193+
const Stmt *OldInit, const Stmt *OldCond,
194+
const Stmt *OldInc, const Stmt *Init, const Stmt *Cond,
195+
const Stmt *Inc)
196+
: SemaRef(SemaRef), ForLoc(ForLoc), IsInstantiation(true),
197+
Info(CheckForInfo{{OldInit, OldCond, OldInc}, {Init, Cond, Inc}}) {}
156198

157-
const ValueDecl *checkInit();
158-
void checkCond();
159-
void checkInc(const ValueDecl *Init);
199+
void check();
160200
};
161201

162202
/// Helper function for checking the 'for' and 'range for' stmts.

0 commit comments

Comments
 (0)