Skip to content

Commit 2ada8bd

Browse files
committed
more cleanups
1 parent 548d92f commit 2ada8bd

File tree

7 files changed

+128
-76
lines changed

7 files changed

+128
-76
lines changed

clang/include/clang/AST/TemplateBase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ class TemplateArgument {
475475
/// Used to insert TemplateArguments into FoldingSets.
476476
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const;
477477
};
478+
478479
/// Location information for a TemplateArgument.
479480
struct TemplateArgumentLocInfo {
480481
struct TemplateTemplateArgLocInfo {

clang/include/clang/Sema/Sema.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13085,6 +13085,7 @@ class Sema final : public SemaBase {
1308513085
/// Whether we're substituting into constraints.
1308613086
bool InConstraintSubstitution;
1308713087

13088+
/// Whether we're substituting into the parameter mapping of a constraint.
1308813089
bool InParameterMappingSubstitution;
1308913090

1309013091
/// The point of instantiation or synthesis within the source code.
@@ -14842,10 +14843,18 @@ class Sema final : public SemaBase {
1484214843
const NamedDecl *D1, ArrayRef<AssociatedConstraint> AC1,
1484314844
const NamedDecl *D2, ArrayRef<AssociatedConstraint> AC2);
1484414845

14845-
llvm::DenseMap<llvm::FoldingSetNodeID, CachedConceptIdConstraint>
14846-
ConceptIdSatisfactionCache;
14846+
/// Cache the satisfaction of an atomic constraint.
14847+
/// The key is based on the unsubstituted expression and the parameter
14848+
/// mapping. This lets us not substituting the mapping more than once,
14849+
/// which is (very!) expensive.
14850+
/// FIXME: this should be private.
14851+
llvm::DenseMap<llvm::FoldingSetNodeID,
14852+
UnsubstitutedConstraintSatisfactionCacheResult>
14853+
UnsubstitutedConstraintSatisfactionCache;
1484714854

1484814855
private:
14856+
friend class CalculateConstraintSatisfaction;
14857+
1484914858
/// Caches pairs of template-like decls whose associated constraints were
1485014859
/// checked for subsumption and whether or not the first's constraints did in
1485114860
/// fact subsume the second's.
@@ -14858,6 +14867,8 @@ class Sema final : public SemaBase {
1485814867
llvm::DenseMap<ConstrainedDeclOrNestedRequirement, NormalizedConstraint *>
1485914868
NormalizationCache;
1486014869

14870+
/// Cache whether the associated constraint of a declaration
14871+
/// is satisfied.
1486114872
llvm::ContextualFoldingSet<ConstraintSatisfaction, const ASTContext &>
1486214873
SatisfactionCache;
1486314874

clang/include/clang/Sema/SemaConcept.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@
1818
#include "clang/AST/Expr.h"
1919
#include "clang/AST/ExprConcepts.h"
2020
#include "clang/Basic/SourceLocation.h"
21-
#include "clang/Basic/UnsignedOrNone.h"
2221
#include "clang/Sema/Ownership.h"
23-
#include "llvm/ADT/ArrayRef.h"
2422
#include "llvm/ADT/FoldingSet.h"
25-
#include "llvm/ADT/STLForwardCompat.h"
2623
#include "llvm/ADT/STLFunctionalExtras.h"
2724
#include "llvm/ADT/SmallBitVector.h"
2825
#include "llvm/ADT/SmallVector.h"
29-
#include "llvm/Support/Compiler.h"
3026
#include <optional>
3127
#include <utility>
3228

@@ -37,17 +33,19 @@ class MultiLevelTemplateArgumentList;
3733
/// \brief A normalized constraint, as defined in C++ [temp.constr.normal], is
3834
/// either an atomic constraint, a conjunction of normalized constraints or a
3935
/// disjunction of normalized constraints.
40-
4136
struct NormalizedConstraint {
4237

43-
enum class ConstraintKind : unsigned char{
38+
enum class ConstraintKind : unsigned char {
4439
Atomic = 0,
4540
ConceptId,
4641
FoldExpanded,
4742
Compound,
4843
};
4944

50-
enum CompoundConstraintKind : unsigned char { CCK_Conjunction, CCK_Disjunction };
45+
enum CompoundConstraintKind : unsigned char {
46+
CCK_Conjunction,
47+
CCK_Disjunction
48+
};
5149
enum class FoldOperatorKind : unsigned char { And, Or };
5250

5351
using OccurenceList = llvm::SmallBitVector;
@@ -393,7 +391,7 @@ class ConceptIdConstraint : public NormalizedConstraintWithParamMapping {
393391
NormalizedConstraint &getNormalizedConstraint() { return *ConceptId.Sub; }
394392
};
395393

396-
struct CachedConceptIdConstraint {
394+
struct UnsubstitutedConstraintSatisfactionCacheResult {
397395
ExprResult SubstExpr;
398396
ConstraintSatisfaction Satisfaction;
399397
};

0 commit comments

Comments
 (0)