Skip to content

Commit 9fbe776

Browse files
authored
Merge branch 'main' into bitreverse_i32_i64_avx512_gfni
2 parents f5dbf66 + 5ae9ffb commit 9fbe776

File tree

100 files changed

+6395
-1373
lines changed

Some content is hidden

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

100 files changed

+6395
-1373
lines changed

clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ void RenamerClangTidyCheck::checkNamedDecl(const NamedDecl *Decl,
489489
}
490490

491491
Failure.Info = std::move(Info);
492-
addUsage(Decl, Range);
492+
addUsage(Decl, Range, &SourceMgr);
493493
}
494494

495495
void RenamerClangTidyCheck::check(const MatchFinder::MatchResult &Result) {

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ Changes in existing checks
268268
<clang-tidy/checks/readability/identifier-naming>` check in `GetConfigPerFile`
269269
mode by resolving symbolic links to header files. Fixed handling of Hungarian
270270
Prefix when configured to `LowerCase`. Added support for renaming designated
271-
initializers.
271+
initializers. Added support for renaming macro arguments.
272272

273273
- Improved :doc:`readability-implicit-bool-conversion
274274
<clang-tidy/checks/readability/implicit-bool-conversion>` check to provide

clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ USER_NS::object g_s2;
108108
// NO warnings or fixes expected as USER_NS and object are declared in a header file
109109

110110
SYSTEM_MACRO(var1);
111-
// NO warnings or fixes expected as var1 is from macro expansion
111+
// CHECK-MESSAGES: :[[@LINE-1]]:14: warning: invalid case style for global variable 'var1' [readability-identifier-naming]
112+
// CHECK-FIXES: {{^}}SYSTEM_MACRO(g_var1);
112113

113114
USER_MACRO(var2);
114-
// NO warnings or fixes expected as var2 is declared in a macro expansion
115+
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: invalid case style for global variable 'var2' [readability-identifier-naming]
116+
// CHECK-FIXES: {{^}}USER_MACRO(g_var2);
115117

116118
#define BLA int FOO_bar
117119
BLA;
@@ -602,9 +604,20 @@ static void static_Function() {
602604
// CHECK-FIXES: {{^}}#define MY_TEST_MACRO(X) X()
603605

604606
void MY_TEST_Macro(function) {}
605-
// CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {}
606-
}
607-
}
607+
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: invalid case style for global function 'function' [readability-identifier-naming]
608+
// CHECK-FIXES: {{^}}void MY_TEST_MACRO(Function) {}
609+
610+
#define MY_CAT_IMPL(l, r) l ## r
611+
#define MY_CAT(l, r) MY_CAT_IMPL(l, r)
612+
#define MY_MACRO2(foo) int MY_CAT(awesome_, MY_CAT(foo, __COUNTER__)) = 0
613+
#define MY_MACRO3(foo) int MY_CAT(awesome_, foo) = 0
614+
MY_MACRO2(myglob);
615+
MY_MACRO3(myglob);
616+
// No suggestions should occur even though the resulting decl of awesome_myglob#
617+
// or awesome_myglob are not entirely within a macro argument.
618+
619+
} // namespace InlineNamespace
620+
} // namespace FOO_NS
608621

609622
template <typename t_t> struct a {
610623
// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: invalid case style for struct 'a'

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,11 @@ Bug Fixes to C++ Support
520520
- Fix an issue caused by not handling invalid cases when substituting into the parameter mapping of a constraint. Fixes (#GH86757).
521521
- Fixed a bug that prevented member function templates of class templates declared with a deduced return type
522522
from being explicitly specialized for a given implicit instantiation of the class template.
523-
- Fixed a crash when ``this`` is used in a dependent class scope function template specialization
524-
that instantiates to a static member function.
525523

526524
- Fix crash when inheriting from a cv-qualified type. Fixes:
527525
(`#35603 <https://github.com/llvm/llvm-project/issues/35603>`_)
528526
- Fix a crash when the using enum declaration uses an anonymous enumeration. Fixes (#GH86790).
527+
- Handled an edge case in ``getFullyPackExpandedSize`` so that we now avoid a false-positive diagnostic. (#GH84220)
529528
- Clang now correctly tracks type dependence of by-value captures in lambdas with an explicit
530529
object parameter.
531530
Fixes (#GH70604), (#GH79754), (#GH84163), (#GH84425), (#GH86054), (#GH86398), and (#GH86399).

clang/include/clang/AST/OpenACCClause.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,36 @@ class OpenACCClauseWithParams : public OpenACCClause {
5151
SourceLocation getLParenLoc() const { return LParenLoc; }
5252
};
5353

54+
/// A 'default' clause, has the optional 'none' or 'present' argument.
55+
class OpenACCDefaultClause : public OpenACCClauseWithParams {
56+
friend class ASTReaderStmt;
57+
friend class ASTWriterStmt;
58+
59+
OpenACCDefaultClauseKind DefaultClauseKind;
60+
61+
protected:
62+
OpenACCDefaultClause(OpenACCDefaultClauseKind K, SourceLocation BeginLoc,
63+
SourceLocation LParenLoc, SourceLocation EndLoc)
64+
: OpenACCClauseWithParams(OpenACCClauseKind::Default, BeginLoc, LParenLoc,
65+
EndLoc),
66+
DefaultClauseKind(K) {
67+
assert((DefaultClauseKind == OpenACCDefaultClauseKind::None ||
68+
DefaultClauseKind == OpenACCDefaultClauseKind::Present) &&
69+
"Invalid Clause Kind");
70+
}
71+
72+
public:
73+
OpenACCDefaultClauseKind getDefaultClauseKind() const {
74+
return DefaultClauseKind;
75+
}
76+
77+
static OpenACCDefaultClause *Create(const ASTContext &C,
78+
OpenACCDefaultClauseKind K,
79+
SourceLocation BeginLoc,
80+
SourceLocation LParenLoc,
81+
SourceLocation EndLoc);
82+
};
83+
5484
template <class Impl> class OpenACCClauseVisitor {
5585
Impl &getDerived() { return static_cast<Impl &>(*this); }
5686

@@ -66,6 +96,8 @@ template <class Impl> class OpenACCClauseVisitor {
6696

6797
switch (C->getClauseKind()) {
6898
case OpenACCClauseKind::Default:
99+
VisitOpenACCDefaultClause(*cast<OpenACCDefaultClause>(C));
100+
return;
69101
case OpenACCClauseKind::Finalize:
70102
case OpenACCClauseKind::IfPresent:
71103
case OpenACCClauseKind::Seq:
@@ -112,6 +144,10 @@ template <class Impl> class OpenACCClauseVisitor {
112144
}
113145
llvm_unreachable("Invalid Clause kind");
114146
}
147+
148+
void VisitOpenACCDefaultClause(const OpenACCDefaultClause &Clause) {
149+
return getDerived().VisitOpenACCDefaultClause(Clause);
150+
}
115151
};
116152

117153
class OpenACCClausePrinter final
@@ -128,6 +164,8 @@ class OpenACCClausePrinter final
128164
}
129165
}
130166
OpenACCClausePrinter(raw_ostream &OS) : OS(OS) {}
167+
168+
void VisitOpenACCDefaultClause(const OpenACCDefaultClause &Clause);
131169
};
132170

133171
} // namespace clang

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,9 @@ def MultiGPU: DiagGroup<"multi-gpu">;
14121412
// libc and the CRT to be skipped.
14131413
def AVRRtlibLinkingQuirks : DiagGroup<"avr-rtlib-linking-quirks">;
14141414

1415+
// A warning group related to AArch64 SME function attribues.
1416+
def AArch64SMEAttributes : DiagGroup<"aarch64-sme-attributes">;
1417+
14151418
// A warning group for things that will change semantics in the future.
14161419
def FutureCompat : DiagGroup<"future-compat">;
14171420

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3755,6 +3755,16 @@ def err_sme_definition_using_za_in_non_sme_target : Error<
37553755
"function using ZA state requires 'sme'">;
37563756
def err_sme_definition_using_zt0_in_non_sme2_target : Error<
37573757
"function using ZT0 state requires 'sme2'">;
3758+
def warn_sme_streaming_pass_return_vl_to_non_streaming : Warning<
3759+
"passing a VL-dependent argument to/from a function that has a different"
3760+
" streaming-mode. The streaming and non-streaming vector lengths may be"
3761+
" different">,
3762+
InGroup<AArch64SMEAttributes>, DefaultIgnore;
3763+
def warn_sme_locally_streaming_has_vl_args_returns : Warning<
3764+
"passing/returning a VL-dependent argument to/from a __arm_locally_streaming"
3765+
" function. The streaming and non-streaming vector"
3766+
" lengths may be different">,
3767+
InGroup<AArch64SMEAttributes>, DefaultIgnore;
37583768
def err_conflicting_attributes_arm_state : Error<
37593769
"conflicting attributes for state '%0'">;
37603770
def err_sme_streaming_cannot_be_multiversioned : Error<
@@ -12255,6 +12265,10 @@ def err_acc_construct_appertainment
1225512265
"be used in a statement context">;
1225612266
def err_acc_clause_appertainment
1225712267
: Error<"OpenACC '%1' clause is not valid on '%0' directive">;
12268+
def err_acc_duplicate_clause_disallowed
12269+
: Error<"OpenACC '%1' clause cannot appear more than once on a '%0' "
12270+
"directive">;
12271+
def note_acc_previous_clause_here : Note<"previous clause is here">;
1225812272
def err_acc_branch_in_out_compute_construct
1225912273
: Error<"invalid %select{branch|return|throw}0 %select{out of|into}1 "
1226012274
"OpenACC Compute Construct">;

clang/include/clang/Basic/OpenACCKinds.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,29 @@ enum class OpenACCDefaultClauseKind {
419419
Invalid,
420420
};
421421

422+
template <typename StreamTy>
423+
inline StreamTy &printOpenACCDefaultClauseKind(StreamTy &Out,
424+
OpenACCDefaultClauseKind K) {
425+
switch (K) {
426+
case OpenACCDefaultClauseKind::None:
427+
return Out << "none";
428+
case OpenACCDefaultClauseKind::Present:
429+
return Out << "present";
430+
case OpenACCDefaultClauseKind::Invalid:
431+
return Out << "<invalid>";
432+
}
433+
}
434+
435+
inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &Out,
436+
OpenACCDefaultClauseKind K) {
437+
return printOpenACCDefaultClauseKind(Out, K);
438+
}
439+
440+
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &Out,
441+
OpenACCDefaultClauseKind K) {
442+
return printOpenACCDefaultClauseKind(Out, K);
443+
}
444+
422445
enum class OpenACCReductionOperator {
423446
/// '+'.
424447
Addition,

clang/include/clang/Sema/Sema.h

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ class PseudoObjectExpr;
184184
class QualType;
185185
class SemaHLSL;
186186
class SemaOpenACC;
187+
class SemaSYCL;
187188
class StandardConversionSequence;
188189
class Stmt;
189190
class StringLiteral;
@@ -467,7 +468,6 @@ class Sema final : public SemaBase {
467468
// 37. Name Lookup for RISC-V Vector Intrinsic (SemaRISCVVectorLookup.cpp)
468469
// 38. CUDA (SemaCUDA.cpp)
469470
// 39. OpenMP Directives and Clauses (SemaOpenMP.cpp)
470-
// 40. SYCL Constructs (SemaSYCL.cpp)
471471

472472
/// \name Semantic Analysis
473473
/// Implementations are in Sema.cpp
@@ -974,6 +974,11 @@ class Sema final : public SemaBase {
974974
return *OpenACCPtr;
975975
}
976976

977+
SemaSYCL &SYCL() {
978+
assert(SYCLPtr);
979+
return *SYCLPtr;
980+
}
981+
977982
protected:
978983
friend class Parser;
979984
friend class InitializationSequence;
@@ -1006,6 +1011,7 @@ class Sema final : public SemaBase {
10061011

10071012
std::unique_ptr<SemaHLSL> HLSLPtr;
10081013
std::unique_ptr<SemaOpenACC> OpenACCPtr;
1014+
std::unique_ptr<SemaSYCL> SYCLPtr;
10091015

10101016
///@}
10111017

@@ -5439,8 +5445,7 @@ class Sema final : public SemaBase {
54395445

54405446
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R,
54415447
bool NeedsADL,
5442-
bool AcceptInvalidDecl = false,
5443-
bool NeedUnresolved = false);
5448+
bool AcceptInvalidDecl = false);
54445449
ExprResult BuildDeclarationNameExpr(
54455450
const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
54465451
NamedDecl *FoundD = nullptr,
@@ -5456,15 +5461,6 @@ class Sema final : public SemaBase {
54565461
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind);
54575462
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val);
54585463

5459-
ExprResult BuildSYCLUniqueStableNameExpr(SourceLocation OpLoc,
5460-
SourceLocation LParen,
5461-
SourceLocation RParen,
5462-
TypeSourceInfo *TSI);
5463-
ExprResult ActOnSYCLUniqueStableNameExpr(SourceLocation OpLoc,
5464-
SourceLocation LParen,
5465-
SourceLocation RParen,
5466-
ParsedType ParsedTy);
5467-
54685464
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc);
54695465

54705466
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
@@ -6592,10 +6588,7 @@ class Sema final : public SemaBase {
65926588
SourceLocation RParenLoc);
65936589

65946590
//// ActOnCXXThis - Parse 'this' pointer.
6595-
ExprResult ActOnCXXThis(SourceLocation Loc);
6596-
6597-
/// Check whether the type of 'this' is valid in the current context.
6598-
bool CheckCXXThisType(SourceLocation Loc, QualType Type);
6591+
ExprResult ActOnCXXThis(SourceLocation loc);
65996592

66006593
/// Build a CXXThisExpr and mark it referenced in the current context.
66016594
Expr *BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit);
@@ -14520,44 +14513,6 @@ class Sema final : public SemaBase {
1452014513
OpenMPDirectiveKind CancelRegion);
1452114514

