Skip to content

Commit e3859dc

Browse files
committed
Merge from 'master' to 'sycl-web' (intel#33)
CONFLICT (content): Merge conflict in clang/lib/Driver/Driver.cpp CONFLICT (content): Merge conflict in clang/include/clang/Driver/Driver.h
2 parents 2089840 + a8c678c commit e3859dc

File tree

104 files changed

+2373
-1086
lines changed

Some content is hidden

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

104 files changed

+2373
-1086
lines changed

clang-tools-extra/clang-tidy/openmp/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
set(LLVM_LINK_COMPONENTS support)
1+
set(LLVM_LINK_COMPONENTS
2+
FrontendOpenMP
3+
Support)
24

35
add_clang_library(clangTidyOpenMPModule
46
ExceptionEscapeCheck.cpp
@@ -11,5 +13,4 @@ add_clang_library(clangTidyOpenMPModule
1113
clangBasic
1214
clangTidy
1315
clangTidyUtils
14-
LLVMFrontendOpenMP
1516
)

clang/include/clang/AST/Decl.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -78,33 +78,6 @@ class TypeLoc;
7878
class UnresolvedSetImpl;
7979
class VarTemplateDecl;
8080

81-
/// A container of type source information.
82-
///
83-
/// A client can read the relevant info using TypeLoc wrappers, e.g:
84-
/// @code
85-
/// TypeLoc TL = TypeSourceInfo->getTypeLoc();
86-
/// TL.getBeginLoc().print(OS, SrcMgr);
87-
/// @endcode
88-
class alignas(8) TypeSourceInfo {
89-
// Contains a memory block after the class, used for type source information,
90-
// allocated by ASTContext.
91-
friend class ASTContext;
92-
93-
QualType Ty;
94-
95-
TypeSourceInfo(QualType ty) : Ty(ty) {}
96-
97-
public:
98-
/// Return the type wrapped by this type source info.
99-
QualType getType() const { return Ty; }
100-
101-
/// Return the TypeLoc wrapper for the type source info.
102-
TypeLoc getTypeLoc() const; // implemented in TypeLoc.h
103-
104-
/// Override the type stored in this TypeSourceInfo. Use with caution!
105-
void overrideType(QualType T) { Ty = T; }
106-
};
107-
10881
/// The top declaration context.
10982
class TranslationUnitDecl : public Decl, public DeclContext {
11083
ASTContext &Ctx;

clang/include/clang/AST/DeclTemplate.h

100644100755
Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -793,9 +793,10 @@ class RedeclarableTemplateDecl : public TemplateDecl,
793793

794794
void loadLazySpecializationsImpl() const;
795795

796-
template <class EntryType> typename SpecEntryTraits<EntryType>::DeclType*
796+
template <class EntryType, typename ...ProfileArguments>
797+
typename SpecEntryTraits<EntryType>::DeclType*
797798
findSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
798-
ArrayRef<TemplateArgument> Args, void *&InsertPos);
799+
void *&InsertPos, ProfileArguments &&...ProfileArgs);
799800

800801
template <class Derived, class EntryType>
801802
void addSpecializationImpl(llvm::FoldingSetVector<EntryType> &Specs,
@@ -2056,7 +2057,14 @@ class ClassTemplatePartialSpecializationDecl
20562057
->getInjectedSpecializationType();
20572058
}
20582059

2059-
// FIXME: Add Profile support!
2060+
void Profile(llvm::FoldingSetNodeID &ID) const {
2061+
Profile(ID, getTemplateArgs().asArray(), getTemplateParameters(),
2062+
getASTContext());
2063+
}
2064+
2065+
static void
2066+
Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
2067+
TemplateParameterList *TPL, ASTContext &Context);
20602068

20612069
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
20622070

@@ -2180,7 +2188,8 @@ class ClassTemplateDecl : public RedeclarableTemplateDecl {
21802188
/// Return the partial specialization with the provided arguments if it
21812189
/// exists, otherwise return the insertion point.
21822190
ClassTemplatePartialSpecializationDecl *
2183-
findPartialSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
2191+
findPartialSpecialization(ArrayRef<TemplateArgument> Args,
2192+
TemplateParameterList *TPL, void *&InsertPos);
21842193

21852194
/// Insert the specified partial specialization knowing that it is not
21862195
/// already in. InsertPos must be obtained from findPartialSpecialization.
@@ -2880,6 +2889,15 @@ class VarTemplatePartialSpecializationDecl
28802889
return First->InstantiatedFromMember.setInt(true);
28812890
}
28822891

