Apply DDMD PR #5885 (f5f9150ea57cce5fabb43c79ff1b187d34d37044).

This fixes incorrect overriding of class methods and gets rid of many C++ warnings.
This commit is contained in:
Johan Engelen 2016-07-25 15:25:01 +02:00
parent e9f4ff21c0
commit 463e53b9ac
18 changed files with 28 additions and 28 deletions

View file

@ -90,7 +90,7 @@ public:
LinkDeclaration(LINK p, Dsymbols *decl); LinkDeclaration(LINK p, Dsymbols *decl);
Dsymbol *syntaxCopy(Dsymbol *s); Dsymbol *syntaxCopy(Dsymbol *s);
Scope *newScope(Scope *sc); Scope *newScope(Scope *sc);
char *toChars(); const char *toChars();
void accept(Visitor *v) { v->visit(this); } void accept(Visitor *v) { v->visit(this); }
}; };
@ -101,7 +101,7 @@ public:
Dsymbol *syntaxCopy(Dsymbol *s); Dsymbol *syntaxCopy(Dsymbol *s);
Scope *newScope(Scope *sc); Scope *newScope(Scope *sc);
const char *toChars() const; const char *toChars();
void accept(Visitor *v) { v->visit(this); } void accept(Visitor *v) { v->visit(this); }
}; };

View file

@ -74,7 +74,7 @@ public:
VarDeclaration *var; VarDeclaration *var;
VoidInitExp(VarDeclaration *var, Type *type); VoidInitExp(VarDeclaration *var, Type *type);
char *toChars(); const char *toChars();
void accept(Visitor *v) { v->visit(this); } void accept(Visitor *v) { v->visit(this); }
}; };
@ -89,7 +89,7 @@ class ThrownExceptionExp : public Expression
public: public:
ClassReferenceExp *thrown; // the thing being tossed ClassReferenceExp *thrown; // the thing being tossed
ThrownExceptionExp(Loc loc, ClassReferenceExp *victim); ThrownExceptionExp(Loc loc, ClassReferenceExp *victim);
char *toChars(); const char *toChars();
/// Generate an error message when this exception is not caught /// Generate an error message when this exception is not caught
void generateUncaughtError(); void generateUncaughtError();
void accept(Visitor *v) { v->visit(this); } void accept(Visitor *v) { v->visit(this); }
@ -104,7 +104,7 @@ class CTFEExp : public Expression
public: public:
CTFEExp(TOK tok); CTFEExp(TOK tok);
char *toChars(); const char *toChars();
// Handy instances to share // Handy instances to share
static CTFEExp *cantexp; static CTFEExp *cantexp;

View file

@ -325,7 +325,7 @@ public:
static TypeInfoDeclaration *create(Type *tinfo, int internal); static TypeInfoDeclaration *create(Type *tinfo, int internal);
Dsymbol *syntaxCopy(Dsymbol *); Dsymbol *syntaxCopy(Dsymbol *);
void semantic(Scope *sc); void semantic(Scope *sc);
char *toChars(); const char *toChars();
TypeInfoDeclaration *isTypeInfoDeclaration() { return this; } TypeInfoDeclaration *isTypeInfoDeclaration() { return this; }
void accept(Visitor *v) { v->visit(this); } void accept(Visitor *v) { v->visit(this); }
@ -753,7 +753,7 @@ public:
Dsymbol *syntaxCopy(Dsymbol *); Dsymbol *syntaxCopy(Dsymbol *);
void semantic(Scope *sc); void semantic(Scope *sc);
const char *kind(); const char *kind();
char *toChars(); const char *toChars();
bool isVirtual(); bool isVirtual();
bool addPreInvariant(); bool addPreInvariant();
bool addPostInvariant(); bool addPostInvariant();
@ -785,7 +785,7 @@ public:
Dsymbol *syntaxCopy(Dsymbol *); Dsymbol *syntaxCopy(Dsymbol *);
void semantic(Scope *sc); void semantic(Scope *sc);
const char *kind(); const char *kind();
char *toChars(); const char *toChars();
bool isVirtual(); bool isVirtual();
bool addPreInvariant(); bool addPreInvariant();
bool addPostInvariant(); bool addPostInvariant();

View file

@ -186,7 +186,7 @@ public:
Dsymbol(); Dsymbol();
Dsymbol(Identifier *); Dsymbol(Identifier *);
static Dsymbol *create(Identifier *); static Dsymbol *create(Identifier *);
char *toChars(); const char *toChars();
virtual char *toPrettyCharsHelper(); // helper to print fully qualified (template) arguments virtual char *toPrettyCharsHelper(); // helper to print fully qualified (template) arguments
Loc& getLoc(); Loc& getLoc();
const char *locToChars(); const char *locToChars();