1452214515
///@}
14523-
14524-
//
14525-
//
14526-
// -------------------------------------------------------------------------
14527-
//
14528-
//
14529-
14530-
/// \name SYCL Constructs
14531-
/// Implementations are in SemaSYCL.cpp
14532-
///@{
14533-
14534-
public:
14535-
/// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
14536-
/// context is "used as device code".
14537-
///
14538-
/// - If CurLexicalContext is a kernel function or it is known that the
14539-
/// function will be emitted for the device, emits the diagnostics
14540-
/// immediately.
14541-
/// - If CurLexicalContext is a function and we are compiling
14542-
/// for the device, but we don't know that this function will be codegen'ed
14543-
/// for devive yet, creates a diagnostic which is emitted if and when we
14544-
/// realize that the function will be codegen'ed.
14545-
///
14546-
/// Example usage:
14547-
///
14548-
/// Diagnose __float128 type usage only from SYCL device code if the current
14549-
/// target doesn't support it
14550-
/// if (!S.Context.getTargetInfo().hasFloat128Type() &&
14551-
/// S.getLangOpts().SYCLIsDevice)
14552-
/// SYCLDiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
14553-
SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc,
14554-
unsigned DiagID);
14555-
14556-
void deepTypeCheckForSYCLDevice(SourceLocation UsedAt,
14557-
llvm::DenseSet<QualType> Visited,
14558-
ValueDecl *DeclToCheck);
14559-
14560-
///@}
1456114516
};
1456214517

