Skip to content

Commit 4bae636

Browse files
committed
Revert "[clang][Interp] Add IntegralAP for arbitrary-precision integers (#65844)"
This reverts commit 16b9e6f. This breaks buildbots.
1 parent 16b9e6f commit 4bae636

File tree

12 files changed

+14
-383
lines changed

12 files changed

+14
-383
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,14 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
171171
return this->discard(SubExpr);
172172
std::optional<PrimType> FromT = classify(SubExpr->getType());
173173
std::optional<PrimType> ToT = classify(CE->getType());
174-
175174
if (!FromT || !ToT)
176175
return false;
177176

178177
if (!this->visit(SubExpr))
179178
return false;
180179

181-
if (FromT == ToT) {
182-
assert(ToT != PT_IntAP && ToT != PT_IntAPS);
180+
if (FromT == ToT)
183181
return true;
184-
}
185182

186183
return this->emitCast(*FromT, *ToT, CE);
187184
}
@@ -1641,9 +1638,6 @@ bool ByteCodeExprGen<Emitter>::visitZeroInitializer(QualType QT,
16411638
return this->emitZeroSint64(E);
16421639
case PT_Uint64:
16431640
return this->emitZeroUint64(E);
1644-
case PT_IntAP:
1645-
case PT_IntAPS:
1646-
assert(false);
16471641
case PT_Ptr:
16481642
return this->emitNullPtr(E);
16491643
case PT_FnPtr:
@@ -1883,9 +1877,6 @@ bool ByteCodeExprGen<Emitter>::emitConst(T Value, PrimType Ty, const Expr *E) {
18831877
return this->emitConstSint64(Value, E);
18841878
case PT_Uint64:
18851879
return this->emitConstUint64(Value, E);
1886-
case PT_IntAP:
1887-
case PT_IntAPS:
1888-
assert(false);
18891880
case PT_Bool:
18901881
return this->emitConstBool(Value, E);
18911882
case PT_Ptr:

clang/lib/AST/Interp/Context.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ std::optional<PrimType> Context::classify(QualType T) const {
103103
case 8:
104104
return PT_Sint8;
105105
default:
106-
return PT_IntAPS;
106+
return std::nullopt;
107107
}
108108
}
109109

@@ -118,7 +118,7 @@ std::optional<PrimType> Context::classify(QualType T) const {
118118
case 8:
119119
return PT_Uint8;
120120
default:
121-
return PT_IntAP;
121+
return std::nullopt;
122122
}
123123
}
124124

clang/lib/AST/Interp/Descriptor.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "Boolean.h"
1111
#include "Floating.h"
1212
#include "FunctionPointer.h"
13-
#include "IntegralAP.h"
1413
#include "Pointer.h"
1514
#include "PrimType.h"
1615
#include "Record.h"
@@ -183,10 +182,6 @@ static BlockCtorFn getCtorPrim(PrimType Type) {
183182
// constructor called.
184183
if (Type == PT_Float)
185184
return ctorTy<PrimConv<PT_Float>::T>;
186-
if (Type == PT_IntAP)
187-
return ctorTy<PrimConv<PT_IntAP>::T>;
188-
if (Type == PT_IntAPS)
189-
return ctorTy<PrimConv<PT_IntAPS>::T>;
190185

191186
COMPOSITE_TYPE_SWITCH(Type, return ctorTy<T>, return nullptr);
192187
}
@@ -196,10 +191,6 @@ static BlockDtorFn getDtorPrim(PrimType Type) {
196191
// destructor called, since they might allocate memory.
197192
if (Type == PT_Float)
198193
return dtorTy<PrimConv<PT_Float>::T>;
199-
if (Type == PT_IntAP)
200-
return dtorTy<PrimConv<PT_IntAP>::T>;
201-
if (Type == PT_IntAPS)
202-
return dtorTy<PrimConv<PT_IntAPS>::T>;
203194

204195
COMPOSITE_TYPE_SWITCH(Type, return dtorTy<T>, return nullptr);
205196
}

clang/lib/AST/Interp/EvalEmitter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "EvalEmitter.h"
1010
#include "ByteCodeGenError.h"
1111
#include "Context.h"
12-
#include "IntegralAP.h"
1312
#include "Interp.h"
1413
#include "Opcode.h"
1514
#include "clang/AST/DeclCXX.h"

clang/lib/AST/Interp/Integral.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ namespace interp {
2929
using APInt = llvm::APInt;
3030
using APSInt = llvm::APSInt;
3131

32-
template <bool Signed> class IntegralAP;
33-
3432
// Helper structure to select the representation.
3533
template <unsigned Bits, bool Signed> struct Repr;
3634
template <> struct Repr<8, false> { using Type = uint8_t; };
@@ -63,8 +61,6 @@ template <unsigned Bits, bool Signed> class Integral final {
6361
template <typename T> explicit Integral(T V) : V(V) {}
6462

6563
public:
66-
using AsUnsigned = Integral<Bits, false>;
67-
6864
/// Zero-initializes an integral.
6965
Integral() : V(0) {}
7066

clang/lib/AST/Interp/IntegralAP.h

Lines changed: 0 additions & 256 deletions
This file was deleted.

0 commit comments

Comments
 (0)