View file

@ -146,7 +146,7 @@ public:
int dyncast() { return DYNCAST_EXPRESSION; } int dyncast() { return DYNCAST_EXPRESSION; }
void print(); void print();
char *toChars(); const char *toChars();
virtual void printAST(int ident = 0); virtual void printAST(int ident = 0);
void error(const char *format, ...) const; void error(const char *format, ...) const;
void warning(const char *format, ...) const; void warning(const char *format, ...) const;
@ -672,7 +672,7 @@ public:
Expression *semantic(Scope *sc); Expression *semantic(Scope *sc);
Expression *semantic(Scope *sc, Expressions *arguments); Expression *semantic(Scope *sc, Expressions *arguments);
MATCH matchType(Type *to, Scope *sc, FuncExp **pfe, int flag = 0); MATCH matchType(Type *to, Scope *sc, FuncExp **pfe, int flag = 0);
char *toChars(); const char *toChars();
bool checkType(); bool checkType();
bool checkValue(); bool checkValue();

View file

@ -31,7 +31,7 @@ public:
bool equals(RootObject *o); bool equals(RootObject *o);
int compare(RootObject *o); int compare(RootObject *o);
void print(); void print();
char *toChars(); const char *toChars();
const char *toHChars2(); const char *toHChars2();
int dyncast(); int dyncast();

View file

@ -48,7 +48,7 @@ public:
// needInterpret is INITinterpret if must be a manifest constant, 0 if not. // needInterpret is INITinterpret if must be a manifest constant, 0 if not.
virtual Initializer *semantic(Scope *sc, Type *t, NeedInterpret needInterpret) = 0; virtual Initializer *semantic(Scope *sc, Type *t, NeedInterpret needInterpret) = 0;
virtual Expression *toExpression(Type *t = NULL) = 0; virtual Expression *toExpression(Type *t = NULL) = 0;
char *toChars(); const char *toChars();
virtual ErrorInitializer *isErrorInitializer() { return NULL; } virtual ErrorInitializer *isErrorInitializer() { return NULL; }
virtual VoidInitializer *isVoidInitializer() { return NULL; } virtual VoidInitializer *isVoidInitializer() { return NULL; }

View file

@ -221,7 +221,7 @@ struct ModuleDeclaration
ModuleDeclaration(Loc loc, Identifiers *packages, Identifier *id); ModuleDeclaration(Loc loc, Identifiers *packages, Identifier *id);
char *toChars(); const char *toChars();
}; };
#endif /* DMD_MODULE_H */ #endif /* DMD_MODULE_H */

View file

@ -243,7 +243,7 @@ public:
// kludge for template.isType() // kludge for template.isType()
int dyncast() { return DYNCAST_TYPE; } int dyncast() { return DYNCAST_TYPE; }
int covariant(Type *t, StorageClass *pstc = NULL); int covariant(Type *t, StorageClass *pstc = NULL);
char *toChars(); const char *toChars();
char *toPrettyChars(bool QualifyTypes = false); char *toPrettyChars(bool QualifyTypes = false);
static char needThisPrefix(); static char needThisPrefix();
static void _init(); static void _init();

View file