1456314518
DeductionFailureInfo

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "clang/Basic/SourceLocation.h"
2020
#include "clang/Sema/Ownership.h"
2121
#include "clang/Sema/SemaBase.h"
22+
#include <variant>
2223

2324
namespace clang {
2425
class OpenACCClause;
@@ -35,7 +36,11 @@ class SemaOpenACC : public SemaBase {
3536
SourceRange ClauseRange;
3637
SourceLocation LParenLoc;
3738

38-
// TODO OpenACC: Add variant here to store details of individual clauses.
39+
struct DefaultDetails {
40+
OpenACCDefaultClauseKind DefaultClauseKind;
41+
};
42+
43+
std::variant<DefaultDetails> Details;
3944

4045
public:
4146
OpenACCParsedClause(OpenACCDirectiveKind DirKind,
@@ -52,8 +57,20 @@ class SemaOpenACC : public SemaBase {
5257

5358
SourceLocation getEndLoc() const { return ClauseRange.getEnd(); }
5459

60+
OpenACCDefaultClauseKind getDefaultClauseKind() const {
61+
assert(ClauseKind == OpenACCClauseKind::Default &&
62+
"Parsed clause is not a default clause");
63+
return std::get<DefaultDetails>(Details).DefaultClauseKind;
64+
}
65+
5566
void setLParenLoc(SourceLocation EndLoc) { LParenLoc = EndLoc; }
5667
void setEndLoc(SourceLocation EndLoc) { ClauseRange.setEnd(EndLoc); }
68+
69+
void setDefaultDetails(OpenACCDefaultClauseKind DefKind) {
70+
assert(ClauseKind == OpenACCClauseKind::Default &&
71+
"Parsed clause is not a default clause");
72+
Details = DefaultDetails{DefKind};
73+
}
5774
};
5875

5976
SemaOpenACC(Sema &S);

0 commit comments

Comments
 (0)