13
13
#ifndef LLVM_CLANG_AST_DECL_H
14
14
#define LLVM_CLANG_AST_DECL_H
15
15
16
- #include " clang/AST/APNumericStorage.h"
17
16
#include " clang/AST/APValue.h"
18
17
#include " clang/AST/ASTContextAllocate.h"
19
18
#include " clang/AST/DeclAccessPair.h"
@@ -3252,16 +3251,15 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
3252
3251
// / that is defined. For example, in "enum X {a,b}", each of a/b are
3253
3252
// / EnumConstantDecl's, X is an instance of EnumDecl, and the type of a/b is a
3254
3253
// / TagType for the X EnumDecl.
3255
- class EnumConstantDecl : public ValueDecl ,
3256
- public Mergeable<EnumConstantDecl>,
3257
- public APIntStorage {
3254
+ class EnumConstantDecl : public ValueDecl , public Mergeable <EnumConstantDecl> {
3258
3255
Stmt *Init; // an integer constant expression
3259
- bool IsUnsigned;
3256
+ llvm::APSInt Val; // The value.
3260
3257
3261
3258
protected:
3262
- EnumConstantDecl (const ASTContext &C, DeclContext *DC, SourceLocation L,
3259
+ EnumConstantDecl (DeclContext *DC, SourceLocation L,
3263
3260
IdentifierInfo *Id, QualType T, Expr *E,
3264
- const llvm::APSInt &V);
3261
+ const llvm::APSInt &V)
3262
+ : ValueDecl(EnumConstant, DC, L, Id, T), Init((Stmt*)E), Val(V) {}
3265
3263
3266
3264
public:
3267
3265
friend class StmtIteratorBase ;
@@ -3274,15 +3272,10 @@ class EnumConstantDecl : public ValueDecl,
3274
3272
3275
3273
const Expr *getInitExpr () const { return (const Expr*) Init; }
3276
3274
Expr *getInitExpr () { return (Expr*) Init; }
3277
- llvm::APSInt getInitVal () const {
3278
- return llvm::APSInt (getValue (), IsUnsigned);
3279
- }
3275
+ const llvm::APSInt &getInitVal () const { return Val; }
3280
3276
3281
3277
void setInitExpr (Expr *E) { Init = (Stmt*) E; }
3282
- void setInitVal (const ASTContext &C, const llvm::APSInt &V) {
3283
- setValue (C, V);
3284
- IsUnsigned = V.isUnsigned ();
3285
- }
3278
+ void setInitVal (const llvm::APSInt &V) { Val = V; }
3286
3279
3287
3280
SourceRange getSourceRange () const override LLVM_READONLY;
3288
3281
0 commit comments