aboutsummaryrefslogtreecommitdiff
path: root/clang/include
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/AST/ASTContext.h10
-rw-r--r--clang/include/clang/AST/ASTNodeTraverser.h2
-rw-r--r--clang/include/clang/AST/CanonicalType.h6
-rw-r--r--clang/include/clang/AST/DeclCXX.h2
-rw-r--r--clang/include/clang/AST/NestedNameSpecifierBase.h3
-rw-r--r--clang/include/clang/AST/OpenACCClause.h62
-rw-r--r--clang/include/clang/AST/OpenMPClause.h64
-rw-r--r--clang/include/clang/AST/RecursiveASTVisitor.h5
-rw-r--r--clang/include/clang/AST/Type.h18
-rw-r--r--clang/include/clang/AST/TypeBase.h60
-rw-r--r--clang/include/clang/AST/TypeLoc.h17
-rw-r--r--clang/include/clang/AST/TypeProperties.td2
-rw-r--r--clang/include/clang/ASTMatchers/ASTMatchersInternal.h2
-rw-r--r--clang/include/clang/Basic/Attr.td35
-rw-r--r--clang/include/clang/Basic/AttrDocs.td61
-rw-r--r--clang/include/clang/Basic/Builtins.td12
-rw-r--r--clang/include/clang/Basic/BuiltinsX86.td105
-rw-r--r--clang/include/clang/Basic/DiagnosticGroups.td1
-rw-r--r--clang/include/clang/Basic/DiagnosticParseKinds.td2
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td57
-rw-r--r--clang/include/clang/Basic/DiagnosticSerializationKinds.td4
-rw-r--r--clang/include/clang/Basic/LangOptions.def2
-rw-r--r--clang/include/clang/Basic/LangOptions.h9
-rw-r--r--clang/include/clang/Basic/LangStandard.h7
-rw-r--r--clang/include/clang/Basic/LangStandards.def90
-rw-r--r--clang/include/clang/Basic/OpenACCKinds.h2
-rw-r--r--clang/include/clang/Basic/TargetInfo.h19
-rw-r--r--clang/include/clang/Basic/arm_mve.td24
-rw-r--r--clang/include/clang/Basic/arm_mve_defs.td7
-rw-r--r--clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h8
-rw-r--r--clang/include/clang/CIR/Dialect/IR/CIRAttrConstraints.td29
-rw-r--r--clang/include/clang/CIR/Dialect/IR/CIRAttrs.td66
-rw-r--r--clang/include/clang/CIR/Dialect/IR/CIRDialect.td1
-rw-r--r--clang/include/clang/CIR/Dialect/IR/CIROps.td200
-rw-r--r--clang/include/clang/CIR/Dialect/IR/CIROpsEnums.h14
-rw-r--r--clang/include/clang/CIR/MissingFeatures.h21
-rw-r--r--clang/include/clang/Driver/Distro.h3
-rw-r--r--clang/include/clang/Driver/Options.td22
-rw-r--r--clang/include/clang/ExtractAPI/API.h22
-rw-r--r--clang/include/clang/Sema/Sema.h22
-rw-r--r--clang/include/clang/Sema/SemaHLSL.h1
-rw-r--r--clang/include/clang/Sema/SemaOpenACC.h21
-rw-r--r--clang/include/clang/Sema/SemaOpenMP.h3
-rw-r--r--clang/include/clang/Sema/Template.h4
-rw-r--r--clang/include/clang/StaticAnalyzer/Checkers/Checkers.td8
-rw-r--r--clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h4
-rw-r--r--clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h5
47 files changed, 830 insertions, 314 deletions
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 78220d4..33aa2d3 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -2874,11 +2874,11 @@ public:
/// returned type is guaranteed to be free of any of these, allowing two
/// canonical types to be compared for exact equality with a simple pointer
/// comparison.
- CanQualType getCanonicalType(QualType T) const {
+ static CanQualType getCanonicalType(QualType T) {
return CanQualType::CreateUnsafe(T.getCanonicalType());
}
- const Type *getCanonicalType(const Type *T) const {
+ static const Type *getCanonicalType(const Type *T) {
return T->getCanonicalTypeInternal().getTypePtr();
}
@@ -2890,10 +2890,10 @@ public:
CanQualType getCanonicalParamType(QualType T) const;
/// Determine whether the given types \p T1 and \p T2 are equivalent.
- bool hasSameType(QualType T1, QualType T2) const {
+ static bool hasSameType(QualType T1, QualType T2) {
return getCanonicalType(T1) == getCanonicalType(T2);
}
- bool hasSameType(const Type *T1, const Type *T2) const {
+ static bool hasSameType(const Type *T1, const Type *T2) {
return getCanonicalType(T1) == getCanonicalType(T2);
}
@@ -2921,7 +2921,7 @@ public:
/// Determine whether the given types are equivalent after
/// cvr-qualifiers have been removed.
- bool hasSameUnqualifiedType(QualType T1, QualType T2) const {
+ static bool hasSameUnqualifiedType(QualType T1, QualType T2) {
return getCanonicalType(T1).getTypePtr() ==
getCanonicalType(T2).getTypePtr();
}
diff --git a/clang/include/clang/AST/ASTNodeTraverser.h b/clang/include/clang/AST/ASTNodeTraverser.h
index 0921604..e74bb72 100644
--- a/clang/include/clang/AST/ASTNodeTraverser.h
+++ b/clang/include/clang/AST/ASTNodeTraverser.h
@@ -770,7 +770,7 @@ public:
// it will not be in the parent context:
if (auto *TT = D->getFriendType()->getType()->getAs<TagType>())
if (TT->isTagOwned())
- Visit(TT->getOriginalDecl());
+ Visit(TT->getDecl());
} else {
Visit(D->getFriendDecl());
}
diff --git a/clang/include/clang/AST/CanonicalType.h b/clang/include/clang/AST/CanonicalType.h
index b5a4e94e13..87bbd7b 100644
--- a/clang/include/clang/AST/CanonicalType.h
+++ b/clang/include/clang/AST/CanonicalType.h
@@ -551,18 +551,18 @@ struct CanProxyAdaptor<UnaryTransformType>
template<>
struct CanProxyAdaptor<TagType> : public CanProxyBase<TagType> {
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(TagDecl *, getOriginalDecl)
+ LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(TagDecl *, getDecl)
};
template<>
struct CanProxyAdaptor<RecordType> : public CanProxyBase<RecordType> {
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(RecordDecl *, getOriginalDecl)
+ LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(RecordDecl *, getDecl)
LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, hasConstFields)
};
template<>
struct CanProxyAdaptor<EnumType> : public CanProxyBase<EnumType> {
- LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(EnumDecl *, getOriginalDecl)
+ LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(EnumDecl *, getDecl)
};
template<>
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h
index 898487b..dfa3bef 100644
--- a/clang/include/clang/AST/DeclCXX.h
+++ b/clang/include/clang/AST/DeclCXX.h
@@ -3832,7 +3832,7 @@ public:
public:
EnumDecl *getEnumDecl() const {
- return EnumType->getType()->castAs<clang::EnumType>()->getOriginalDecl();
+ return EnumType->getType()->castAs<clang::EnumType>()->getDecl();
}
static UsingEnumDecl *Create(ASTContext &C, DeclContext *DC,
diff --git a/clang/include/clang/AST/NestedNameSpecifierBase.h b/clang/include/clang/AST/NestedNameSpecifierBase.h
index 73c60ba..8f4bbe9 100644
--- a/clang/include/clang/AST/NestedNameSpecifierBase.h
+++ b/clang/include/clang/AST/NestedNameSpecifierBase.h
@@ -361,6 +361,9 @@ public:
/// Retrieve the source range covering just the last part of
/// this nested-name-specifier, not including the prefix.
///
+ /// Note that this is the source range of this NestedNameSpecifier chunk,
+ /// and for a type this includes the prefix of that type.
+ ///
/// For example, if this instance refers to a nested-name-specifier
/// \c \::std::vector<int>::, the returned source range would cover
/// from "vector" to the last '::'.
diff --git a/clang/include/clang/AST/OpenACCClause.h b/clang/include/clang/AST/OpenACCClause.h
index 79cffeb..83f2b18 100644
--- a/clang/include/clang/AST/OpenACCClause.h
+++ b/clang/include/clang/AST/OpenACCClause.h
@@ -1277,7 +1277,7 @@ public:
};
// A structure to stand in for the recipe on a reduction. RecipeDecl is the
-// 'main' declaration used for initializaiton, which is fixed.
+// 'main' declaration used for initializaiton, which is fixed.
struct OpenACCReductionRecipe {
VarDecl *AllocaDecl;
@@ -1297,36 +1297,72 @@ struct OpenACCReductionRecipe {
// -For a struct without the operator, this will be 1 element per field, which
// should be the combiner for that element.
// -For an array of any of the above, it will be the above for the element.
- llvm::SmallVector<CombinerRecipe, 1> CombinerRecipes;
+ // Note: These are necessarily stored in either Trailing Storage (when in the
+ // AST), or in a separate collection when being semantically analyzed.
+ llvm::ArrayRef<CombinerRecipe> CombinerRecipes;
+ bool isSet() const { return AllocaDecl; }
+
+private:
+ friend class OpenACCReductionClause;
OpenACCReductionRecipe(VarDecl *A, llvm::ArrayRef<CombinerRecipe> Combiners)
: AllocaDecl(A), CombinerRecipes(Combiners) {}
+};
- bool isSet() const { return AllocaDecl; }
- static OpenACCReductionRecipe Empty() {
- return OpenACCReductionRecipe(/*AllocaDecl=*/nullptr, {});
+// A version of the above that is used for semantic analysis, at a time before
+// the OpenACCReductionClause node has been created. This one has storage for
+// the CombinerRecipe, since Trailing storage for it doesn't exist yet.
+struct OpenACCReductionRecipeWithStorage {
+ VarDecl *AllocaDecl;
+ llvm::SmallVector<OpenACCReductionRecipe::CombinerRecipe, 1> CombinerRecipes;
+
+ OpenACCReductionRecipeWithStorage(
+ VarDecl *A,
+ llvm::ArrayRef<OpenACCReductionRecipe::CombinerRecipe> Combiners)
+ : AllocaDecl(A), CombinerRecipes(Combiners) {}
+
+ static OpenACCReductionRecipeWithStorage Empty() {
+ return OpenACCReductionRecipeWithStorage(/*AllocaDecl=*/nullptr, {});
}
};
class OpenACCReductionClause final
: public OpenACCClauseWithVarList,
private llvm::TrailingObjects<OpenACCReductionClause, Expr *,
- OpenACCReductionRecipe> {
+ OpenACCReductionRecipe,
+ OpenACCReductionRecipe::CombinerRecipe> {
friend TrailingObjects;
OpenACCReductionOperator Op;
OpenACCReductionClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
OpenACCReductionOperator Operator,
ArrayRef<Expr *> VarList,
- ArrayRef<OpenACCReductionRecipe> Recipes,
+ ArrayRef<OpenACCReductionRecipeWithStorage> Recipes,
SourceLocation EndLoc)
: OpenACCClauseWithVarList(OpenACCClauseKind::Reduction, BeginLoc,
LParenLoc, EndLoc),
Op(Operator) {
- assert(VarList.size() == Recipes.size());
+ assert(VarList.size() == Recipes.size());
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
- llvm::uninitialized_copy(Recipes, getTrailingObjects<
- OpenACCReductionRecipe > ());
+
+ // Since we're using trailing storage on this node to store the 'combiner'
+ // recipes of the Reduction Recipes (which have a 1:M relationship), we need
+ // to ensure we get the ArrayRef of each of our combiner 'correct'.
+ OpenACCReductionRecipe::CombinerRecipe *CurCombinerLoc =
+ getTrailingObjects<OpenACCReductionRecipe::CombinerRecipe>();
+ for (const auto &[Idx, R] : llvm::enumerate(Recipes)) {
+
+ // ArrayRef to the 'correct' data location in trailing storage.
+ llvm::MutableArrayRef<OpenACCReductionRecipe::CombinerRecipe>
+ NewCombiners{CurCombinerLoc, R.CombinerRecipes.size()};
+ CurCombinerLoc += R.CombinerRecipes.size();
+
+ llvm::uninitialized_copy(R.CombinerRecipes, NewCombiners.begin());
+
+ // Placement new into the correct location in trailng storage.
+ new (&getTrailingObjects<OpenACCReductionRecipe>()[Idx])
+ OpenACCReductionRecipe(R.AllocaDecl, NewCombiners);
+ }
}
public:
@@ -1347,13 +1383,17 @@ public:
static OpenACCReductionClause *
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
OpenACCReductionOperator Operator, ArrayRef<Expr *> VarList,
- ArrayRef<OpenACCReductionRecipe> Recipes, SourceLocation EndLoc);
+ ArrayRef<OpenACCReductionRecipeWithStorage> Recipes,
+ SourceLocation EndLoc);
OpenACCReductionOperator getReductionOp() const { return Op; }
size_t numTrailingObjects(OverloadToken<Expr *>) const {
return getExprs().size();
}
+ size_t numTrailingObjects(OverloadToken<OpenACCReductionRecipe>) const {
+ return getExprs().size();
+ }
};
class OpenACCLinkClause final
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 68d220a..bc791e4 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -2291,18 +2291,68 @@ public:
/// This represents 'nowait' clause in the '#pragma omp ...' directive.
///
/// \code
-/// #pragma omp for nowait
+/// #pragma omp for nowait (cond)
/// \endcode
-/// In this example directive '#pragma omp for' has 'nowait' clause.
-class OMPNowaitClause final : public OMPNoChildClause<llvm::omp::OMPC_nowait> {
+/// In this example directive '#pragma omp for' has simple 'nowait' clause with
+/// condition 'cond'.
+class OMPNowaitClause final : public OMPClause {
+ friend class OMPClauseReader;
+
+ /// Location of '('.
+ SourceLocation LParenLoc;
+
+ /// Condition of the 'nowait' clause.
+ Stmt *Condition = nullptr;
+
+ /// Set condition.
+ void setCondition(Expr *Cond) { Condition = Cond; }
+
public:
- /// Build 'nowait' clause.
+ /// Build 'nowait' clause with condition \a Cond.
///
+ /// \param Cond Condition of the clause.
/// \param StartLoc Starting location of the clause.
+ /// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
- OMPNowaitClause(SourceLocation StartLoc = SourceLocation(),
- SourceLocation EndLoc = SourceLocation())
- : OMPNoChildClause(StartLoc, EndLoc) {}
+ OMPNowaitClause(Expr *Cond, SourceLocation StartLoc, SourceLocation LParenLoc,
+ SourceLocation EndLoc)
+ : OMPClause(llvm::omp::OMPC_nowait, StartLoc, EndLoc),
+ LParenLoc(LParenLoc), Condition(Cond) {}
+
+ /// Build an empty clause.
+ OMPNowaitClause()
+ : OMPClause(llvm::omp::OMPC_nowait, SourceLocation(), SourceLocation()) {}
+
+ /// Sets the location of '('.
+ void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
+
+ /// Returns the location of '('.
+ SourceLocation getLParenLoc() const { return LParenLoc; }
+
+ /// Returns condition.
+ Expr *getCondition() const { return cast_or_null<Expr>(Condition); }
+
+ child_range children() {
+ if (Condition)
+ return child_range(&Condition, &Condition + 1);
+ return child_range(child_iterator(), child_iterator());
+ }
+
+ const_child_range children() const {
+ if (Condition)
+ return const_child_range(&Condition, &Condition + 1);
+ return const_child_range(const_child_iterator(), const_child_iterator());
+ }
+
+ child_range used_children();
+ const_child_range used_children() const {
+ auto Children = const_cast<OMPNowaitClause *>(this)->used_children();
+ return const_child_range(Children.begin(), Children.end());
+ }
+
+ static bool classof(const OMPClause *T) {
+ return T->getClauseKind() == llvm::omp::OMPC_nowait;
+ }
};
/// This represents 'untied' clause in the '#pragma omp ...' directive.
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 7a2881f..32b2b6b 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -1710,7 +1710,7 @@ DEF_TRAVERSE_DECL(FriendDecl, {
// it will not be in the parent context:
if (auto *TT = D->getFriendType()->getType()->getAs<TagType>();
TT && TT->isTagOwned())
- TRY_TO(TraverseDecl(TT->getOriginalDecl()));
+ TRY_TO(TraverseDecl(TT->getDecl()));
} else {
TRY_TO(TraverseDecl(D->getFriendDecl()));
}
@@ -3594,7 +3594,8 @@ bool RecursiveASTVisitor<Derived>::VisitOMPOrderedClause(OMPOrderedClause *C) {
}
template <typename Derived>
-bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *) {
+bool RecursiveASTVisitor<Derived>::VisitOMPNowaitClause(OMPNowaitClause *C) {
+ TRY_TO(TraverseStmt(C->getCondition()));
return true;
}
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index df106d5..7bd2441 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -27,7 +27,7 @@ inline CXXRecordDecl *Type::getAsCXXRecordDecl() const {
const auto *TT = dyn_cast<TagType>(CanonicalType);
if (!isa_and_present<RecordType, InjectedClassNameType>(TT))
return nullptr;
- auto *TD = TT->getOriginalDecl();
+ auto *TD = TT->getDecl();
if (isa<RecordType>(TT) && !isa<CXXRecordDecl>(TD))
return nullptr;
return cast<CXXRecordDecl>(TD)->getDefinitionOrSelf();
@@ -35,41 +35,39 @@ inline CXXRecordDecl *Type::getAsCXXRecordDecl() const {
inline CXXRecordDecl *Type::castAsCXXRecordDecl() const {
const auto *TT = cast<TagType>(CanonicalType);
- return cast<CXXRecordDecl>(TT->getOriginalDecl())->getDefinitionOrSelf();
+ return cast<CXXRecordDecl>(TT->getDecl())->getDefinitionOrSelf();
}
inline RecordDecl *Type::getAsRecordDecl() const {
const auto *TT = dyn_cast<TagType>(CanonicalType);
if (!isa_and_present<RecordType, InjectedClassNameType>(TT))
return nullptr;
- return cast<RecordDecl>(TT->getOriginalDecl())->getDefinitionOrSelf();
+ return cast<RecordDecl>(TT->getDecl())->getDefinitionOrSelf();
}
inline RecordDecl *Type::castAsRecordDecl() const {
const auto *TT = cast<TagType>(CanonicalType);
- return cast<RecordDecl>(TT->getOriginalDecl())->getDefinitionOrSelf();
+ return cast<RecordDecl>(TT->getDecl())->getDefinitionOrSelf();
}
inline EnumDecl *Type::getAsEnumDecl() const {
if (const auto *TT = dyn_cast<EnumType>(CanonicalType))
- return TT->getOriginalDecl()->getDefinitionOrSelf();
+ return TT->getDecl()->getDefinitionOrSelf();
return nullptr;
}
inline EnumDecl *Type::castAsEnumDecl() const {
- return cast<EnumType>(CanonicalType)
- ->getOriginalDecl()
- ->getDefinitionOrSelf();
+ return cast<EnumType>(CanonicalType)->getDecl()->getDefinitionOrSelf();
}
inline TagDecl *Type::getAsTagDecl() const {
if (const auto *TT = dyn_cast<TagType>(CanonicalType))
- return TT->getOriginalDecl()->getDefinitionOrSelf();
+ return TT->getDecl()->getDefinitionOrSelf();
return nullptr;
}
inline TagDecl *Type::castAsTagDecl() const {
- return cast<TagType>(CanonicalType)->getOriginalDecl()->getDefinitionOrSelf();
+ return cast<TagType>(CanonicalType)->getDecl()->getDefinitionOrSelf();
}
inline bool QualType::hasNonTrivialToPrimitiveDefaultInitializeCUnion() const {
diff --git a/clang/include/clang/AST/TypeBase.h b/clang/include/clang/AST/TypeBase.h
index 625cc77..f07861f 100644
--- a/clang/include/clang/AST/TypeBase.h
+++ b/clang/include/clang/AST/TypeBase.h
@@ -4378,8 +4378,6 @@ protected:
unsigned NumRows;
unsigned NumColumns;
- static constexpr unsigned MaxElementsPerDimension = (1 << 20) - 1;
-
ConstantMatrixType(QualType MatrixElementType, unsigned NRows,
unsigned NColumns, QualType CanonElementType);
@@ -4398,16 +4396,6 @@ public:
return getNumRows() * getNumColumns();
}
- /// Returns true if \p NumElements is a valid matrix dimension.
- static constexpr bool isDimensionValid(size_t NumElements) {
- return NumElements > 0 && NumElements <= MaxElementsPerDimension;
- }
-
- /// Returns the maximum number of elements per dimension.
- static constexpr unsigned getMaxElementsPerDimension() {
- return MaxElementsPerDimension;
- }
-
void Profile(llvm::FoldingSetNodeID &ID) {
Profile(ID, getElementType(), getNumRows(), getNumColumns(),
getTypeClass());
@@ -6419,10 +6407,10 @@ protected:
bool IsInjected, const Type *CanonicalType);
public:
- // FIXME: Temporarily renamed from `getDecl` in order to facilitate
- // rebasing, due to change in behaviour. This should be renamed back
- // to `getDecl` once the change is settled.
- TagDecl *getOriginalDecl() const { return decl; }
+ TagDecl *getDecl() const { return decl; }
+ [[deprecated("Use getDecl instead")]] TagDecl *getOriginalDecl() const {
+ return decl;
+ }
NestedNameSpecifier getQualifier() const;
@@ -6463,7 +6451,7 @@ struct TagTypeFoldingSetPlaceholder : public llvm::FoldingSetNode {
void Profile(llvm::FoldingSetNodeID &ID) const {
const TagType *T = getTagType();
- Profile(ID, T->getKeyword(), T->getQualifier(), T->getOriginalDecl(),
+ Profile(ID, T->getKeyword(), T->getQualifier(), T->getDecl(),
T->isTagOwned(), T->isInjected());
}
@@ -6487,11 +6475,11 @@ class RecordType final : public TagType {
using TagType::TagType;
public:
- // FIXME: Temporarily renamed from `getDecl` in order to facilitate
- // rebasing, due to change in behaviour. This should be renamed back
- // to `getDecl` once the change is settled.
- RecordDecl *getOriginalDecl() const {
- return reinterpret_cast<RecordDecl *>(TagType::getOriginalDecl());
+ RecordDecl *getDecl() const {
+ return reinterpret_cast<RecordDecl *>(TagType::getDecl());
+ }
+ [[deprecated("Use getDecl instead")]] RecordDecl *getOriginalDecl() const {
+ return getDecl();
}
/// Recursively check all fields in the record for const-ness. If any field
@@ -6507,11 +6495,11 @@ class EnumType final : public TagType {
using TagType::TagType;
public:
- // FIXME: Temporarily renamed from `getDecl` in order to facilitate
- // rebasing, due to change in behaviour. This should be renamed back
- // to `getDecl` once the change is settled.
- EnumDecl *getOriginalDecl() const {
- return reinterpret_cast<EnumDecl *>(TagType::getOriginalDecl());
+ EnumDecl *getDecl() const {
+ return reinterpret_cast<EnumDecl *>(TagType::getDecl());
+ }
+ [[deprecated("Use getDecl instead")]] EnumDecl *getOriginalDecl() const {
+ return getDecl();
}
static bool classof(const Type *T) { return T->getTypeClass() == Enum; }
@@ -6542,11 +6530,11 @@ class InjectedClassNameType final : public TagType {
bool IsInjected, const Type *CanonicalType);
public:
- // FIXME: Temporarily renamed from `getDecl` in order to facilitate
- // rebasing, due to change in behaviour. This should be renamed back
- // to `getDecl` once the change is settled.
- CXXRecordDecl *getOriginalDecl() const {
- return reinterpret_cast<CXXRecordDecl *>(TagType::getOriginalDecl());
+ CXXRecordDecl *getDecl() const {
+ return reinterpret_cast<CXXRecordDecl *>(TagType::getDecl());
+ }
+ [[deprecated("Use getDecl instead")]] CXXRecordDecl *getOriginalDecl() const {
+ return getDecl();
}
static bool classof(const Type *T) {
@@ -8930,8 +8918,8 @@ inline bool Type::isIntegerType() const {
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
// Incomplete enum types are not treated as integer types.
// FIXME: In C++, enum types are never integer types.
- return IsEnumDeclComplete(ET->getOriginalDecl()) &&
- !IsEnumDeclScoped(ET->getOriginalDecl());
+ return IsEnumDeclComplete(ET->getDecl()) &&
+ !IsEnumDeclScoped(ET->getDecl());
}
return isBitIntType();
}
@@ -8989,7 +8977,7 @@ inline bool Type::isScalarType() const {
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
// Enums are scalar types, but only if they are defined. Incomplete enums
// are not treated as scalar types.
- return IsEnumDeclComplete(ET->getOriginalDecl());
+ return IsEnumDeclComplete(ET->getDecl());
return isa<PointerType>(CanonicalType) ||
isa<BlockPointerType>(CanonicalType) ||
isa<MemberPointerType>(CanonicalType) ||
@@ -9005,7 +8993,7 @@ inline bool Type::isIntegralOrEnumerationType() const {
// Check for a complete enum type; incomplete enum types are not properly an
// enumeration type in the sense required here.
if (const auto *ET = dyn_cast<EnumType>(CanonicalType))
- return IsEnumDeclComplete(ET->getOriginalDecl());
+ return IsEnumDeclComplete(ET->getDecl());
return isBitIntType();
}
diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h
index 38e8fba..2cefaa9 100644
--- a/clang/include/clang/AST/TypeLoc.h
+++ b/clang/include/clang/AST/TypeLoc.h
@@ -199,11 +199,6 @@ public:
NestedNameSpecifierLoc getPrefix() const;
/// This returns the position of the type after any elaboration, such as the
- /// 'struct' keyword, and name qualifiers. This will the 'template' keyword if
- /// present, or the name location otherwise.
- SourceLocation getNonPrefixBeginLoc() const;
-
- /// This returns the position of the type after any elaboration, such as the
/// 'struct' keyword. This may be the position of the name qualifiers,
/// 'template' keyword, or the name location otherwise.
SourceLocation getNonElaboratedBeginLoc() const;
@@ -798,7 +793,7 @@ struct TagTypeLocInfo {
class TagTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, TagTypeLoc, TagType,
TagTypeLocInfo> {
public:
- TagDecl *getOriginalDecl() const { return getTypePtr()->getOriginalDecl(); }
+ TagDecl *getDecl() const { return getTypePtr()->getDecl(); }
/// True if the tag was defined in this type specifier.
bool isDefinition() const;
@@ -859,9 +854,7 @@ class RecordTypeLoc : public InheritingConcreteTypeLoc<TagTypeLoc,
RecordTypeLoc,
RecordType> {
public:
- RecordDecl *getOriginalDecl() const {
- return getTypePtr()->getOriginalDecl();
- }
+ RecordDecl *getDecl() const { return getTypePtr()->getDecl(); }
};
/// Wrapper for source info for enum types.
@@ -869,7 +862,7 @@ class EnumTypeLoc : public InheritingConcreteTypeLoc<TagTypeLoc,
EnumTypeLoc,
EnumType> {
public:
- EnumDecl *getOriginalDecl() const { return getTypePtr()->getOriginalDecl(); }
+ EnumDecl *getDecl() const { return getTypePtr()->getDecl(); }
};
/// Wrapper for source info for injected class names of class
@@ -878,9 +871,7 @@ class InjectedClassNameTypeLoc
: public InheritingConcreteTypeLoc<TagTypeLoc, InjectedClassNameTypeLoc,
InjectedClassNameType> {
public:
- CXXRecordDecl *getOriginalDecl() const {
- return getTypePtr()->getOriginalDecl();
- }
+ CXXRecordDecl *getDecl() const { return getTypePtr()->getDecl(); }
};
/// Wrapper for template type parameters.
diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td
index 9dc85fb..03613d5 100644
--- a/clang/include/clang/AST/TypeProperties.td
+++ b/clang/include/clang/AST/TypeProperties.td
@@ -575,7 +575,7 @@ let Class = TagType in {
let Conditional = [{ !IsCanonical }];
let Read = [{ node->getQualifier() }];
}
- def : Property<"TD", TagDeclRef> { let Read = [{ node->getOriginalDecl() }]; }
+ def : Property<"TD", TagDeclRef> { let Read = [{ node->getDecl() }]; }
}
let Class = EnumType in {
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index 1ab6f11..c050fb7 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -1017,7 +1017,7 @@ private:
// First, for any types that have a declaration, extract the declaration and
// match on it.
if (const auto *S = dyn_cast<TagType>(&Node)) {
- return matchesDecl(S->getOriginalDecl(), Finder, Builder);
+ return matchesDecl(S->getDecl(), Finder, Builder);
}
if (const auto *S = dyn_cast<TemplateTypeParmType>(&Node)) {
return matchesDecl(S->getDecl(), Finder, Builder);
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index 3cde249..eb48a0c 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -1572,6 +1572,23 @@ def HIPManaged : InheritableAttr {
let Documentation = [HIPManagedAttrDocs];
}
+def CUDAClusterDims : InheritableAttr {
+ let Spellings = [GNU<"cluster_dims">];
+ let Args = [ExprArgument<"X">, ExprArgument<"Y", /*opt=*/1>, ExprArgument<"Z", /*opt=*/1>];
+ let Subjects = SubjectList<[ObjCMethod, FunctionLike]>;
+ let LangOpts = [CUDA];
+ let Documentation = [CUDAClusterDimsAttrDoc];
+}
+
+def CUDANoCluster : InheritableAttr {
+ let Spellings = [GNU<"no_cluster">];
+ let Subjects = SubjectList<[ObjCMethod, FunctionLike]>;
+ let LangOpts = [CUDA];
+ let Documentation = [CUDANoClusterAttrDoc];
+}
+
+def : MutualExclusions<[CUDAClusterDims, CUDANoCluster]>;
+
def CUDAInvalidTarget : InheritableAttr {
let Spellings = [];
let Subjects = SubjectList<[Function]>;
@@ -1599,8 +1616,15 @@ def CUDAShared : InheritableAttr {
}
def : MutualExclusions<[CUDAConstant, CUDAShared, HIPManaged]>;
+def SYCLKernel : InheritableAttr {
+ let Spellings = [Clang<"sycl_kernel">];
+ let Subjects = SubjectList<[FunctionTmpl]>;
+ let LangOpts = [SYCLDevice];
+ let Documentation = [SYCLKernelDocs];
+}
+
def DeviceKernel : DeclOrTypeAttr {
- let Spellings = [Clang<"device_kernel">, Clang<"sycl_kernel">,
+ let Spellings = [Clang<"device_kernel">,
Clang<"nvptx_kernel">, Clang<"amdgpu_kernel">,
CustomKeyword<"__kernel">, CustomKeyword<"kernel">];
let Documentation = [DeviceKernelDocs];
@@ -1624,15 +1648,6 @@ def DeviceKernel : DeclOrTypeAttr {
if(!A) return false;
return isNVPTXSpelling(*A);
}
- static inline bool isSYCLSpelling(const AttributeCommonInfo& A) {
- return A.getAttributeSpellingListIndex() == GNU_sycl_kernel ||
- A.getAttributeSpellingListIndex() == CXX11_clang_sycl_kernel ||
- A.getAttributeSpellingListIndex() == C23_clang_sycl_kernel;
- }
- static inline bool isSYCLSpelling(const AttributeCommonInfo* A) {
- if(!A) return false;
- return isSYCLSpelling(*A);
- }
static inline bool isOpenCLSpelling(const AttributeCommonInfo& A) {
// Tablegen trips underscores from spellings to build the spelling
// list, but here we have the same spelling with unscores and without,
diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td
index 20a52b4..2fdd041 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -396,13 +396,10 @@ any option of a multiversioned function is undefined.
}];
}
-def DeviceKernelDocs : Documentation {
+def SYCLKernelDocs : Documentation {
let Category = DocCatFunction;
- let Heading = "device_kernel, sycl_kernel, nvptx_kernel, amdgpu_kernel, "
- "kernel, __kernel";
+ let Heading = "sycl_kernel";
let Content = [{
-These attributes specify that the function represents a kernel for device offloading.
-The specific semantics depend on the offloading language, target, and attribute spelling.
The ``sycl_kernel`` attribute specifies that a function template will be used
to outline device code and to generate an OpenCL kernel.
Here is a code example of the SYCL program, which demonstrates the compiler's
@@ -476,6 +473,21 @@ The SYCL kernel in the previous code sample meets these expectations.
}];
}
+def DeviceKernelDocs : Documentation {
+ let Category = DocCatFunction;
+ let Heading = "device_kernel, nvptx_kernel, amdgpu_kernel, "
+ "kernel, __kernel";
+ let Content = [{
+These attributes specify that the function represents a kernel for device offloading.
+The specific semantics depend on the offloading language, target, and attribute spelling.
+Here is a code example using the attribute to mark a function as a kernel:
+
+.. code-block:: c++
+
+ [[clang::device_kernel]] int foo(int x) { return ++x; }
+ }];
+}
+
def SYCLExternalDocs : Documentation {
let Category = DocCatFunction;
let Heading = "sycl_external";
@@ -7533,6 +7545,45 @@ A managed variable can be accessed in both device and host code.
}];
}
+def CUDAClusterDimsAttrDoc : Documentation {
+ let Category = DocCatDecl;
+ let Content = [{
+In CUDA/HIP programming, the ``cluster_dims`` attribute, conventionally exposed as the
+``__cluster_dims__`` macro, can be applied to a kernel function to set the dimensions of a
+thread block cluster, which is an optional level of hierarchy and made up of thread blocks.
+``__cluster_dims__`` defines the cluster size as ``(X, Y, Z)``, where each value is the number
+of thread blocks in that dimension. The ``cluster_dims`` and `no_cluster`` attributes are
+mutually exclusive.
+
+.. code::
+
+ __global__ __cluster_dims__(2, 1, 1) void kernel(...) {
+ ...
+ }
+
+ }];
+}
+
+def CUDANoClusterAttrDoc : Documentation {
+ let Category = DocCatDecl;
+ let Content = [{
+In CUDA/HIP programming, a kernel function can still be launched with the cluster feature enabled
+at runtime, even without being annotated with ``__cluster_dims__``. The LLVM/Clang-exclusive
+``no_cluster`` attribute, conventionally exposed as the ``__no_cluster__`` macro, can be applied to
+a kernel function to explicitly indicate that the cluster feature will not be enabled either at
+compile time or at kernel launch time. This allows the compiler to apply certain optimizations
+without assuming that clustering could be enabled at runtime. It is undefined behavior to launch a
+kernel annotated with ``__no_cluster__`` if the cluster feature is enabled at runtime.
+The ``cluster_dims`` and ``no_cluster`` attributes are mutually exclusive.
+
+.. code::
+
+ __global__ __no_cluster__ void kernel(...) {
+ ...
+ }
+ }];
+}
+
def LifetimeOwnerDocs : Documentation {
let Category = DocCatDecl;
let Content = [{
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index 792e2e0..a350acd 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -4957,6 +4957,18 @@ def HLSLResourceNonUniformIndex : LangBuiltin<"HLSL_LANG"> {
let Prototype = "uint32_t(uint32_t)";
}
+def HLSLResourceGetDimensionsX : LangBuiltin<"HLSL_LANG"> {
+ let Spellings = ["__builtin_hlsl_resource_getdimensions_x"];
+ let Attributes = [NoThrow];
+ let Prototype = "void(...)";
+}
+
+def HLSLResourceGetStride : LangBuiltin<"HLSL_LANG"> {
+ let Spellings = ["__builtin_hlsl_resource_getstride"];
+ let Attributes = [NoThrow];
+ let Prototype = "void(...)";
+}
+
def HLSLAll : LangBuiltin<"HLSL_LANG"> {
let Spellings = ["__builtin_hlsl_all"];
let Attributes = [NoThrow, Const];
diff --git a/clang/include/clang/Basic/BuiltinsX86.td b/clang/include/clang/Basic/BuiltinsX86.td
index 217589d..62c70fba 100644
--- a/clang/include/clang/Basic/BuiltinsX86.td
+++ b/clang/include/clang/Basic/BuiltinsX86.td
@@ -110,21 +110,21 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<128>] in {
}
let Features = "sse3" in {
- foreach Op = ["addsub", "hadd", "hsub"] in {
+ foreach Op = ["addsub"] in {
def Op#ps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>)">;
def Op#pd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>)">;
}
}
- let Features = "ssse3" in {
- foreach Op = ["phadd", "phsub"] in {
- def Op#w128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
- def Op#sw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
- def Op#d128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>)">;
+ let Features = "sse3", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
+ foreach Op = ["hadd", "hsub"] in {
+ def Op#ps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>)">;
+ def Op#pd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>)">;
}
+ }
+ let Features = "ssse3" in {
def pmulhrsw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
- def pshufb128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Vector<16, char>)">;
def psignb128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Vector<16, char>)">;
def psignw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
def psignd128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>)">;
@@ -132,12 +132,13 @@ let Attributes = [Const, NoThrow, RequiredVectorWidth<128>] in {
let Features = "ssse3", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
def pmaddubsw128 : X86Builtin<"_Vector<8, short>(_Vector<16, char>, _Vector<16, char>)">;
+ def pshufb128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Vector<16, char>)">;
}
}
// AVX
let Attributes = [Const, NoThrow, RequiredVectorWidth<256>], Features = "avx" in {
- foreach Op = ["addsub", "hadd", "hsub", "max", "min"] in {
+ foreach Op = ["addsub", "max", "min"] in {
def Op#pd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, double>)">;
def Op#ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>)">;
}
@@ -316,6 +317,14 @@ let Features = "ssse3", Attributes = [NoThrow, Const, RequiredVectorWidth<128>]
def palignr128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Vector<16, char>, _Constant int)">;
}
+let Features = "ssse3", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
+ foreach Op = ["phadd", "phsub"] in {
+ def Op#w128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
+ def Op#sw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>)">;
+ def Op#d128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>)">;
+ }
+}
+
let Features = "sse4.1", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
def insertps128 : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>, _Constant char)">;
def roundps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Constant int)">;
@@ -323,14 +332,22 @@ let Features = "sse4.1", Attributes = [NoThrow, Const, RequiredVectorWidth<128>]
def roundsd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>, _Constant int)">;
def roundpd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Constant int)">;
def dpps : X86Builtin<"_Vector<4, float>(_Vector<4, float>, _Vector<4, float>, _Constant char)">;
- def dppd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>, _Constant char)">;
- def ptestz128 : X86Builtin<"int(_Vector<2, long long int>, _Vector<2, long long int>)">;
- def ptestc128 : X86Builtin<"int(_Vector<2, long long int>, _Vector<2, long long int>)">;
- def ptestnzc128 : X86Builtin<"int(_Vector<2, long long int>, _Vector<2, long long int>)">;
+ def dppd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, "
+ "_Vector<2,double>, _Constant char)">;
def mpsadbw128 : X86Builtin<"_Vector<16, char>(_Vector<16, char>, _Vector<16, char>, _Constant char)">;
def phminposuw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>)">;
}
+let Features = "sse4.1",
+ Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
+ def ptestz128
+ : X86Builtin<"int(_Vector<2, long long int>, _Vector<2, long long int>)">;
+ def ptestc128
+ : X86Builtin<"int(_Vector<2, long long int>, _Vector<2, long long int>)">;
+ def ptestnzc128
+ : X86Builtin<"int(_Vector<2, long long int>, _Vector<2, long long int>)">;
+}
+
let Features = "sse4.1", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
def pblendw128 : X86Builtin<"_Vector<8, short>(_Vector<8, short>, _Vector<8, short>, _Constant int)">;
def blendpd : X86Builtin<"_Vector<2, double>(_Vector<2, double>, _Vector<2, double>, _Constant int)">;
@@ -507,6 +524,11 @@ let Features = "avx", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWid
def vinsertf128_pd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<2, double>, _Constant int)">;
def vinsertf128_ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<4, float>, _Constant int)">;
def vinsertf128_si256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<4, int>, _Constant int)">;
+
+ foreach Op = ["hadd", "hsub"] in {
+ def Op#pd256 : X86Builtin<"_Vector<4, double>(_Vector<4, double>, _Vector<4, double>)">;
+ def Op#ps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Vector<8, float>)">;
+ }
}
let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
@@ -520,8 +542,8 @@ let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in
def roundps256 : X86Builtin<"_Vector<8, float>(_Vector<8, float>, _Constant int)">;
}
-
-let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
+let Features = "avx",
+ Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
def vtestzpd : X86Builtin<"int(_Vector<2, double>, _Vector<2, double>)">;
def vtestcpd : X86Builtin<"int(_Vector<2, double>, _Vector<2, double>)">;
def vtestnzcpd : X86Builtin<"int(_Vector<2, double>, _Vector<2, double>)">;
@@ -530,7 +552,8 @@ let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in
def vtestnzcps : X86Builtin<"int(_Vector<4, float>, _Vector<4, float>)">;
}
-let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
+let Features = "avx",
+ Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
def vtestzpd256 : X86Builtin<"int(_Vector<4, double>, _Vector<4, double>)">;
def vtestcpd256 : X86Builtin<"int(_Vector<4, double>, _Vector<4, double>)">;
def vtestnzcpd256 : X86Builtin<"int(_Vector<4, double>, _Vector<4, double>)">;
@@ -540,6 +563,10 @@ let Features = "avx", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in
def ptestz256 : X86Builtin<"int(_Vector<4, long long int>, _Vector<4, long long int>)">;
def ptestc256 : X86Builtin<"int(_Vector<4, long long int>, _Vector<4, long long int>)">;
def ptestnzc256 : X86Builtin<"int(_Vector<4, long long int>, _Vector<4, long long int>)">;
+}
+
+let Features = "avx",
+ Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
def movmskpd256 : X86Builtin<"int(_Vector<4, double>)">;
def movmskps256 : X86Builtin<"int(_Vector<8, float>)">;
}
@@ -579,16 +606,10 @@ let Features = "avx", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWid
let Features = "avx2", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
def mpsadbw256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Vector<32, char>, _Constant char)">;
def palignr256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Vector<32, char>, _Constant int)">;
- def phaddw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
- def phaddd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">;
- def phaddsw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
- def phsubw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
- def phsubd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">;
- def phsubsw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
+
def pmovmskb256 : X86Builtin<"int(_Vector<32, char>)">;
def pmulhrsw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
def psadbw256 : X86Builtin<"_Vector<4, long long int>(_Vector<32, char>, _Vector<32, char>)">;
- def pshufb256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Vector<32, char>)">;
def psignb256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Vector<32, char>)">;
def psignw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
def psignd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">;
@@ -627,6 +648,8 @@ let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWi
def pmuldq256 : X86Builtin<"_Vector<4, long long int>(_Vector<8, int>, _Vector<8, int>)">;
def pmuludq256 : X86Builtin<"_Vector<4, long long int>(_Vector<8, int>, _Vector<8, int>)">;
+ def pshufb256 : X86Builtin<"_Vector<32, char>(_Vector<32, char>, _Vector<32, char>)">;
+
def psllwi256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, int)">;
def pslldi256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, int)">;
def psllqi256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, int)">;
@@ -653,6 +676,13 @@ let Features = "avx2", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWi
def packssdw256 : X86Builtin<"_Vector<16, short>(_Vector<8, int>, _Vector<8, int>)">;
def packuswb256 : X86Builtin<"_Vector<32, char>(_Vector<16, short>, _Vector<16, short>)">;
+ def phaddw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
+ def phaddd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">;
+ def phaddsw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
+ def phsubw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
+ def phsubd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>)">;
+ def phsubsw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Vector<16, short>)">;
+
def pshuflw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Constant int)">;
def pshufhw256 : X86Builtin<"_Vector<16, short>(_Vector<16, short>, _Constant int)">;
def pshufd256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Constant int)">;
@@ -1318,7 +1348,6 @@ let Features = "avx512f", Attributes = [NoThrow, Const, RequiredVectorWidth<512>
let Features = "avx512bw", Attributes = [NoThrow, Const, RequiredVectorWidth<512>] in {
def ucmpw512_mask : X86Builtin<"unsigned int(_Vector<32, short>, _Vector<32, short>, _Constant int, unsigned int)">;
- def pshufb512 : X86Builtin<"_Vector<64, char>(_Vector<64, char>, _Vector<64, char>)">;
}
let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
@@ -1326,25 +1355,21 @@ let Features = "avx512bw", Attributes = [NoThrow, Const, Constexpr, RequiredVect
def packssdw512 : X86Builtin<"_Vector<32, short>(_Vector<16, int>, _Vector<16, int>)">;
def packuswb512 : X86Builtin<"_Vector<64, char>(_Vector<32, short>, _Vector<32, short>)">;
def packusdw512 : X86Builtin<"_Vector<32, short>(_Vector<16, int>, _Vector<16, int>)">;
-}
-
-let Features = "avx512cd,avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
- def vpconflictdi_128 : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>)">;
-}
-let Features = "avx512cd,avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
- def vpconflictdi_256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>)">;
+ def pshufb512 : X86Builtin<"_Vector<64, char>(_Vector<64, char>, _Vector<64, char>)">;
}
-let Features = "avx512cd,avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
+let Features = "avx512cd,avx512vl", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
+ def vpconflictdi_128 : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>)">;
def vpconflictsi_128 : X86Builtin<"_Vector<4, int>(_Vector<4, int>)">;
}
-let Features = "avx512cd,avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
+let Features = "avx512cd,avx512vl", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
+ def vpconflictdi_256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>)">;
def vpconflictsi_256 : X86Builtin<"_Vector<8, int>(_Vector<8, int>)">;
}
-let Features = "avx512cd", Attributes = [NoThrow, Const, RequiredVectorWidth<512>] in {
+let Features = "avx512cd", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
def vpconflictdi_512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>)">;
def vpconflictsi_512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>)">;
}
@@ -2108,24 +2133,18 @@ let Features = "avx512vl", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
def movdqa64store256_mask : X86Builtin<"void(_Vector<4, long long int *>, _Vector<4, long long int>, unsigned char)">;
}
-let Features = "avx512ifma", Attributes = [NoThrow, Const, RequiredVectorWidth<512>] in {
+let Features = "avx512ifma", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
def vpmadd52huq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>, _Vector<8, long long int>)">;
def vpmadd52luq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>, _Vector<8, long long int>)">;
}
-let Features = "avx512ifma,avx512vl|avxifma", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
+let Features = "avx512ifma,avx512vl|avxifma", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
def vpmadd52huq128 : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>, _Vector<2, long long int>, _Vector<2, long long int>)">;
-}
-
-let Features = "avx512ifma,avx512vl|avxifma", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
- def vpmadd52huq256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>, _Vector<4, long long int>)">;
-}
-
-let Features = "avx512ifma,avx512vl|avxifma", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
def vpmadd52luq128 : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>, _Vector<2, long long int>, _Vector<2, long long int>)">;
}
-let Features = "avx512ifma,avx512vl|avxifma", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
+let Features = "avx512ifma,avx512vl|avxifma", Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
+ def vpmadd52huq256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>, _Vector<4, long long int>)">;
def vpmadd52luq256 : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>, _Vector<4, long long int>)">;
}
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index ef3f59f..8aa3489 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -631,6 +631,7 @@ def MissingFieldInitializers : DiagGroup<"missing-field-initializers",
def ModuleLock : DiagGroup<"module-lock">;
def ModuleBuild : DiagGroup<"module-build">;
def ModuleImport : DiagGroup<"module-import">;
+def ModuleValidation : DiagGroup<"module-validation">;
def ModuleConflict : DiagGroup<"module-conflict">;
def ModuleFileExtension : DiagGroup<"module-file-extension">;
def ModuleIncludeDirectiveTranslation : DiagGroup<"module-include-translation">;
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index c724136..e5e071f 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -505,7 +505,7 @@ def err_expected_coloncolon_after_super : Error<
"expected '::' after '__super'">;
def ext_decomp_decl_empty : ExtWarn<
- "ISO C++17 does not allow a decomposition group to be empty">,
+ "ISO C++17 does not allow a structured binding group to be empty">,
InGroup<DiagGroup<"empty-decomposition">>;
def err_function_parameter_limit_exceeded : Error<
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 3df28f2..22de85d 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -31,12 +31,12 @@ defm constexpr_body_multiple_return : CXX14Compat<
defm variable_template : CXX14Compat<"variable templates are">;
// C++17 compatibility with C++14 and earlier.
-defm decomp_decl : CXX17Compat<"decomposition declarations are">;
+defm decomp_decl : CXX17Compat<"structured binding declarations are">;
defm inline_variable : CXX17Compat<"inline variables are">;
// C++20 compatibility with C++17 and earlier.
defm decomp_decl_spec
- : CXX20Compat<"decomposition declaration declared '%0' is">;
+ : CXX20Compat<"structured binding declaration declared '%0' is">;
defm constexpr_local_var_no_init : CXX20Compat<
"uninitialized variable in a constexpr %select{function|constructor}0 is">;
defm constexpr_function_try_block : CXX20Compat<
@@ -591,58 +591,58 @@ def warn_modifying_shadowing_decl :
// C++ decomposition declarations
def err_decomp_decl_context : Error<
- "decomposition declaration not permitted in this context">;
+ "structured binding declaration not permitted in this context">;
def err_decomp_decl_spec
- : Error<"decomposition declaration cannot be declared '%0'">;
+ : Error<"structured binding declaration cannot be declared '%0'">;
def err_decomp_decl_type : Error<
- "decomposition declaration cannot be declared with type %0; "
+ "structured binding declaration cannot be declared with type %0; "
"declared type must be 'auto' or reference to 'auto'">;
def err_decomp_decl_constraint : Error<
- "decomposition declaration cannot be declared with constrained 'auto'">;
+ "structured binding declaration cannot be declared with constrained 'auto'">;
def err_decomp_decl_parens : Error<
- "decomposition declaration cannot be declared with parentheses">;
+ "structured binding declaration cannot be declared with parentheses">;
def err_decomp_decl_template : Error<
- "decomposition declaration cannot be a template">;
+ "structured binding declaration cannot be a template">;
def err_decomp_decl_not_alone : Error<
- "decomposition declaration must be the only declaration in its group">;
+ "structured binding declaration must be the only declaration in its group">;
def err_decomp_decl_requires_init : Error<
- "decomposition declaration %0 requires an initializer">;
+ "structured binding declaration %0 requires an initializer">;
def err_decomp_decl_wrong_number_bindings : Error<
- "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
+ "type %0 binds to %3 %plural{1:element|:elements}2, but "
"%select{%plural{0:no|:only %1}1|%1}4 "
"%plural{1:name was|:names were}1 provided">;
def err_decomp_decl_unbindable_type : Error<
- "cannot decompose %select{union|non-class, non-array}1 type %2">;
+ "cannot bind %select{union|non-class, non-array}1 type %2">;
def err_decomp_decl_multiple_bases_with_members : Error<
- "cannot decompose class type %1: "
+ "cannot bind class type %1: "
"%select{its base classes %2 and|both it and its base class}0 %3 "
"have non-static data members">;
def err_decomp_decl_ambiguous_base : Error<
- "cannot decompose members of ambiguous base class %1 of %0:%2">;
+ "cannot bind members of ambiguous base class %1 of %0:%2">;
def err_decomp_decl_inaccessible_base : Error<
- "cannot decompose members of inaccessible base class %1 of %0">,
+ "cannot bind members of inaccessible base class %1 of %0">,
AccessControl;
def err_decomp_decl_inaccessible_field : Error<
- "cannot decompose %select{private|protected}0 member %1 of %3">,
+ "cannot bind %select{private|protected}0 member %1 of %3">,
AccessControl;
def err_decomp_decl_lambda : Error<
- "cannot decompose lambda closure type">;
+ "cannot bind lambda closure type">;
def err_decomp_decl_anon_union_member : Error<
- "cannot decompose class type %0 because it has an anonymous "
+ "cannot bind class type %0 because it has an anonymous "
"%select{struct|union}1 member">;
def err_decomp_decl_std_tuple_element_not_specialized : Error<
- "cannot decompose this type; 'std::tuple_element<%0>::type' "
+ "cannot bind this type; 'std::tuple_element<%0>::type' "
"does not name a type">;
def err_decomp_decl_std_tuple_size_not_constant : Error<
- "cannot decompose this type; 'std::tuple_size<%0>::value' "
+ "cannot bind this type; 'std::tuple_size<%0>::value' "
"is not a valid integral constant expression">;
def err_decomp_decl_std_tuple_size_invalid
- : Error<"cannot decompose this type; 'std::tuple_size<%0>::value' "
+ : Error<"cannot bind this type; 'std::tuple_size<%0>::value' "
"is not a valid size: %1">;
def note_in_binding_decl_init : Note<
"in implicit initialization of binding declaration %0">;
def err_arg_is_not_destructurable : Error<
- "type %0 cannot be decomposed">;
+ "type %0 cannot be bound">;
def err_std_type_trait_not_class_template : Error<
"unsupported standard library implementation: "
@@ -2620,7 +2620,7 @@ def err_auto_variable_cannot_appear_in_own_initializer
"declared with deduced type %2 cannot appear in its own initializer">;
def err_binding_cannot_appear_in_own_initializer : Error<
"binding %0 cannot appear in the initializer of its own "
- "decomposition declaration">;
+ "structured binding declaration">;
def err_new_array_of_auto : Error<
"cannot allocate array of 'auto'">;
def err_auto_not_allowed : Error<
@@ -13070,6 +13070,12 @@ def warn_cuda_maxclusterrank_sm_90 : Warning<
"maxclusterrank requires sm_90 or higher, CUDA arch provided: %0, ignoring "
"%1 attribute">, InGroup<IgnoredAttributes>;
+def err_cluster_attr_not_supported : Error<
+ "%0 is not supported for this GPU architecture">;
+
+def err_cluster_dims_too_large : Error<
+ "cluster does not support more than %0 thread blocks; %1 provided">;
+
// VTable pointer authentication errors
def err_non_polymorphic_vtable_pointer_auth : Error<
"cannot set vtable pointer authentication on monomorphic type %0">;
@@ -13665,6 +13671,11 @@ def warn_acc_var_referenced_lacks_op
"reference has no effect">,
InGroup<DiagGroup<"openacc-var-lacks-operation">>,
DefaultError;
+def err_acc_reduction_recipe_no_op
+ : Error<"variable of type %0 referenced in OpenACC 'reduction' clause does "
+ "not have a valid operation available">;
+def note_acc_reduction_recipe_noop_field
+ : Note<"while forming combiner for compound type %0">;
// AMDGCN builtins diagnostics
def err_amdgcn_load_lds_size_invalid_value : Error<"invalid size value">;
diff --git a/clang/include/clang/Basic/DiagnosticSerializationKinds.td b/clang/include/clang/Basic/DiagnosticSerializationKinds.td
index fc3585f..b80aff3 100644
--- a/clang/include/clang/Basic/DiagnosticSerializationKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSerializationKinds.td
@@ -86,6 +86,10 @@ def remark_module_import : Remark<
"importing module '%0'%select{| into '%3'}2 from '%1'">,
ShowInSystemHeader,
InGroup<ModuleImport>;
+def remark_module_validation : Remark<
+ "validating %0 input files in module '%1' from '%2'">,
+ ShowInSystemHeader,
+ InGroup<ModuleValidation>;
def err_imported_module_not_found : Error<
"module '%0' in precompiled file '%1' %select{(imported by precompiled file '%2') |}4"
diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index 9e85008..8d6b8a1 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -243,6 +243,7 @@ ENUM_LANGOPT(HLSLVersion, HLSLLangStd, 16, HLSL_Unset, NotCompatible, "HLSL Vers
LANGOPT(HLSLStrictAvailability, 1, 0, NotCompatible,
"Strict availability diagnostic mode for HLSL built-in functions.")
LANGOPT(HLSLSpvUseUnknownImageFormat, 1, 0, NotCompatible, "For storage images and texel buffers, sets the default format to 'Unknown' when not specified via the `vk::image_format` attribute. If this option is not used, the format is inferred from the resource's data type.")
+LANGOPT(HLSLSpvEnableMaximalReconvergence, 1, 0, NotCompatible, "Enables the MaximallyReconvergesKHR execution mode for this module. This ensures that control flow reconverges at well-defined merge points as defined by the Vulkan spec.")
LANGOPT(CUDAIsDevice , 1, 0, NotCompatible, "compiling for CUDA device")
LANGOPT(CUDAHostDeviceConstexpr, 1, 1, NotCompatible, "treating unattributed constexpr functions as __host__ __device__")
@@ -432,6 +433,7 @@ ENUM_LANGOPT(RegisterStaticDestructors, RegisterStaticDestructorsKind, 2,
LANGOPT(RegCall4, 1, 0, NotCompatible, "Set __regcall4 as a default calling convention to respect __regcall ABI v.4")
LANGOPT(MatrixTypes, 1, 0, NotCompatible, "Enable or disable the builtin matrix type")
+VALUE_LANGOPT(MaxMatrixDimension, 32, (1 << 20) - 1, NotCompatible, "maximum allowed matrix dimension")
LANGOPT(CXXAssumptions, 1, 1, NotCompatible, "Enable or disable codegen and compile-time checks for C++23's [[assume]] attribute")
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index 41595ec..260a753 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -756,6 +756,15 @@ public:
bool isTargetDevice() const {
return OpenMPIsTargetDevice || CUDAIsDevice || SYCLIsDevice;
}
+
+ /// Returns the most applicable C standard-compliant language version code.
+ /// If none could be determined, returns \ref std::nullopt.
+ std::optional<uint32_t> getCLangStd() const;
+
+ /// Returns the most applicable C++ standard-compliant language
+ /// version code.
+ /// If none could be determined, returns \ref std::nullopt.
+ std::optional<uint32_t> getCPlusPlusLangStd() const;
};
/// Floating point control options
diff --git a/clang/include/clang/Basic/LangStandard.h b/clang/include/clang/Basic/LangStandard.h
index 4941223..64645fe 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -70,8 +70,7 @@ enum LangFeatures {
/// standard.
struct LangStandard {
enum Kind {
-#define LANGSTANDARD(id, name, lang, desc, features) \
- lang_##id,
+#define LANGSTANDARD(id, name, lang, desc, features, version) lang_##id,
#include "clang/Basic/LangStandards.def"
lang_unspecified
};
@@ -80,6 +79,7 @@ struct LangStandard {
const char *Description;
unsigned Flags;
clang::Language Language;
+ std::optional<uint32_t> Version;
public:
/// getName - Get the name of this standard.
@@ -91,6 +91,9 @@ public:
/// Get the language that this standard describes.
clang::Language getLanguage() const { return Language; }
+ /// Get the version code for this language standard.
+ std::optional<uint32_t> getVersion() const { return Version; }
+
/// Language supports '//' comments.
bool hasLineComments() const { return Flags & LineComment; }
diff --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
index 244692a..4edc935 100644
--- a/clang/include/clang/Basic/LangStandards.def
+++ b/clang/include/clang/Basic/LangStandards.def
@@ -10,7 +10,7 @@
#error "LANGSTANDARD must be defined before including this file"
#endif
-/// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES)
+/// LANGSTANDARD(IDENT, NAME, LANG, DESC, FEATURES, VERSION)
///
/// \param IDENT - The name of the standard as a C++ identifier.
/// \param NAME - The name of the standard.
@@ -18,6 +18,8 @@
/// \param DESC - A short description of the standard.
/// \param FEATURES - The standard features as flags, these are enums from the
/// clang::frontend namespace, which is assumed to be available.
+/// \param VERSION - The official version code for this standard.
+/// Has value 'std::nullopt' if no official version exists.
/// LANGSTANDARD_ALIAS(IDENT, ALIAS)
/// \param IDENT - The name of the standard as a C++ identifier.
@@ -36,186 +38,188 @@
// C89-ish modes.
LANGSTANDARD(c89, "c89",
- C, "ISO C 1990", 0)
+ C, "ISO C 1990", 0, std::nullopt)
LANGSTANDARD_ALIAS(c89, "c90")
LANGSTANDARD_ALIAS(c89, "iso9899:1990")
LANGSTANDARD(c94, "iso9899:199409",
C, "ISO C 1990 with amendment 1",
- Digraphs)
+ Digraphs, 199409)
LANGSTANDARD(gnu89, "gnu89",
C, "ISO C 1990 with GNU extensions",
- LineComment | Digraphs | GNUMode)
+ LineComment | Digraphs | GNUMode, std::nullopt)
LANGSTANDARD_ALIAS(gnu89, "gnu90")
// C99-ish modes
LANGSTANDARD(c99, "c99",
C, "ISO C 1999",
- LineComment | C99 | Digraphs | HexFloat)
+ LineComment | C99 | Digraphs | HexFloat, 199901)
LANGSTANDARD_ALIAS(c99, "iso9899:1999")
LANGSTANDARD_ALIAS_DEPR(c99, "c9x")
LANGSTANDARD_ALIAS_DEPR(c99, "iso9899:199x")
LANGSTANDARD(gnu99, "gnu99",
C, "ISO C 1999 with GNU extensions",
- LineComment | C99 | Digraphs | GNUMode | HexFloat)
+ LineComment | C99 | Digraphs | GNUMode | HexFloat, 199901)
LANGSTANDARD_ALIAS_DEPR(gnu99, "gnu9x")
// C11 modes
LANGSTANDARD(c11, "c11",
C, "ISO C 2011",
- LineComment | C99 | C11 | Digraphs | HexFloat)
+ LineComment | C99 | C11 | Digraphs | HexFloat, 201112)
LANGSTANDARD_ALIAS(c11, "iso9899:2011")
LANGSTANDARD_ALIAS_DEPR(c11, "c1x")
LANGSTANDARD_ALIAS_DEPR(c11, "iso9899:201x")
LANGSTANDARD(gnu11, "gnu11",
C, "ISO C 2011 with GNU extensions",
- LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat)
+ LineComment | C99 | C11 | Digraphs | GNUMode | HexFloat, 201112)
LANGSTANDARD_ALIAS_DEPR(gnu11, "gnu1x")
// C17 modes
LANGSTANDARD(c17, "c17",
C, "ISO C 2017",
- LineComment | C99 | C11 | C17 | Digraphs | HexFloat)
+ LineComment | C99 | C11 | C17 | Digraphs | HexFloat, 201710)
LANGSTANDARD_ALIAS(c17, "iso9899:2017")
LANGSTANDARD_ALIAS(c17, "c18")
LANGSTANDARD_ALIAS(c17, "iso9899:2018")
LANGSTANDARD(gnu17, "gnu17",
C, "ISO C 2017 with GNU extensions",
- LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat)
+ LineComment | C99 | C11 | C17 | Digraphs | GNUMode | HexFloat, 201710)
LANGSTANDARD_ALIAS(gnu17, "gnu18")
// C23 modes
LANGSTANDARD(c23, "c23",
C, "ISO C 2023",
- LineComment | C99 | C11 | C17 | C23 | Digraphs | HexFloat)
+ LineComment | C99 | C11 | C17 | C23 | Digraphs | HexFloat, 202311)
LANGSTANDARD_ALIAS(c23, "iso9899:2024")
LANGSTANDARD_ALIAS_DEPR(c23, "c2x")
LANGSTANDARD(gnu23, "gnu23",
C, "ISO C 2023 with GNU extensions",
- LineComment | C99 | C11 | C17 | C23 | Digraphs | GNUMode | HexFloat)
+ LineComment | C99 | C11 | C17 | C23 | Digraphs | GNUMode | HexFloat, 202311)
LANGSTANDARD_ALIAS_DEPR(gnu23, "gnu2x")
// C2y modes
+// FIXME: Use correct version code for C2y once published.
LANGSTANDARD(c2y, "c2y",
C, "Working Draft for ISO C2y",
- LineComment | C99 | C11 | C17 | C23 | C2y | Digraphs | HexFloat)
+ LineComment | C99 | C11 | C17 | C23 | C2y | Digraphs | HexFloat, 202400)
LANGSTANDARD(gnu2y, "gnu2y",
C, "Working Draft for ISO C2y with GNU extensions",
- LineComment | C99 | C11 | C17 | C23 | C2y | Digraphs | GNUMode | HexFloat)
+ LineComment | C99 | C11 | C17 | C23 | C2y | Digraphs | GNUMode | HexFloat, 202400)
// TODO: Add the iso9899:202y alias once ISO publishes the standard.
// C++ modes
LANGSTANDARD(cxx98, "c++98",
CXX, "ISO C++ 1998 with amendments",
- LineComment | CPlusPlus | Digraphs)
+ LineComment | CPlusPlus | Digraphs, 199711)
LANGSTANDARD_ALIAS(cxx98, "c++03")
LANGSTANDARD(gnucxx98, "gnu++98",
CXX, "ISO C++ 1998 with amendments and GNU extensions",
- LineComment | CPlusPlus | Digraphs | GNUMode)
+ LineComment | CPlusPlus | Digraphs | GNUMode, 199711)
LANGSTANDARD_ALIAS(gnucxx98, "gnu++03")
LANGSTANDARD(cxx11, "c++11",
CXX, "ISO C++ 2011 with amendments",
- LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
+ LineComment | CPlusPlus | CPlusPlus11 | Digraphs, 201103)
LANGSTANDARD_ALIAS_DEPR(cxx11, "c++0x")
LANGSTANDARD(gnucxx11, "gnu++11", CXX,
"ISO C++ 2011 with amendments and GNU extensions",
- LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)
+ LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode, 201103)
LANGSTANDARD_ALIAS_DEPR(gnucxx11, "gnu++0x")
LANGSTANDARD(cxx14, "c++14",
CXX, "ISO C++ 2014 with amendments",
- LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs)
+ LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs, 201402)
LANGSTANDARD_ALIAS_DEPR(cxx14, "c++1y")
LANGSTANDARD(gnucxx14, "gnu++14",
CXX, "ISO C++ 2014 with amendments and GNU extensions",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | Digraphs |
- GNUMode)
+ GNUMode, 201402)
LANGSTANDARD_ALIAS_DEPR(gnucxx14, "gnu++1y")
LANGSTANDARD(cxx17, "c++17",
CXX, "ISO C++ 2017 with amendments",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat)
+ Digraphs | HexFloat, 201703)
LANGSTANDARD_ALIAS_DEPR(cxx17, "c++1z")
LANGSTANDARD(gnucxx17, "gnu++17",
CXX, "ISO C++ 2017 with amendments and GNU extensions",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat | GNUMode)
+ Digraphs | HexFloat | GNUMode, 201703)
LANGSTANDARD_ALIAS_DEPR(gnucxx17, "gnu++1z")
LANGSTANDARD(cxx20, "c++20",
CXX, "ISO C++ 2020 DIS",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus20 | Digraphs | HexFloat)
+ CPlusPlus20 | Digraphs | HexFloat, 202002)
LANGSTANDARD_ALIAS_DEPR(cxx20, "c++2a")
LANGSTANDARD(gnucxx20, "gnu++20",
CXX, "ISO C++ 2020 DIS with GNU extensions",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus20 | Digraphs | HexFloat | GNUMode)
+ CPlusPlus20 | Digraphs | HexFloat | GNUMode, 202002)
LANGSTANDARD_ALIAS_DEPR(gnucxx20, "gnu++2a")
LANGSTANDARD(cxx23, "c++23",
CXX, "ISO C++ 2023 DIS",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus20 | CPlusPlus23 | Digraphs | HexFloat)
+ CPlusPlus20 | CPlusPlus23 | Digraphs | HexFloat, 202302)
LANGSTANDARD_ALIAS_DEPR(cxx23, "c++2b")
LANGSTANDARD(gnucxx23, "gnu++23",
CXX, "ISO C++ 2023 DIS with GNU extensions",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus20 | CPlusPlus23 | Digraphs | HexFloat | GNUMode)
+ CPlusPlus20 | CPlusPlus23 | Digraphs | HexFloat | GNUMode, 202302)
LANGSTANDARD_ALIAS_DEPR(gnucxx23, "gnu++2b")
+// FIXME: Use correct version code for C++26 once published.
LANGSTANDARD(cxx26, "c++2c",
CXX, "Working draft for C++2c",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus20 | CPlusPlus23 | CPlusPlus26 | Digraphs | HexFloat)
+ CPlusPlus20 | CPlusPlus23 | CPlusPlus26 | Digraphs | HexFloat, 202400)
LANGSTANDARD_ALIAS(cxx26, "c++26")
LANGSTANDARD(gnucxx26, "gnu++2c",
CXX, "Working draft for C++2c with GNU extensions",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- CPlusPlus20 | CPlusPlus23 | CPlusPlus26 | Digraphs | HexFloat | GNUMode)
+ CPlusPlus20 | CPlusPlus23 | CPlusPlus26 | Digraphs | HexFloat | GNUMode, 202400)
LANGSTANDARD_ALIAS(gnucxx26, "gnu++26")
// OpenCL
LANGSTANDARD(opencl10, "cl1.0",
OpenCL, "OpenCL 1.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
+ LineComment | C99 | Digraphs | HexFloat | OpenCL, std::nullopt)
LANGSTANDARD_ALIAS_DEPR(opencl10, "cl")
LANGSTANDARD(opencl11, "cl1.1",
OpenCL, "OpenCL 1.1",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
+ LineComment | C99 | Digraphs | HexFloat | OpenCL, std::nullopt)
LANGSTANDARD(opencl12, "cl1.2",
OpenCL, "OpenCL 1.2",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
+ LineComment | C99 | Digraphs | HexFloat | OpenCL, std::nullopt)
LANGSTANDARD(opencl20, "cl2.0",
OpenCL, "OpenCL 2.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
+ LineComment | C99 | Digraphs | HexFloat | OpenCL, std::nullopt)
LANGSTANDARD(opencl30, "cl3.0",
OpenCL, "OpenCL 3.0",
- LineComment | C99 | Digraphs | HexFloat | OpenCL)
+ LineComment | C99 | Digraphs | HexFloat | OpenCL, std::nullopt)
LANGSTANDARD(openclcpp10, "clc++1.0",
OpenCL, "C++ for OpenCL 1.0",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat | OpenCL)
+ Digraphs | HexFloat | OpenCL, std::nullopt)
LANGSTANDARD_ALIAS(openclcpp10, "clc++")
LANGSTANDARD(openclcpp2021, "clc++2021",
OpenCL, "C++ for OpenCL 2021",
LineComment | CPlusPlus | CPlusPlus11 | CPlusPlus14 | CPlusPlus17 |
- Digraphs | HexFloat | OpenCL)
+ Digraphs | HexFloat | OpenCL, std::nullopt)
LANGSTANDARD_ALIAS_DEPR(opencl10, "CL")
LANGSTANDARD_ALIAS_DEPR(opencl11, "CL1.1")
@@ -229,35 +233,35 @@ LANGSTANDARD_ALIAS_DEPR(openclcpp2021, "CLC++2021")
// HLSL
LANGSTANDARD(hlsl, "hlsl",
HLSL, "High Level Shader Language",
- LineComment | HLSL | CPlusPlus | CPlusPlus11)
+ LineComment | HLSL | CPlusPlus | CPlusPlus11, std::nullopt)
LANGSTANDARD(hlsl2015, "hlsl2015",
HLSL, "High Level Shader Language 2015",
- LineComment | HLSL | CPlusPlus | CPlusPlus11)
+ LineComment | HLSL | CPlusPlus | CPlusPlus11, std::nullopt)
LANGSTANDARD(hlsl2016, "hlsl2016",
HLSL, "High Level Shader Language 2016",
- LineComment | HLSL | CPlusPlus | CPlusPlus11)
+ LineComment | HLSL | CPlusPlus | CPlusPlus11, std::nullopt)
LANGSTANDARD(hlsl2017, "hlsl2017",
HLSL, "High Level Shader Language 2017",
- LineComment | HLSL | CPlusPlus | CPlusPlus11)
+ LineComment | HLSL | CPlusPlus | CPlusPlus11, std::nullopt)
LANGSTANDARD(hlsl2018, "hlsl2018",
HLSL, "High Level Shader Language 2018",
- LineComment | HLSL | CPlusPlus | CPlusPlus11)
+ LineComment | HLSL | CPlusPlus | CPlusPlus11, std::nullopt)
LANGSTANDARD(hlsl2021, "hlsl2021",
HLSL, "High Level Shader Language 2021",
- LineComment | HLSL | CPlusPlus | CPlusPlus11)
+ LineComment | HLSL | CPlusPlus | CPlusPlus11, std::nullopt)
LANGSTANDARD(hlsl202x, "hlsl202x",
HLSL, "High Level Shader Language 202x",
- LineComment | HLSL | CPlusPlus | CPlusPlus11)
+ LineComment | HLSL | CPlusPlus | CPlusPlus11, std::nullopt)
LANGSTANDARD(hlsl202y, "hlsl202y",
HLSL, "High Level Shader Language 202y",
- LineComment | HLSL | CPlusPlus | CPlusPlus11)
+ LineComment | HLSL | CPlusPlus | CPlusPlus11, std::nullopt)
#undef LANGSTANDARD
diff --git a/clang/include/clang/Basic/OpenACCKinds.h b/clang/include/clang/Basic/OpenACCKinds.h
index 9383856..8d52e13 100644
--- a/clang/include/clang/Basic/OpenACCKinds.h
+++ b/clang/include/clang/Basic/OpenACCKinds.h
@@ -494,7 +494,7 @@ inline StreamTy &printOpenACCClauseKind(StreamTy &Out, OpenACCClauseKind K) {
case OpenACCClauseKind::Shortloop:
llvm_unreachable("Shortloop shouldn't be generated in clang");
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case OpenACCClauseKind::Invalid:
return Out << "<invalid>";
}
diff --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index ceb16174..ea73ed9 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1211,6 +1211,25 @@ public:
TiedOperand = N;
// Don't copy Name or constraint string.
}
+
+ // For output operand constraints, the target can set bounds to indicate
+ // that the result value is guaranteed to fall within a certain range.
+ // This will cause corresponding assertions to be emitted that will allow
+ // for potential optimization based of that guarantee.
+ //
+ // NOTE: This re-uses the `ImmRange` fields to store the range, which are
+ // otherwise unused for constraint types used for output operands.
+ void setOutputOperandBounds(unsigned Min, unsigned Max) {
+ ImmRange.Min = Min;
+ ImmRange.Max = Max;
+ ImmRange.isConstrained = true;
+ }
+ std::optional<std::pair<unsigned, unsigned>>
+ getOutputOperandBounds() const {
+ return ImmRange.isConstrained
+ ? std::make_pair(ImmRange.Min, ImmRange.Max)
+ : std::optional<std::pair<unsigned, unsigned>>();
+ }
};
/// Validate register name used for global register variables.
diff --git a/clang/include/clang/Basic/arm_mve.td b/clang/include/clang/Basic/arm_mve.td
index 412ef9a..2e5e1d9 100644
--- a/clang/include/clang/Basic/arm_mve.td
+++ b/clang/include/clang/Basic/arm_mve.td
@@ -831,9 +831,8 @@ multiclass contiguous_load<string mnemonic, PrimitiveType memtype,
NameOverride<mnemonic>;
def: Intrinsic<Vector, (args CPtr<CopyKind<same_size[0], Scalar>>:$addr,
Predicate:$pred),
- (IRIntBase<"masked_load", [Vector, CPtr<Vector>]>
- (CPtr<Vector> $addr), !srl(memtype.size,3),
- $pred, (zeroinit Vector))>,
+ (masked_load Vector, (CPtr<Vector> $addr),
+ !srl(memtype.size,3), $pred, (zeroinit Vector))>,
NameOverride<mnemonic # "_z">;
}
@@ -846,9 +845,8 @@ multiclass contiguous_load<string mnemonic, PrimitiveType memtype,
NameOverride<"vld1q">;
def: Intrinsic<Vector, (args CPtr<CopyKind<same_size[0], Scalar>>:$addr,
Predicate:$pred),
- (IRIntBase<"masked_load", [Vector, CPtr<Vector>]>
- (CPtr<Vector> $addr), !srl(memtype.size,3),
- $pred, (zeroinit Vector))>,
+ (masked_load Vector, (CPtr<Vector> $addr),
+ !srl(memtype.size,3), $pred, (zeroinit Vector))>,
NameOverride<"vld1q_z">;
}
@@ -863,9 +861,7 @@ multiclass contiguous_load<string mnemonic, PrimitiveType memtype,
NameOverride<mnemonic>;
def: Intrinsic<Vector, (args CPtr<CopyKind<same_size[0], Scalar>>:$addr,
Predicate:$pred),
- (extend (IRIntBase<"masked_load",
- [NarrowedVecOf<memtype,Vector>,
- CPtr<NarrowedVecOf<memtype,Vector>>]>
+ (extend (masked_load NarrowedVecOf<memtype,Vector>,
(CPtr<NarrowedVecOf<memtype,Vector>> $addr),
!srl(memtype.size,3), $pred,
(zeroinit NarrowedVecOf<memtype,Vector>)),
@@ -890,8 +886,7 @@ multiclass contiguous_store<string mnemonic, PrimitiveType memtype,
NameOverride<mnemonic>;
def: Intrinsic<Void, (args Ptr<CopyKind<same_size[0], Scalar>>:$addr,
Vector:$value, Predicate:$pred),
- (IRIntBase<"masked_store", [Vector, Ptr<Vector>]>
- $value, (Ptr<Vector> $addr),
+ (masked_store $value, (Ptr<Vector> $addr),
!srl(memtype.size,3), $pred)>,
NameOverride<mnemonic # "_p">;
}
@@ -907,8 +902,7 @@ multiclass contiguous_store<string mnemonic, PrimitiveType memtype,
NameOverride<"vst1q">;
def: Intrinsic<Void, (args Ptr<CopyKind<same_size[0], Scalar>>:$addr,
Vector:$value, Predicate:$pred),
- (IRIntBase<"masked_store", [Vector, Ptr<Vector>]>
- $value, (Ptr<Vector> $addr),
+ (masked_store $value, (Ptr<Vector> $addr),
!srl(memtype.size,3), $pred)>,
NameOverride<"vst1q_p">;
}
@@ -925,9 +919,7 @@ multiclass contiguous_store<string mnemonic, PrimitiveType memtype,
NameOverride<mnemonic>;
def: Intrinsic<Void, (args Ptr<CopyKind<same_size[0], Scalar>>:$addr,
Vector:$value, Predicate:$pred),
- (IRIntBase<"masked_store",
- [NarrowedVecOf<memtype,Vector>,
- Ptr<NarrowedVecOf<memtype,Vector>>]>
+ (masked_store
(trunc $value, NarrowedVecOf<memtype,Vector>),
(Ptr<NarrowedVecOf<memtype,Vector>> $addr),
!srl(memtype.size,3), $pred)>,
diff --git a/clang/include/clang/Basic/arm_mve_defs.td b/clang/include/clang/Basic/arm_mve_defs.td
index 083d03a..c1562a0 100644
--- a/clang/include/clang/Basic/arm_mve_defs.td
+++ b/clang/include/clang/Basic/arm_mve_defs.td
@@ -134,6 +134,13 @@ def unzip: CGHelperFn<"VectorUnzip"> {
}
def zip: CGHelperFn<"VectorZip">;
+def masked_load: IRBuilder<"CreateMaskedLoad"> {
+ let special_params = [IRBuilderIntParam<2, "Align">];
+}
+def masked_store: IRBuilder<"CreateMaskedStore"> {
+ let special_params = [IRBuilderIntParam<2, "Align">];
+}
+
// Trivial 'codegen' function that just returns its argument. Useful
// for wrapping up a variable name like $foo into a thing you can pass
// around as type 'dag'.
diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
index b4c24d7..3ac8987 100644
--- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
+++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
@@ -127,6 +127,14 @@ public:
cir::BoolType getBoolTy() { return cir::BoolType::get(getContext()); }
cir::VoidType getVoidTy() { return cir::VoidType::get(getContext()); }
+ cir::IntType getUIntNTy(int n) {
+ return cir::IntType::get(getContext(), n, false);
+ }
+
+ cir::IntType getSIntNTy(int n) {
+ return cir::IntType::get(getContext(), n, true);
+ }
+
cir::PointerType getPointerTo(mlir::Type ty) {
return cir::PointerType::get(ty);
}
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRAttrConstraints.td b/clang/include/clang/CIR/Dialect/IR/CIRAttrConstraints.td
index 8f72ff4..2548d46 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRAttrConstraints.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRAttrConstraints.td
@@ -39,13 +39,31 @@ def CIR_AnyIntOrFloatAttr : AnyAttrOf<[CIR_AnyIntAttr, CIR_AnyFPAttr],
}
//===----------------------------------------------------------------------===//
+// Exceptions constraints
+//===----------------------------------------------------------------------===//
+
+def CIR_AnyCatchAllAttr
+ : CIR_AttrConstraint<"::cir::CatchAllAttr", "catch all attribute">;
+
+def CIR_AnyUnwindAttr
+ : CIR_AttrConstraint<"::cir::UnwindAttr", "unwind attribute">;
+
+//===----------------------------------------------------------------------===//
// GlobalViewAttr constraints
//===----------------------------------------------------------------------===//
-def CIR_AnyGlobalViewAttr : CIR_AttrConstraint<"::cir::GlobalViewAttr", "GlobalView attribute">;
+def CIR_AnyGlobalViewAttr
+ : CIR_AttrConstraint<"::cir::GlobalViewAttr", "GlobalView attribute">;
-def CIR_AnyIntOrGlobalViewAttr : AnyAttrOf<[CIR_AnyIntAttr, CIR_AnyGlobalViewAttr],
- "integer or global view attribute"> {
+def CIR_AnyIntOrGlobalViewAttr
+ : AnyAttrOf<[CIR_AnyIntAttr, CIR_AnyGlobalViewAttr],
+ "integer or global view attribute"> {
+ string cppType = "::mlir::TypedAttr";
+}
+
+def CIR_TryHandlerAttr
+ : AnyAttrOf<[CIR_AnyGlobalViewAttr, CIR_AnyCatchAllAttr, CIR_AnyUnwindAttr],
+ "catch all or unwind or global view attribute"> {
string cppType = "::mlir::TypedAttr";
}
@@ -61,4 +79,7 @@ def CIR_IntOrGlobalViewArrayAttr : TypedArrayAttrBase<CIR_AnyIntOrGlobalViewAttr
string cppType = "::mlir::ArrayAttr";
}
-#endif // CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD \ No newline at end of file
+def CIR_TryHandlerArrayAttr : TypedArrayAttrBase<CIR_TryHandlerAttr,
+ "catch all or unwind or global view array attribute">;
+
+#endif // CLANG_CIR_DIALECT_IR_CIRATTRCONSTRAINTS_TD
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
index bb62223..1e0fb03 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
@@ -814,6 +814,14 @@ def CIR_GlobalCtorAttr : CIR_GlobalCtorDtor<"Ctor", "ctor"> {
}];
}
+def CIR_GlobalDtorAttr : CIR_GlobalCtorDtor<"Dtor", "dtor"> {
+ let summary = "Marks a function as a global destructor";
+ let description = [{
+ Marks a function as a global destructor in the module dtors list.
+ The function will be executed before the module unloading.
+ }];
+}
+
//===----------------------------------------------------------------------===//
// BitfieldInfoAttr
//===----------------------------------------------------------------------===//
@@ -959,5 +967,63 @@ def CIR_TypeInfoAttr : CIR_Attr<"TypeInfo", "typeinfo", [TypedAttrInterface]> {
`<` custom<RecordMembers>($data) `>`
}];
}
+//===----------------------------------------------------------------------===//
+// InlineAttr
+//===----------------------------------------------------------------------===//
+
+def CIR_InlineKind : CIR_I32EnumAttr<"InlineKind", "inlineKind", [
+ I32EnumAttrCase<"NoInline", 1, "never">,
+ I32EnumAttrCase<"AlwaysInline", 2, "always">,
+ I32EnumAttrCase<"InlineHint", 3, "hint">
+]> {
+ let genSpecializedAttr = 0;
+}
+
+def CIR_InlineAttr : CIR_EnumAttr<CIR_InlineKind, "inline"> {
+ let summary = "Inline attribute";
+ let description = [{
+ Inline attribute represents user directives for inlining behavior.
+ This attribute is only used by `cir.func` operations.
+
+ Values:
+ - `never`: Prevents the function from being inlined (__attribute__((noinline)))
+ - `always`: Forces the function to be inlined (__attribute__((always_inline)))
+ - `hint`: Suggests the function should be inlined (inline keyword)
+
+ Example:
+ ```
+ cir.func @noinline_func(%arg0: !s32i) -> !s32i inline(never) {
+ cir.return %arg0 : !s32i
+ }
+ cir.func @always_inline_func() -> !s32i inline(always) {
+ %0 = cir.const #cir.int<42> : !s32i
+ cir.return %0 : !s32i
+ }
+ ```
+ }];
+
+ let cppClassName = "InlineAttr";
+
+ let extraClassDeclaration = [{
+ bool isNoInline() const { return getValue() == InlineKind::NoInline; };
+ bool isAlwaysInline() const { return getValue() == InlineKind::AlwaysInline; };
+ bool isInlineHint() const { return getValue() == InlineKind::InlineHint; };
+ }];
+}
+
+//===----------------------------------------------------------------------===//
+// CatchAllAttr & UnwindAttr
+//===----------------------------------------------------------------------===//
+
+// Represents the catch_all region.
+def CIR_CatchAllAttr : CIR_UnitAttr<"CatchAll", "all"> {
+ let storageType = [{ CatchAllAttr }];
+}
+
+// Represents the unwind region where unwind continues or
+// the program std::terminate's.
+def CIR_UnwindAttr : CIR_UnitAttr<"Unwind", "unwind"> {
+ let storageType = [{ CatchUnwind }];
+}
#endif // CLANG_CIR_DIALECT_IR_CIRATTRS_TD
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
index feb08d60..e915371 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRDialect.td
@@ -43,6 +43,7 @@ def CIR_Dialect : Dialect {
static llvm::StringRef getSideEffectAttrName() { return "side_effect"; }
static llvm::StringRef getModuleLevelAsmAttrName() { return "cir.module_asm"; }
static llvm::StringRef getGlobalCtorsAttrName() { return "cir.global_ctors"; }
+ static llvm::StringRef getGlobalDtorsAttrName() { return "cir.global_dtors"; }
void registerAttributes();
void registerTypes();
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 27fe0cc..e0163a4 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -89,6 +89,19 @@ class CIR_Op<string mnemonic, list<Trait> traits = []> :
}
//===----------------------------------------------------------------------===//
+// CIR Operation Traits
+//===----------------------------------------------------------------------===//
+
+class HasAtMostOneOfAttrsPred<list<string> names> :
+ CPred<!foldl("0", names, acc, name, acc # " + (" # name # " ? 1 : 0)")
+ # " <= 1">;
+
+class HasAtMostOneOfAttrs<list<string> names> : PredOpTrait<
+ "has only one of the optional attributes: " # !interleave(names, ", "),
+ HasAtMostOneOfAttrsPred<!foreach(name, names, "$" # name)>
+>;
+
+//===----------------------------------------------------------------------===//
// CastOp
//===----------------------------------------------------------------------===//
@@ -631,7 +644,7 @@ def CIR_StoreOp : CIR_Op<"store", [
defvar CIR_ReturnableScopes = [
"FuncOp", "ScopeOp", "IfOp", "SwitchOp", "CaseOp",
- "DoWhileOp", "WhileOp", "ForOp"
+ "DoWhileOp", "WhileOp", "ForOp", "TryOp"
];
def CIR_ReturnOp : CIR_Op<"return", [
@@ -778,7 +791,7 @@ def CIR_ConditionOp : CIR_Op<"condition", [
defvar CIR_YieldableScopes = [
"ArrayCtor", "ArrayDtor", "CaseOp", "DoWhileOp", "ForOp", "GlobalOp", "IfOp",
- "ScopeOp", "SwitchOp", "TernaryOp", "WhileOp"
+ "ScopeOp", "SwitchOp", "TernaryOp", "WhileOp", "TryOp"
];
def CIR_YieldOp : CIR_Op<"yield", [
@@ -2422,9 +2435,17 @@ def CIR_GetMemberOp : CIR_Op<"get_member"> {
// TODO(CIR): FuncOp is still a tiny shell of what it will become. Many more
// properties and attributes will be added as upstreaming continues.
+def CIR_OptionalPriorityAttr : OptionalAttr<
+ DefaultValuedAttr<
+ ConfinedAttr<I32Attr, [IntMinValue<101>, IntMaxValue<65535>]>,
+ "65535"
+ >
+>;
+
def CIR_FuncOp : CIR_Op<"func", [
AutomaticAllocationScope, CallableOpInterface, FunctionOpInterface,
DeclareOpInterfaceMethods<CIRGlobalValueInterface>,
+ HasAtMostOneOfAttrs<["global_ctor_priority", "global_dtor_priority"]>,
IsolatedFromAbove
]> {
let summary = "Declare or define a function";
@@ -2449,6 +2470,16 @@ def CIR_FuncOp : CIR_Op<"func", [
without a prototype and, consequently, may contain calls with invalid
arguments and undefined behavior.
+ The `global_ctor` keyword indicates whether a function should execute before
+ `main()` function, as specified by `__attribute__((constructor))`. An
+ execution priority can also be specified `global_ctor(<priority>)`.
+ Similarly, for global destructors both `global_dtor` and
+ `global_dtor(<priority>)` are available.
+
+ The `inline(never)` keyword marks a function that should not be inlined.
+ The `inline(always)` keyword marks a function that should always be inlined.
+ The `inline(hint)` keyword suggests that the function should be inlined.
+
Example:
```mlir
@@ -2483,11 +2514,14 @@ def CIR_FuncOp : CIR_Op<"func", [
UnitAttr:$dso_local,
DefaultValuedAttr<CIR_GlobalLinkageKind,
"cir::GlobalLinkageKind::ExternalLinkage">:$linkage,
+ OptionalAttr<CIR_InlineAttr>:$inline_kind,
OptionalAttr<StrAttr>:$sym_visibility,
UnitAttr:$comdat,
OptionalAttr<DictArrayAttr>:$arg_attrs,
OptionalAttr<DictArrayAttr>:$res_attrs,
- OptionalAttr<FlatSymbolRefAttr>:$aliasee);
+ OptionalAttr<FlatSymbolRefAttr>:$aliasee,
+ CIR_OptionalPriorityAttr:$global_ctor_priority,
+ CIR_OptionalPriorityAttr:$global_dtor_priority);
let regions = (region AnyRegion:$body);
@@ -4016,6 +4050,43 @@ def CIR_ExpectOp : CIR_Op<"expect", [
}
//===----------------------------------------------------------------------===//
+// PtrDiffOp
+//===----------------------------------------------------------------------===//
+
+def CIR_PtrDiffOp : CIR_Op<"ptr_diff", [Pure, SameTypeOperands]> {
+ let summary = "Pointer subtraction arithmetic";
+ let description = [{
+ The cir.ptr_diff operation computes the difference between two pointers that
+ have the same element type.
+
+ The result reflects the ABI-defined size of the pointed-to type. For example,
+ subtracting two !cir.ptr<!u64i> values may yield 1, representing an 8-byte
+ difference. In contrast, for pointers to void or function types, a result of
+ 8 corresponds to an 8-byte difference.
+
+ For pointers to types whose size are not aligned with the target data
+ layout, the size is generally rounded to the next power of 2 bits. For
+ example, subtracting two !cir.ptr<!s24i> values for the _BitInt(24) type may
+ yield 1, representing a 4-byte difference (as opposed to a 3-byte
+ difference).
+
+ Example:
+
+ ```mlir
+ %7 = cir.ptr_diff %0, %1 : !cir.ptr<!u64i> -> !u64i
+ ```
+ }];
+
+ let arguments = (ins CIR_PointerType:$lhs, CIR_PointerType:$rhs);
+ let results = (outs CIR_AnyFundamentalIntType:$result);
+
+ let assemblyFormat = [{
+ $lhs `,` $rhs `:` qualified(type($lhs)) `->` qualified(type($result))
+ attr-dict
+ }];
+}
+
+//===----------------------------------------------------------------------===//
// Floating Point Ops
//===----------------------------------------------------------------------===//
@@ -4297,10 +4368,93 @@ def CIR_AllocExceptionOp : CIR_Op<"alloc.exception"> {
}
//===----------------------------------------------------------------------===//
+// TryOp
+//===----------------------------------------------------------------------===//
+
+def CIR_TryOp : CIR_Op<"try",[
+ DeclareOpInterfaceMethods<RegionBranchOpInterface>,
+ RecursivelySpeculatable, AutomaticAllocationScope, NoRegionArguments
+]> {
+ let summary = "C++ try block";
+ let description = [{
+ Holds the lexical scope of `try {}`. Note that resources used on catch
+ clauses are usually allocated in the same parent as `cir.try`.
+
+ `synthetic`: use `cir.try` to represent try/catches not originally
+ present in the source code. For example, a synthetic `cir.try` region
+ is created around the constructor call when `operator new` is used
+ so that the memory allocated will be freed if the constructor throws
+ an exception.
+
+ `cleanup`: indicates that there are cleanups that must be performed
+ when exiting the try region via exception, even if the exception is not
+ caught.
+
+ Example:
+
+ ```mlir
+ cir.try {
+ cir.call exception @function() : () -> ()
+ cir.yield
+ } catch [type #cir.global_view<@_ZTIPf> : !cir.ptr<!u8i>] {
+ ...
+ cir.yield
+ } unwind {
+ cir.resume
+ }
+ ```
+ }];
+
+ let arguments = (ins
+ UnitAttr:$synthetic,
+ UnitAttr:$cleanup,
+ DefaultValuedAttr<CIR_TryHandlerArrayAttr, "{}">:$handler_types
+ );
+
+ let regions = (region
+ AnyRegion:$try_region,
+ VariadicRegion<AnyRegion>:$handler_regions
+ );
+
+ let assemblyFormat = [{
+ (`synthetic` $synthetic^)?
+ (`cleanup` $cleanup^)?
+ $try_region
+ custom<TryHandlerRegions>($handler_regions, $handler_types)
+ attr-dict
+ }];
+
+ let builders = [
+ OpBuilder<(ins
+ "llvm::function_ref<void(mlir::OpBuilder &, "
+ "mlir::Location)>":$tryBuilder,
+ "llvm::function_ref<void(mlir::OpBuilder &, mlir::Location, "
+ "mlir::OperationState &)>":$handlersBuilder),
+ [{
+ assert(tryBuilder && "expected builder callback for 'cir.try' body");
+ assert(handlersBuilder
+ && "expected builder callback for 'handlers' body");
+
+ OpBuilder::InsertionGuard guard($_builder);
+
+ // Try body region
+ mlir::Region *tryBodyRegion = $_state.addRegion();
+
+ // Create try body region and set insertion point
+ $_builder.createBlock(tryBodyRegion);
+ tryBuilder($_builder, $_state.location);
+ handlersBuilder($_builder, $_state.location, $_state);
+ }]>
+ ];
+
+ let hasLLVMLowering = false;
+}
+
+//===----------------------------------------------------------------------===//
// Atomic operations
//===----------------------------------------------------------------------===//
-def CIR_AtomicXchg : CIR_Op<"atomic.xchg", [
+def CIR_AtomicXchgOp : CIR_Op<"atomic.xchg", [
AllTypesMatch<["result", "val"]>,
TypesMatchWith<"type of 'val' must match the pointee type of 'ptr'",
"ptr", "val", "mlir::cast<cir::PointerType>($_self).getPointee()">
@@ -4318,9 +4472,7 @@ def CIR_AtomicXchg : CIR_Op<"atomic.xchg", [
Example:
```mlir
- %res = cir.atomic.xchg(%ptr : !cir.ptr<!u64i>,
- %val : !u64i,
- seq_cst) : !u64i
+ %res = cir.atomic.xchg seq_cst %ptr, %val : !cir.ptr<!u64i> -> !u64i
```
}];
@@ -4335,12 +4487,16 @@ def CIR_AtomicXchg : CIR_Op<"atomic.xchg", [
let assemblyFormat = [{
$mem_order (`volatile` $is_volatile^)?
$ptr `,` $val
- `:` qualified(type($ptr)) `->` type($result) attr-dict
+ `:` functional-type(operands, results) attr-dict
}];
}
-def CIR_AtomicCmpXchg : CIR_Op<"atomic.cmpxchg", [
- AllTypesMatch<["old", "expected", "desired"]>
+def CIR_AtomicCmpXchgOp : CIR_Op<"atomic.cmpxchg", [
+ AllTypesMatch<["old", "expected", "desired"]>,
+ TypesMatchWith<"type of 'expected' must match the pointee type of 'ptr'",
+ "ptr", "expected", "mlir::cast<cir::PointerType>($_self).getPointee()">,
+ TypesMatchWith<"type of 'desired' must match the pointee type of 'ptr'",
+ "ptr", "desired", "mlir::cast<cir::PointerType>($_self).getPointee()">
]> {
let summary = "Atomic compare and exchange";
let description = [{
@@ -4373,12 +4529,9 @@ def CIR_AtomicCmpXchg : CIR_Op<"atomic.cmpxchg", [
Example:
```mlir
- %old, %success = cir.atomic.cmpxchg(%ptr : !cir.ptr<!u64i>,
- %expected : !u64i,
- %desired : !u64i,
- success = seq_cst,
- failure = seq_cst) weak
- : (!u64i, !cir.bool)
+ %old, %success = cir.atomic.cmpxchg weak success(seq_cst) failure(acquire)
+ %ptr, %expected, %desired
+ : (!cir.ptr<!u64i>, !u64i, !u64i) -> (!u64i, !cir.bool)
```
}];
let results = (outs CIR_AnyType:$old, CIR_BoolType:$success);
@@ -4392,20 +4545,13 @@ def CIR_AtomicCmpXchg : CIR_Op<"atomic.cmpxchg", [
UnitAttr:$is_volatile);
let assemblyFormat = [{
- `(`
- $ptr `:` qualified(type($ptr)) `,`
- $expected `:` type($expected) `,`
- $desired `:` type($desired) `,`
- `success` `=` $succ_order `,`
- `failure` `=` $fail_order
- `)`
- (`align` `(` $alignment^ `)`)?
(`weak` $weak^)?
+ `success` `(` $succ_order `)` `failure` `(` $fail_order `)`
+ $ptr `,` $expected `,` $desired
+ (`align` `(` $alignment^ `)`)?
(`volatile` $is_volatile^)?
- `:` `(` type($old) `,` type($success) `)` attr-dict
+ `:` functional-type(operands, results) attr-dict
}];
-
- let hasVerifier = 1;
}
#endif // CLANG_CIR_DIALECT_IR_CIROPS_TD
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROpsEnums.h b/clang/include/clang/CIR/Dialect/IR/CIROpsEnums.h
index 17fddae..dbd0304 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROpsEnums.h
+++ b/clang/include/clang/CIR/Dialect/IR/CIROpsEnums.h
@@ -54,10 +54,10 @@ static bool isLocalLinkage(GlobalLinkageKind linkage) {
static bool isExternalWeakLinkage(GlobalLinkageKind linkage) {
return linkage == GlobalLinkageKind::ExternalWeakLinkage;
}
-LLVM_ATTRIBUTE_UNUSED static bool isCommonLinkage(GlobalLinkageKind linkage) {
+[[maybe_unused]] static bool isCommonLinkage(GlobalLinkageKind linkage) {
return linkage == GlobalLinkageKind::CommonLinkage;
}
-LLVM_ATTRIBUTE_UNUSED static bool
+[[maybe_unused]] static bool
isValidDeclarationLinkage(GlobalLinkageKind linkage) {
return isExternalWeakLinkage(linkage) || isExternalLinkage(linkage);
}
@@ -65,8 +65,7 @@ isValidDeclarationLinkage(GlobalLinkageKind linkage) {
/// Whether the definition of this global may be replaced by something
/// non-equivalent at link time. For example, if a function has weak linkage
/// then the code defining it may be replaced by different code.
-LLVM_ATTRIBUTE_UNUSED static bool
-isInterposableLinkage(GlobalLinkageKind linkage) {
+[[maybe_unused]] static bool isInterposableLinkage(GlobalLinkageKind linkage) {
switch (linkage) {
case GlobalLinkageKind::WeakAnyLinkage:
case GlobalLinkageKind::LinkOnceAnyLinkage:
@@ -89,8 +88,7 @@ isInterposableLinkage(GlobalLinkageKind linkage) {
/// Whether the definition of this global may be discarded if it is not used
/// in its compilation unit.
-LLVM_ATTRIBUTE_UNUSED static bool
-isDiscardableIfUnused(GlobalLinkageKind linkage) {
+[[maybe_unused]] static bool isDiscardableIfUnused(GlobalLinkageKind linkage) {
return isLinkOnceLinkage(linkage) || isLocalLinkage(linkage) ||
isAvailableExternallyLinkage(linkage);
}
@@ -99,7 +97,7 @@ isDiscardableIfUnused(GlobalLinkageKind linkage) {
/// Using this method outside of the code generators is almost always a
/// mistake: when working at the IR level use isInterposable instead as it
/// knows about ODR semantics.
-LLVM_ATTRIBUTE_UNUSED static bool isWeakForLinker(GlobalLinkageKind linkage) {
+[[maybe_unused]] static bool isWeakForLinker(GlobalLinkageKind linkage) {
return linkage == GlobalLinkageKind::WeakAnyLinkage ||
linkage == GlobalLinkageKind::WeakODRLinkage ||
linkage == GlobalLinkageKind::LinkOnceAnyLinkage ||
@@ -108,7 +106,7 @@ LLVM_ATTRIBUTE_UNUSED static bool isWeakForLinker(GlobalLinkageKind linkage) {
linkage == GlobalLinkageKind::ExternalWeakLinkage;
}
-LLVM_ATTRIBUTE_UNUSED static bool isValidLinkage(GlobalLinkageKind gl) {
+[[maybe_unused]] static bool isValidLinkage(GlobalLinkageKind gl) {
return isExternalLinkage(gl) || isLocalLinkage(gl) || isWeakLinkage(gl) ||
isLinkOnceLinkage(gl);
}
diff --git a/clang/include/clang/CIR/MissingFeatures.h b/clang/include/clang/CIR/MissingFeatures.h
index df82ca1..090cf35 100644
--- a/clang/include/clang/CIR/MissingFeatures.h
+++ b/clang/include/clang/CIR/MissingFeatures.h
@@ -39,7 +39,6 @@ struct MissingFeatures {
static bool opGlobalUsedOrCompilerUsed() { return false; }
static bool opGlobalAnnotations() { return false; }
static bool opGlobalCtorPriority() { return false; }
- static bool opGlobalDtorList() { return false; }
static bool setDSOLocal() { return false; }
static bool setComdat() { return false; }
@@ -70,24 +69,31 @@ struct MissingFeatures {
static bool opAllocaCaptureByInit() { return false; }
// FuncOp handling
- static bool opFuncOpenCLKernelMetadata() { return false; }
+ static bool opFuncArmNewAttr() { return false; }
+ static bool opFuncArmStreamingAttr() { return false; }
static bool opFuncAstDeclAttr() { return false; }
- static bool opFuncAttributesForDefinition() { return false; }
static bool opFuncCallingConv() { return false; }
+ static bool opFuncColdHotAttr() { return false; }
static bool opFuncCPUAndFeaturesAttributes() { return false; }
static bool opFuncExceptions() { return false; }
static bool opFuncExtraAttrs() { return false; }
static bool opFuncMaybeHandleStaticInExternC() { return false; }
+ static bool opFuncMinSizeAttr() { return false; }
static bool opFuncMultipleReturnVals() { return false; }
+ static bool opFuncNakedAttr() { return false; }
+ static bool opFuncNoDuplicateAttr() { return false; }
static bool opFuncNoUnwind() { return false; }
+ static bool opFuncOpenCLKernelMetadata() { return false; }
static bool opFuncOperandBundles() { return false; }
+ static bool opFuncOptNoneAttr() { return false; }
static bool opFuncParameterAttributes() { return false; }
static bool opFuncReadOnly() { return false; }
static bool opFuncSection() { return false; }
+ static bool opFuncUnwindTablesAttr() { return false; }
static bool opFuncWillReturn() { return false; }
static bool opFuncNoReturn() { return false; }
- static bool setLLVMFunctionFEnvAttributes() { return false; }
static bool setFunctionAttributes() { return false; }
+ static bool setLLVMFunctionFEnvAttributes() { return false; }
// CallOp handling
static bool opCallAggregateArgs() { return false; }
@@ -175,6 +181,10 @@ struct MissingFeatures {
static bool atomicScope() { return false; }
static bool atomicSyncScopeID() { return false; }
+ // Global ctor handling
+ static bool globalCtorLexOrder() { return false; }
+ static bool globalCtorAssociatedData() { return false; }
+
// Misc
static bool abiArgInfo() { return false; }
static bool addHeapAllocSiteMetadata() { return false; }
@@ -268,6 +278,7 @@ struct MissingFeatures {
static bool objCBlocks() { return false; }
static bool objCGC() { return false; }
static bool objCLifetime() { return false; }
+ static bool hlsl() { return false; }
static bool openCL() { return false; }
static bool openMP() { return false; }
static bool opTBAA() { return false; }
@@ -285,6 +296,7 @@ struct MissingFeatures {
static bool sourceLanguageCases() { return false; }
static bool stackBase() { return false; }
static bool stackSaveOp() { return false; }
+ static bool stackProtector() { return false; }
static bool targetCIRGenInfoArch() { return false; }
static bool targetCIRGenInfoOS() { return false; }
static bool targetCodeGenInfoGetNullPointer() { return false; }
@@ -319,6 +331,7 @@ struct MissingFeatures {
static bool invokeOp() { return false; }
static bool labelOp() { return false; }
static bool ptrDiffOp() { return false; }
+ static bool llvmLoweringPtrDiffConsidersPointee() { return false; }
static bool ptrStrideOp() { return false; }
static bool switchOp() { return false; }
static bool throwOp() { return false; }
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
index 008de0d..a515cbf 100644
--- a/clang/include/clang/Driver/Distro.h
+++ b/clang/include/clang/Driver/Distro.h
@@ -79,6 +79,7 @@ public:
UbuntuOracular,
UbuntuPlucky,
UbuntuQuesting,
+ UbuntuResolute,
UnknownDistro
};
@@ -130,7 +131,7 @@ public:
}
bool IsUbuntu() const {
- return DistroVal >= UbuntuMaverick && DistroVal <= UbuntuQuesting;
+ return DistroVal >= UbuntuMaverick && DistroVal <= UbuntuResolute;
}
bool IsAlpineLinux() const { return DistroVal == AlpineLinux; }
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index a55a523..7ae153d 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2047,7 +2047,7 @@ def fconstexpr_depth_EQ : Joined<["-"], "fconstexpr-depth=">, Group<f_Group>,
MarshallingInfoInt<LangOpts<"ConstexprCallDepth">, "512">;
def fconstexpr_steps_EQ : Joined<["-"], "fconstexpr-steps=">, Group<f_Group>,
Visibility<[ClangOption, CC1Option]>,
- HelpText<"Set the maximum number of steps in constexpr function evaluation">,
+ HelpText<"Set the maximum number of steps in constexpr function evaluation (0 = no limit)">,
MarshallingInfoInt<LangOpts<"ConstexprStepLimit">, "1048576">;
def fexperimental_new_constant_interpreter : Flag<["-"], "fexperimental-new-constant-interpreter">, Group<f_Group>,
HelpText<"Enable the experimental new constant interpreter">,
@@ -6122,7 +6122,7 @@ def rewrite_legacy_objc : Flag<["-"], "rewrite-legacy-objc">,
def rdynamic : Flag<["-"], "rdynamic">, Group<Link_Group>,
Visibility<[ClangOption, FlangOption]>;
def resource_dir : Separate<["-"], "resource-dir">,
- Flags<[NoXarchOption, HelpHidden]>,
+ Flags<[NoXarchOption]>,
Visibility<[ClangOption, CC1Option, CLOption, DXCOption, FlangOption, FC1Option]>,
HelpText<"The directory which holds the compiler resource files">,
MarshallingInfoString<HeaderSearchOpts<"ResourceDir">>;
@@ -6211,11 +6211,12 @@ def static : Flag<["-", "--"], "static">, Group<Link_Group>,
Flags<[NoArgumentUnused]>;
def std_default_EQ : Joined<["-"], "std-default=">;
def std_EQ : Joined<["-", "--"], "std=">,
- Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
- Group<CompileOnly_Group>, HelpText<"Language standard to compile for">,
- ValuesCode<[{
+ Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
+ Group<CompileOnly_Group>,
+ HelpText<"Language standard to compile for">,
+ ValuesCode<[{
static constexpr const char VALUES_CODE [] =
- #define LANGSTANDARD(id, name, lang, desc, features) name ","
+ #define LANGSTANDARD(id, name, lang, desc, features, version) name ","
#define LANGSTANDARD_ALIAS(id, alias) alias ","
#include "clang/Basic/LangStandards.def"
;
@@ -9600,6 +9601,15 @@ def fhlsl_spv_use_unknown_image_format
"from the resource's data type.">,
MarshallingInfoFlag<LangOpts<"HLSLSpvUseUnknownImageFormat">>;
+def fhlsl_spv_enable_maximal_reconvergence
+ : Flag<["-"], "fspv-enable-maximal-reconvergence">,
+ Group<dxc_Group>,
+ Visibility<[CC1Option, DXCOption]>,
+ HelpText<"Enables the MaximallyReconvergesKHR execution mode for this "
+ "module. This ensures that control flow reconverges at "
+ "well-defined merge points as defined by the Vulkan spec.">,
+ MarshallingInfoFlag<LangOpts<"HLSLSpvEnableMaximalReconvergence">>;
+
def no_wasm_opt : Flag<["--"], "no-wasm-opt">,
Group<m_Group>,
HelpText<"Disable the wasm-opt optimizer">,
diff --git a/clang/include/clang/ExtractAPI/API.h b/clang/include/clang/ExtractAPI/API.h
index 1ace535..bea5416 100644
--- a/clang/include/clang/ExtractAPI/API.h
+++ b/clang/include/clang/ExtractAPI/API.h
@@ -618,17 +618,17 @@ struct TagRecord : APIRecord, RecordContext {
static bool classofKind(RecordKind K) {
switch (K) {
case RK_Enum:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_Struct:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_Union:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_CXXClass:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_ClassTemplate:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_ClassTemplateSpecialization:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_ClassTemplatePartialSpecialization:
return true;
default:
@@ -704,15 +704,15 @@ struct RecordRecord : TagRecord {
static bool classofKind(RecordKind K) {
switch (K) {
case RK_Struct:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_Union:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_CXXClass:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_ClassTemplate:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_ClassTemplateSpecialization:
- LLVM_FALLTHROUGH;
+ [[fallthrough]];
case RK_ClassTemplatePartialSpecialization:
return true;
default:
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 37598f8..add4c15 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -3961,6 +3961,13 @@ public:
bool &AddToScope,
ArrayRef<BindingDecl *> Bindings = {});
+private:
+ // Perform a check on an AsmLabel to verify its consistency and emit
+ // diagnostics in case of an error.
+ void CheckAsmLabel(Scope *S, Expr *AsmLabelExpr, StorageClass SC,
+ TypeSourceInfo *TInfo, VarDecl *);
+
+public:
/// Perform semantic checking on a newly-created variable
/// declaration.
///
@@ -5010,6 +5017,14 @@ public:
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI,
Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks);
+ /// Add a cluster_dims attribute to a particular declaration.
+ CUDAClusterDimsAttr *createClusterDimsAttr(const AttributeCommonInfo &CI,
+ Expr *X, Expr *Y, Expr *Z);
+ void addClusterDimsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *X,
+ Expr *Y, Expr *Z);
+ /// Add a no_cluster attribute to a particular declaration.
+ void addNoClusterAttr(Decl *D, const AttributeCommonInfo &CI);
+
enum class RetainOwnershipKind { NS, CF, OS };
UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
@@ -13385,6 +13400,13 @@ public:
const MultiLevelTemplateArgumentList &TemplateArgs,
TemplateArgumentListInfo &Outputs);
+ /// Substitute concept template arguments in the constraint expression
+ /// of a concept-id. This is used to implement [temp.constr.normal].
+ ExprResult
+ SubstConceptTemplateArguments(const ConceptSpecializationExpr *CSE,
+ const Expr *ConstraintExpr,
+ const MultiLevelTemplateArgumentList &MLTAL);
+
bool SubstTemplateArgumentsInParameterMapping(
ArrayRef<TemplateArgumentLoc> Args, SourceLocation BaseLoc,
const MultiLevelTemplateArgumentList &TemplateArgs,
diff --git a/clang/include/clang/Sema/SemaHLSL.h b/clang/include/clang/Sema/SemaHLSL.h
index 46b088c..f9d3a4ea 100644
--- a/clang/include/clang/Sema/SemaHLSL.h
+++ b/clang/include/clang/Sema/SemaHLSL.h
@@ -215,7 +215,6 @@ public:
bool diagnosePositionType(QualType T, const ParsedAttr &AL);
bool CanPerformScalarCast(QualType SrcTy, QualType DestTy);
- bool ContainsBitField(QualType BaseTy);
bool CanPerformElementwiseCast(Expr *Src, QualType DestType);
bool CanPerformAggregateSplatCast(Expr *Src, QualType DestType);
ExprResult ActOnOutParamExpr(ParmVarDecl *Param, Expr *Arg);
diff --git a/clang/include/clang/Sema/SemaOpenACC.h b/clang/include/clang/Sema/SemaOpenACC.h
index 6cadc34..f751e98 100644
--- a/clang/include/clang/Sema/SemaOpenACC.h
+++ b/clang/include/clang/Sema/SemaOpenACC.h
@@ -228,6 +228,11 @@ private:
bool DiagnoseAllowedClauses(OpenACCDirectiveKind DK, OpenACCClauseKind CK,
SourceLocation ClauseLoc);
+ bool CreateReductionCombinerRecipe(
+ SourceLocation loc, OpenACCReductionOperator ReductionOperator,
+ QualType VarTy,
+ llvm::SmallVectorImpl<OpenACCReductionRecipe::CombinerRecipe>
+ &CombinerRecipes);
public:
// Needed from the visitor, so should be public.
@@ -240,7 +245,7 @@ public:
OpenACCPrivateRecipe CreatePrivateInitRecipe(const Expr *VarExpr);
OpenACCFirstPrivateRecipe CreateFirstPrivateInitRecipe(const Expr *VarExpr);
- OpenACCReductionRecipe
+ OpenACCReductionRecipeWithStorage
CreateReductionInitRecipe(OpenACCReductionOperator ReductionOperator,
const Expr *VarExpr);
@@ -946,12 +951,14 @@ public:
ArrayRef<Expr *> IntExprs, SourceLocation EndLoc);
// Does the checking for a 'reduction ' clause that needs to be done in
// dependent and not dependent cases.
- OpenACCClause *CheckReductionClause(
- ArrayRef<const OpenACCClause *> ExistingClauses,
- OpenACCDirectiveKind DirectiveKind, SourceLocation BeginLoc,
- SourceLocation LParenLoc, OpenACCReductionOperator ReductionOp,
- ArrayRef<Expr *> Vars, ArrayRef<OpenACCReductionRecipe> Recipes,
- SourceLocation EndLoc);
+ OpenACCClause *
+ CheckReductionClause(ArrayRef<const OpenACCClause *> ExistingClauses,
+ OpenACCDirectiveKind DirectiveKind,
+ SourceLocation BeginLoc, SourceLocation LParenLoc,
+ OpenACCReductionOperator ReductionOp,
+ ArrayRef<Expr *> Vars,
+ ArrayRef<OpenACCReductionRecipeWithStorage> Recipes,
+ SourceLocation EndLoc);
ExprResult BuildOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc);
ExprResult ActOnOpenACCAsteriskSizeExpr(SourceLocation AsteriskLoc);
diff --git a/clang/include/clang/Sema/SemaOpenMP.h b/clang/include/clang/Sema/SemaOpenMP.h
index daf58b1..f9baeed 100644
--- a/clang/include/clang/Sema/SemaOpenMP.h
+++ b/clang/include/clang/Sema/SemaOpenMP.h
@@ -1022,7 +1022,8 @@ public:
SourceLocation EndLoc);
/// Called on well-formed 'nowait' clause.
OMPClause *ActOnOpenMPNowaitClause(SourceLocation StartLoc,
- SourceLocation EndLoc);
+ SourceLocation EndLoc,
+ SourceLocation LParenLoc, Expr *Condition);
/// Called on well-formed 'untied' clause.
OMPClause *ActOnOpenMPUntiedClause(SourceLocation StartLoc,
SourceLocation EndLoc);
diff --git a/clang/include/clang/Sema/Template.h b/clang/include/clang/Sema/Template.h
index 60c7d27..e963439b 100644
--- a/clang/include/clang/Sema/Template.h
+++ b/clang/include/clang/Sema/Template.h
@@ -205,8 +205,8 @@ enum class TemplateSubstitutionKind : char {
/// Add a new outmost level to the multi-level template argument
/// list.
- /// A 'Final' substitution means that Subst* nodes won't be built
- /// for the replacements.
+ /// A 'Final' substitution means that these Args don't need to be
+ /// resugared later.
void addOuterTemplateArguments(Decl *AssociatedDecl, ArgList Args,
bool Final) {
assert(!NumRetainedOuterLevels &&
diff --git a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
index 4473c54..ffae3b9 100644
--- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
+++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
@@ -76,9 +76,6 @@ def SecurityAlpha : Package<"security">, ParentPackage<Alpha>;
def CERT : Package<"cert">, ParentPackage<Security>;
def ENV : Package<"env">, ParentPackage<CERT>;
-def CERTAlpha : Package<"cert">, ParentPackage<SecurityAlpha>;
-def POSAlpha : Package<"pos">, ParentPackage<CERTAlpha>;
-
def Unix : Package<"unix">;
def UnixAlpha : Package<"unix">, ParentPackage<Alpha>;
def CString : Package<"cstring">, ParentPackage<Unix>;
@@ -195,6 +192,11 @@ def NullDereferenceChecker
HelpText<"Check for dereferences of null pointers">,
Documentation<HasDocumentation>;
+def NullPointerArithmChecker
+ : Checker<"NullPointerArithm">,
+ HelpText<"Check for undefined arithmetic operations on null pointers">,
+ Documentation<HasDocumentation>;
+
def NonNullParamChecker : Checker<"NonNullParamChecker">,
HelpText<"Check for null pointers passed as arguments to a function whose "
"arguments are references or marked with the 'nonnull' attribute">,
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
index e3cf1ba..1e87b47 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
@@ -140,8 +140,8 @@ public:
// It might be great to reuse FrontendOptions::getInputKindForExtension()
// but for now it doesn't discriminate between code and header files.
return llvm::StringSwitch<bool>(SM.getFilename(SL).rsplit('.').second)
- .Cases("c", "m", "mm", "C", "cc", "cp", true)
- .Cases("cpp", "CPP", "c++", "cxx", "cppm", true)
+ .Cases({"c", "m", "mm", "C", "cc", "cp"}, true)
+ .Cases({"cpp", "CPP", "c++", "cxx", "cppm"}, true)
.Default(false);
}
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h
index 389f17d..f3c6a62 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/EntryPointStats.h
@@ -9,6 +9,7 @@
#ifndef CLANG_INCLUDE_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_ENTRYPOINTSTATS_H
#define CLANG_INCLUDE_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_ENTRYPOINTSTATS_H
+#include "clang/AST/ASTContext.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
@@ -25,7 +26,7 @@ class EntryPointStat {
public:
llvm::StringLiteral name() const { return Name; }
- static void lockRegistry(llvm::StringRef CPPFileName);
+ static void lockRegistry(llvm::StringRef CPPFileName, ASTContext &Ctx);
static void takeSnapshot(const Decl *EntryPoint);
static void dumpStatsAsCSV(llvm::raw_ostream &OS);
@@ -85,7 +86,7 @@ class UnsignedEPStat : public EntryPointStat {
public:
explicit UnsignedEPStat(llvm::StringLiteral Name);
- unsigned value() const { return Value.value_or(0); }
+ std::optional<unsigned> value() const { return Value; }
void reset() { Value.reset(); }
void set(unsigned V) {
assert(!Value.has_value());