@ -53,7 +53,7 @@ struct Array
char *toChars() char *toChars()
{ {
char **buf = (char **)mem.xmalloc(dim * sizeof(char *)); const char **buf = (const char **)mem.xmalloc(dim * sizeof(const char *));
d_size_t len = 2; d_size_t len = 2;
for (d_size_t u = 0; u < dim; u++) for (d_size_t u = 0; u < dim; u++)
{ {

View file

@ -45,7 +45,7 @@ public:
*/ */
virtual void print(); virtual void print();
virtual char *toChars(); virtual const char *toChars();
virtual void toBuffer(OutBuffer *buf); virtual void toBuffer(OutBuffer *buf);
/** /**

View file

@ -93,7 +93,7 @@ public:
virtual Statement *syntaxCopy(); virtual Statement *syntaxCopy();
void print(); void print();
char *toChars(); const char *toChars();
void error(const char *format, ...); void error(const char *format, ...);
void warning(const char *format, ...); void warning(const char *format, ...);

View file

@ -49,7 +49,7 @@ public:
// kludge for template.isType() // kludge for template.isType()
int dyncast() { return DYNCAST_TUPLE; } int dyncast() { return DYNCAST_TUPLE; }
char *toChars() { return objects.toChars(); } const char *toChars() { return objects.toChars(); }
}; };
struct TemplatePrevious struct TemplatePrevious
@ -95,7 +95,7 @@ public:
bool overloadInsert(Dsymbol *s); bool overloadInsert(Dsymbol *s);
bool hasStaticCtorOrDtor(); bool hasStaticCtorOrDtor();
const char *kind(); const char *kind();
char *toChars(); const char *toChars();
Prot prot(); Prot prot();
@ -339,7 +339,7 @@ public:
Dsymbol *toAlias(); // resolve real symbol Dsymbol *toAlias(); // resolve real symbol
const char *kind(); const char *kind();
bool oneMember(Dsymbol **ps, Identifier *ident); bool oneMember(Dsymbol **ps, Identifier *ident);
char *toChars(); const char *toChars();
char* toPrettyCharsHelper(); char* toPrettyCharsHelper();
void printInstantiationTrace(); void printInstantiationTrace();
Identifier *getIdent(); Identifier *getIdent();
@ -382,7 +382,7 @@ public:
int apply(Dsymbol_apply_ft_t fp, void *param); int apply(Dsymbol_apply_ft_t fp, void *param);
bool hasPointers(); bool hasPointers();
void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion); void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion);
char *toChars(); const char *toChars();
bool findTempDecl(Scope *sc); bool findTempDecl(Scope *sc);

View file

@ -27,7 +27,7 @@ public:
DebugSymbol(Loc loc, unsigned level); DebugSymbol(Loc loc, unsigned level);
Dsymbol *syntaxCopy(Dsymbol *); Dsymbol *syntaxCopy(Dsymbol *);
char *toChars(); const char *toChars();
void addMember(Scope *sc, ScopeDsymbol *sds); void addMember(Scope *sc, ScopeDsymbol *sds);
void semantic(Scope *sc); void semantic(Scope *sc);
const char *kind(); const char *kind();
@ -43,7 +43,7 @@ public:
VersionSymbol(Loc loc, unsigned level); VersionSymbol(Loc loc, unsigned level);
Dsymbol *syntaxCopy(Dsymbol *); Dsymbol *syntaxCopy(Dsymbol *);
char *toChars(); const char *toChars();
void addMember(Scope *sc, ScopeDsymbol *sds); void addMember(Scope *sc, ScopeDsymbol *sds);
void semantic(Scope *sc); void semantic(Scope *sc);
const char *kind(); const char *kind();

View file

@ -2396,7 +2396,7 @@ struct AsmProcessor {
asmcode->args.push_back(AsmArg(type, e, mode)); asmcode->args.push_back(AsmArg(type, e, mode));
} }
void addLabel(char *id) { void addLabel(const char *id) {
// We need to delay emitting the actual function name, see // We need to delay emitting the actual function name, see
// replace_func_name in asmstmt.cpp for details. // replace_func_name in asmstmt.cpp for details.
printLabelName(insnTemplate, "<<func>>", id); printLabelName(insnTemplate, "<<func>>", id);

View file

@ -375,7 +375,7 @@ DValue *DtoDynamicCastInterface(Loc &loc, DValue *val, Type *_to) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
LLValue *DtoVirtualFunctionPointer(DValue *inst, FuncDeclaration *fdecl, LLValue *DtoVirtualFunctionPointer(DValue *inst, FuncDeclaration *fdecl,
char *name) { const char *name) {
// sanity checks // sanity checks
assert(fdecl->isVirtual()); assert(fdecl->isVirtual());
assert(!fdecl->isFinalFunc()); assert(!fdecl->isFinalFunc());

View file

@ -40,6 +40,6 @@ DValue *DtoDynamicCastObject(Loc &loc, DValue *val, Type *to);
DValue *DtoDynamicCastInterface(Loc &loc, DValue *val, Type *to); DValue *DtoDynamicCastInterface(Loc &loc, DValue *val, Type *to);
llvm::Value *DtoVirtualFunctionPointer(DValue *inst, FuncDeclaration *fdecl, llvm::Value *DtoVirtualFunctionPointer(DValue *inst, FuncDeclaration *fdecl,
char *name); const char *name);
#endif #endif

View file

@ -1227,7 +1227,7 @@ int isDruntimeArrayOp(FuncDeclaration *fd) {
"_arraySliceSliceMulass_s", "_arraySliceSliceMulass_t", "_arraySliceSliceMulass_s", "_arraySliceSliceMulass_t",
"_arraySliceSliceMulass_u", "_arraySliceSliceMulass_w", "_arraySliceSliceMulass_u", "_arraySliceSliceMulass_w",
}; };
char *name = fd->ident->toChars(); const char *name = fd->ident->toChars();
int i = int i =
binary(name, libArrayopFuncs, sizeof(libArrayopFuncs) / sizeof(char *)); binary(name, libArrayopFuncs, sizeof(libArrayopFuncs) / sizeof(char *));
if (i != -1) { if (i != -1) {