2892+
void Profile(llvm::FoldingSetNodeID &ID) const {
2893+
Profile(ID, getTemplateArgs().asArray(), getTemplateParameters(),
2894+
getASTContext());
2895+
}
2896+
2897+
static void
2898+
Profile(llvm::FoldingSetNodeID &ID, ArrayRef<TemplateArgument> TemplateArgs,
2899+
TemplateParameterList *TPL, ASTContext &Context);
2900+
28832901
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
28842902

28852903
static bool classofKind(Kind K) {
@@ -2998,7 +3016,8 @@ class VarTemplateDecl : public RedeclarableTemplateDecl {
29983016
/// Return the partial specialization with the provided arguments if it
29993017
/// exists, otherwise return the insertion point.
30003018
VarTemplatePartialSpecializationDecl *
3001-
findPartialSpecialization(ArrayRef<TemplateArgument> Args, void *&InsertPos);
3019+
findPartialSpecialization(ArrayRef<TemplateArgument> Args,
3020+
TemplateParameterList *TPL, void *&InsertPos);
30023021

30033022
/// Insert the specified partial specialization knowing that it is not
30043023
/// already in. InsertPos must be obtained from findPartialSpecialization.

clang/include/clang/AST/Type.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6187,6 +6187,33 @@ class QualifierCollector : public Qualifiers {
61876187
QualType apply(const ASTContext &Context, const Type* T) const;
61886188
};
61896189

6190+
/// A container of type source information.
6191+
///
6192+
/// A client can read the relevant info using TypeLoc wrappers, e.g:
6193+
/// @code
6194+
/// TypeLoc TL = TypeSourceInfo->getTypeLoc();
6195+
/// TL.getBeginLoc().print(OS, SrcMgr);
6196+
/// @endcode
6197+
class alignas(8) TypeSourceInfo {
6198+
// Contains a memory block after the class, used for type source information,
6199+
// allocated by ASTContext.
6200+
friend class ASTContext;
6201+
6202+
QualType Ty;
6203+
6204+
TypeSourceInfo(QualType ty) : Ty(ty) {}
6205+
6206+
public:
6207+
/// Return the type wrapped by this type source info.
6208+
QualType getType() const { return Ty; }
6209+
6210+
/// Return the TypeLoc wrapper for the type source info.
6211+
TypeLoc getTypeLoc() const; // implemented in TypeLoc.h
6212+
6213+
/// Override the type stored in this TypeSourceInfo. Use with caution!
6214+
void overrideType(QualType T) { Ty = T; }
6215+
};
6216+
61906217
// Inline function definitions.
61916218

61926219
inline SplitQualType SplitQualType::getSingleStepDesugaredType() const {

clang/include/clang/AST/TypeLoc.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#ifndef LLVM_CLANG_AST_TYPELOC_H
1515
#define LLVM_CLANG_AST_TYPELOC_H
1616

17-
#include "clang/AST/Decl.h"
1817
#include "clang/AST/NestedNameSpecifier.h"
1918
#include "clang/AST/TemplateBase.h"
2019
#include "clang/AST/Type.h"
@@ -39,6 +38,7 @@ class Expr;
3938
class ObjCInterfaceDecl;
4039
class ObjCProtocolDecl;
4140
class ObjCTypeParamDecl;
41+
class ParmVarDecl;
4242
class TemplateTypeParmDecl;
4343
class UnqualTypeLoc;
4444
class UnresolvedUsingTypenameDecl;
@@ -704,11 +704,7 @@ class TagTypeLoc : public InheritingConcreteTypeLoc<TypeSpecTypeLoc,
704704
TagDecl *getDecl() const { return getTypePtr()->getDecl(); }
705705

706706
/// True if the tag was defined in this type specifier.
707-
bool isDefinition() const {
708-
TagDecl *D = getDecl();
709-
return D->isCompleteDefinition() &&
710-
(D->getIdentifier() == nullptr || D->getLocation() == getNameLoc());
711-
}
707+
bool isDefinition() const;
712708
};
713709

714710
/// Wrapper for source info for record types.

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,11 +2612,6 @@ def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
26122612
"%select{and |because }0%1 does not satisfy %2">;
26132613
def note_atomic_constraint_evaluated_to_false_elaborated : Note<
26142614
"%select{and |because }0'%1' (%2 %3 %4) evaluated to false">;
2615-
def err_could_not_normalize_ill_formed_constraint : Error<
2616-
"required expansion of concept specialization %0 failed, substituted "
2617-
"expression would be illegal">;
2618-
def note_could_not_normalize_ill_formed_constraint_reason : Note<
2619-
"because: %0">;
26202615

26212616
def err_template_different_requires_clause : Error<
26222617
"requires clause differs in template redeclaration">;
@@ -4628,6 +4623,11 @@ def note_checking_constraints_for_class_spec_id_here : Note<
46284623
"specialization '%0' required here">;
46294624
def note_constraint_substitution_here : Note<
46304625
"while substituting template arguments into constraint expression here">;
4626+
def note_constraint_normalization_here : Note<
4627+
"while calculating associated constraint of template '%0' here">;
4628+
def note_parameter_mapping_substitution_here : Note<
4629+
"while substituting into concept arguments here; substitution failures not "
4630+
"allowed in concept arguments">;
46314631
def note_instantiation_contexts_suppressed : Note<
46324632
"(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
46334633
"see all)">;
@@ -4791,8 +4791,9 @@ def note_template_declared_here : Note<
47914791
"%select{function template|class template|variable template"
47924792
"|type alias template|template template parameter}0 "
47934793
"%1 declared here">;
4794-
def err_alias_template_expansion_into_fixed_list : Error<
4795-
"pack expansion used as argument for non-pack parameter of alias template">;
4794+
def err_template_expansion_into_fixed_list : Error<
4795+
"pack expansion used as argument for non-pack parameter of %select{alias "
4796+
"template|concept}0">;
47964797
def note_parameter_type : Note<
47974798
"parameter of type %0 is declared here">;
47984799

clang/include/clang/Driver/Driver.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,9 @@ bool isOptimizationLevelFast(const llvm::opt::ArgList &Args);
646646
/// \return True if the filename has a valid object file extension.
647647
bool isObjectFile(std::string FileName);
648648

649+
/// \return True if the argument combination will end up generating remarks.
650+
bool willEmitRemarks(const llvm::opt::ArgList &Args);
651+
649652
} // end namespace driver
650653
} // end namespace clang
651654

