From 28f39cbdadbab8f00a0d7d220010c7c5b2377f7c Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Tue, 11 Jun 2013 23:30:38 +0200 Subject: [PATCH] Remove superfluous Expression::toConstElem overrides. The error message can be printed by the non-overridden Expression::toConstElem just as well. --- dmd2/expression.h | 4 ---- gen/toir.cpp | 17 +++++++---------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/dmd2/expression.h b/dmd2/expression.h index e1a84a56..94fe0e46 100644 --- a/dmd2/expression.h +++ b/dmd2/expression.h @@ -562,7 +562,6 @@ struct AssocArrayLiteralExp : Expression #if IN_LLVM DValue* toElem(IRState* irs); - llvm::Constant *toConstElem(IRState *irs); #endif }; @@ -1398,7 +1397,6 @@ struct SliceExp : UnaExp #if IN_LLVM DValue* toElem(IRState* irs); - llvm::Constant *toConstElem(IRState *irs); #endif }; @@ -1501,7 +1499,6 @@ struct IndexExp : BinExp elem *toElem(IRState *irs); #elif IN_LLVM DValue* toElem(IRState* irs); - llvm::Constant *toConstElem(IRState *irs); void cacheLvalue(IRState* irs); #endif }; @@ -2127,7 +2124,6 @@ struct GEPExp : UnaExp Expression *toLvalue(Scope *sc, Expression *e); DValue* toElem(IRState* irs); - llvm::Constant *toConstElem(IRState *irs); }; #endif diff --git a/gen/toir.cpp b/gen/toir.cpp index e5583068..5591d0f0 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -3206,17 +3206,14 @@ STUB(SymbolExp) STUB(PowExp) STUB(PowAssignExp) -#define CONSTSTUB(x) LLConstant* x::toConstElem(IRState * p) { \ - error("expression '%s' is not a constant", toChars()); \ - if (!global.gag) \ - fatal(); \ - return NULL; \ +llvm::Constant* Expression::toConstElem(IRState * p) +{ + error("expression '%s' is not a constant", toChars()); + if (!global.gag) + fatal(); + return NULL; } -CONSTSTUB(Expression) -CONSTSTUB(GEPExp) -CONSTSTUB(SliceExp) -CONSTSTUB(IndexExp) -CONSTSTUB(AssocArrayLiteralExp) + //////////////////////////////////////////////////////////////////////////////////////////