-
Notifications
You must be signed in to change notification settings - Fork 1
/
clang-patch.diff
140 lines (120 loc) · 4.84 KB
/
clang-patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
diff --git clang/include/clang/AST/APValue.h clang/include/clang/AST/APValue.h
index 6943479831e..7e68abd43f8 100644
--- clang/include/clang/AST/APValue.h
+++ clang/include/clang/AST/APValue.h
@@ -102,8 +102,8 @@ public:
public:
LValueBase() : Local{} {}
- LValueBase(const ValueDecl *P, unsigned I = 0, unsigned V = 0);
- LValueBase(const Expr *P, unsigned I = 0, unsigned V = 0);
+ LValueBase(const ValueDecl *P, size_t I = 0, unsigned V = 0);
+ LValueBase(const Expr *P, size_t I = 0, unsigned V = 0);
static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo);
template <class T>
@@ -121,7 +121,7 @@ public:
explicit operator bool() const;
- unsigned getCallIndex() const;
+ size_t getCallIndex() const;
unsigned getVersion() const;
QualType getTypeInfoType() const;
@@ -134,7 +134,8 @@ public:
private:
PtrTy Ptr;
struct LocalState {
- unsigned CallIndex, Version;
+ size_t CallIndex;
+ unsigned Version;
};
union {
LocalState Local;
@@ -403,7 +404,7 @@ public:
bool isLValueOnePastTheEnd() const;
bool hasLValuePath() const;
ArrayRef<LValuePathEntry> getLValuePath() const;
- unsigned getLValueCallIndex() const;
+ size_t getLValueCallIndex() const;
unsigned getLValueVersion() const;
bool isNullPointer() const;
diff --git clang/lib/AST/APValue.cpp clang/lib/AST/APValue.cpp
index 1993bba9bd1..a8e8acdc82c 100644
--- clang/lib/AST/APValue.cpp
+++ clang/lib/AST/APValue.cpp
@@ -37,9 +37,9 @@ static_assert(
alignof(Type),
"Type is insufficiently aligned");
-APValue::LValueBase::LValueBase(const ValueDecl *P, unsigned I, unsigned V)
+APValue::LValueBase::LValueBase(const ValueDecl *P, size_t I, unsigned V)
: Ptr(P), Local{I, V} {}
-APValue::LValueBase::LValueBase(const Expr *P, unsigned I, unsigned V)
+APValue::LValueBase::LValueBase(const Expr *P, size_t I, unsigned V)
: Ptr(P), Local{I, V} {}
APValue::LValueBase APValue::LValueBase::getTypeInfo(TypeInfoLValue LV,
@@ -50,7 +50,7 @@ APValue::LValueBase APValue::LValueBase::getTypeInfo(TypeInfoLValue LV,
return Base;
}
-unsigned APValue::LValueBase::getCallIndex() const {
+size_t APValue::LValueBase::getCallIndex() const {
return is<TypeInfoLValue>() ? 0 : Local.CallIndex;
}
@@ -730,7 +730,7 @@ ArrayRef<APValue::LValuePathEntry> APValue::getLValuePath() const {
return llvm::makeArrayRef(LVal.getPath(), LVal.PathLength);
}
-unsigned APValue::getLValueCallIndex() const {
+size_t APValue::getLValueCallIndex() const {
assert(isLValue() && "Invalid accessor");
return ((const LV*)(const char*)Data.buffer)->Base.getCallIndex();
}
diff --git clang/lib/AST/ExprConstant.cpp clang/lib/AST/ExprConstant.cpp
index b4d02459746..e88118a9176 100644
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -511,7 +511,7 @@ namespace {
SourceLocation CallLoc;
/// Index - The call index of this call.
- unsigned Index;
+ size_t Index;
/// The stack of integers for tracking version numbers for temporaries.
SmallVector<unsigned, 2> TempVersionStack = {1};
@@ -720,12 +720,12 @@ namespace {
unsigned CallStackDepth;
/// NextCallIndex - The next call index to assign.
- unsigned NextCallIndex;
+ size_t NextCallIndex;
/// StepsLeft - The remaining number of evaluation steps we're permitted
/// to perform. This is essentially a limit for the number of statements
/// we will evaluate.
- unsigned StepsLeft;
+ int StepsLeft;
/// BottomFrame - The frame in which evaluation started. This must be
/// initialized after CurrentCall and CallStackDepth.
@@ -881,12 +881,12 @@ namespace {
return false;
}
- std::pair<CallStackFrame *, unsigned>
- getCallFrameAndDepth(unsigned CallIndex) {
+ std::pair<CallStackFrame *, size_t>
+ getCallFrameAndDepth(size_t CallIndex) {
assert(CallIndex && "no call index in getCallFrameAndDepth");
// We will eventually hit BottomFrame, which has Index 1, so Frame can't
// be null in this loop.
- unsigned Depth = CallStackDepth;
+ size_t Depth = CallStackDepth;
CallStackFrame *Frame = CurrentCall;
while (Frame->Index > CallIndex) {
Frame = Frame->Caller;
@@ -902,7 +902,8 @@ namespace {
FFDiag(S->getBeginLoc(), diag::note_constexpr_step_limit_exceeded);
return false;
}
- --StepsLeft;
+ if (StepsLeft > 0)
+ --StepsLeft;
return true;
}
@@ -1452,7 +1453,7 @@ namespace {
const SubobjectDesignator &getLValueDesignator() const { return Designator;}
bool isNullPointer() const { return IsNullPtr;}
- unsigned getLValueCallIndex() const { return Base.getCallIndex(); }
+ size_t getLValueCallIndex() const { return Base.getCallIndex(); }
unsigned getLValueVersion() const { return Base.getVersion(); }
void moveInto(APValue &V) const {