clang/include/clang/Sema/Sema.h

100644100755
Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "clang/AST/StmtCXX.h"
3232
#include "clang/AST/TypeLoc.h"
3333
#include "clang/AST/TypeOrdering.h"
34+
#include "clang/Basic/BitmaskEnum.h"
3435
#include "clang/Basic/ExpressionTraits.h"
3536
#include "clang/Basic/Module.h"
3637
#include "clang/Basic/OpenMPKinds.h"
@@ -6307,6 +6308,25 @@ class Sema final {
63076308
/// A diagnostic is emitted if it is not, and false is returned.
63086309
bool CheckConstraintExpression(Expr *CE);
63096310

6311+
private:
6312+
/// \brief Caches pairs of template-like decls whose associated constraints
6313+
/// were checked for subsumption and whether or not the first's constraints
6314+
/// did in fact subsume the second's.
6315+
llvm::DenseMap<std::pair<NamedDecl *, NamedDecl *>, bool> SubsumptionCache;
6316+
6317+
public:
6318+
/// \brief Check whether the given declaration's associated constraints are
6319+
/// at least as constrained than another declaration's according to the
6320+
/// partial ordering of constraints.
6321+
///
6322+
/// \param Result If no error occurred, receives the result of true if D1 is
6323+
/// at least constrained than D2, and false otherwise.
6324+
///
6325+
/// \returns true if an error occurred, false otherwise.
6326+
bool IsAtLeastAsConstrained(NamedDecl *D1, ArrayRef<const Expr *> AC1,
6327+
NamedDecl *D2, ArrayRef<const Expr *> AC2,
6328+
bool &Result);
6329+
63106330
/// \brief Check whether the given list of constraint expressions are
63116331
/// satisfied (as if in a 'conjunction') given template arguments.
63126332
/// \param ConstraintExprs a list of constraint expressions, treated as if
@@ -6385,6 +6405,10 @@ class Sema final {
63856405
void DiagnoseUnsatisfiedIllFormedConstraint(SourceLocation DiagnosticLocation,
63866406
StringRef Diagnostic);
63876407

6408+
void
6409+
DiagnoseRedeclarationConstraintMismatch(const TemplateParameterList *Old,
6410+
const TemplateParameterList *New);
6411+
63886412
// ParseObjCStringLiteral - Parse Objective-C string literals.
63896413
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs,
63906414
ArrayRef<Expr *> Strings);
@@ -7024,6 +7048,12 @@ class Sema final {
70247048
QualType NTTPType,
70257049
SourceLocation Loc);
70267050

7051+
/// Get a template argument mapping the given template parameter to itself,
7052+
/// e.g. for X in \c template<int X>, this would return an expression template
7053+
/// argument referencing X.
7054+
TemplateArgumentLoc getIdentityTemplateArgumentLoc(Decl *Param,
7055+
SourceLocation Location);
7056+
70277057
void translateTemplateArguments(const ASTTemplateArgsPtr &In,
70287058
TemplateArgumentListInfo &Out);
70297059

@@ -7922,6 +7952,9 @@ class Sema final {
79227952
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(
79237953
TemplateParameterList *P, TemplateDecl *AArg, SourceLocation Loc);
79247954

7955+
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced,
7956+
unsigned Depth, llvm::SmallBitVector &Used);
7957+
79257958
void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
79267959
bool OnlyDeduced,
79277960
unsigned Depth,
@@ -8015,6 +8048,13 @@ class Sema final {
80158048
// We are substituting template arguments into a constraint expression.
80168049
ConstraintSubstitution,
80178050

8051+
// We are normalizing a constraint expression.
8052+
ConstraintNormalization,
8053+
8054+
// We are substituting into the parameter mapping of an atomic constraint
8055+
// during normalization.
8056+
ParameterMappingSubstitution,
8057+
80188058
/// We are rewriting a comparison operator in terms of an operator<=>.
80198059
RewritingOperatorAsSpaceship,
80208060

@@ -8296,6 +8336,19 @@ class Sema final {
82968336
sema::TemplateDeductionInfo &DeductionInfo,
82978337
SourceRange InstantiationRange);
82988338

8339+
struct ConstraintNormalization {};
8340+
/// \brief Note that we are normalizing a constraint expression.
8341+
InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8342+
ConstraintNormalization, NamedDecl *Template,
8343+
SourceRange InstantiationRange);
8344+
8345+
struct ParameterMappingSubstitution {};
8346+
/// \brief Note that we are subtituting into the parameter mapping of an
8347+
/// atomic constraint during constraint normalization.
8348+
InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8349+
ParameterMappingSubstitution, NamedDecl *Template,
8350+
SourceRange InstantiationRange);
8351+
82998352
/// Note that we have finished instantiating this template.
83008353
void Clear();
83018354

@@ -8629,6 +8682,12 @@ class Sema final {
86298682
SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner,
86308683
const MultiLevelTemplateArgumentList &TemplateArgs);
86318684

8685+
bool
8686+
SubstTemplateArguments(ArrayRef<TemplateArgumentLoc> Args,
8687+
const MultiLevelTemplateArgumentList &TemplateArgs,
8688+
TemplateArgumentListInfo &Outputs);
8689+
8690+
86328691
Decl *SubstDecl(Decl *D, DeclContext *Owner,
86338692
const MultiLevelTemplateArgumentList &TemplateArgs);
86348693

@@ -10793,11 +10852,26 @@ class Sema final {
1079310852
Ref_Compatible
1079410853
};
1079510854

10855+
// Fake up a scoped enumeration that still contextually converts to bool.
10856+
struct ReferenceConversionsScope {
10857+
/// The conversions that would be performed on an lvalue of type T2 when
10858+
/// binding a reference of type T1 to it, as determined when evaluating
10859+
/// whether T1 is reference-compatible with T2.
10860+
enum ReferenceConversions {
10861+
Qualification = 0x1,
10862+
Function = 0x2,
10863+
DerivedToBase = 0x4,
10864+
ObjC = 0x8,
10865+
ObjCLifetime = 0x10,
10866+
10867+
LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/ObjCLifetime)
10868+
};
10869+
};
10870+
using ReferenceConversions = ReferenceConversionsScope::ReferenceConversions;
10871+
1079610872
ReferenceCompareResult
1079710873
CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2,
10798-
bool &DerivedToBase, bool &ObjCConversion,
10799-
bool &ObjCLifetimeConversion,
10800-
bool &FunctionConversion);
10874+
ReferenceConversions *Conv = nullptr);
1080110875

1080210876
ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType,
1080310877
Expr *CastExpr, CastKind &CastKind,

0 commit comments

Comments
 (0)