Skip to content

Commit df97ed8

Browse files
committed
Declare virtual method override where applicable
1 parent 094ca77 commit df97ed8

26 files changed

+712
-741
lines changed

bootstrap/annotate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ namespace herschel
152152
{
153153
public:
154154
AnnotatePass(int level, std::shared_ptr<Scope> scope, Compiler& compiler);
155-
virtual std::shared_ptr<AptNode> doApply(std::shared_ptr<AptNode> src);
155+
std::shared_ptr<AptNode> doApply(std::shared_ptr<AptNode> src) override;
156156

157157
private:
158158
std::shared_ptr<Scope> fScope;

bootstrap/apt.h

+312-312
Large diffs are not rendered by default.

bootstrap/codegen-apply.cpp

+30-30
Original file line numberDiff line numberDiff line change
@@ -420,43 +420,43 @@ class AtomArrayAllocateStrategy : public ArrayAllocateStrategy
420420
: ArrayAllocateStrategy(apply)
421421
{}
422422

423-
virtual bool passInitValueToAllocateCall() const
423+
bool passInitValueToAllocateCall() const override
424424
{
425425
return false;
426426
}
427427

428-
virtual String allocateFuncName() const
428+
String allocateFuncName() const override
429429
{
430430
return String("h7_allocate_array");
431431
}
432432

433-
virtual std::vector<llvm::Type*> allocateFuncSignature() const
433+
std::vector<llvm::Type*> allocateFuncSignature() const override
434434
{
435435
return std::vector<llvm::Type*>{
436436
fApply->types().getAtomType()->getPointerTo(),
437437
fApply->types().getTypeType(),
438438
fApply->types().getSizeTTy() };
439439
}
440440

441-
virtual llvm::Value* initValue(const ApplyNode* node) const
441+
llvm::Value* initValue(const ApplyNode* node) const override
442442
{
443443
const NodeList& args = node->children();
444444
return fApply->emitAllocateApplyImpl(args[0].get());
445445
}
446446

447-
virtual llvm::Value* typeTagArgument(const ApplyNode* node) const
447+
llvm::Value* typeTagArgument(const ApplyNode* node) const override
448448
{
449449
const NodeList& args = node->children();
450450
llvm::Value* val = fApply->emitTypeNameForAllocate(args[0].get());
451451
hr_assert(val);
452452
return val;
453453
}
454454

455-
virtual llvm::Value* postInit(const ApplyNode* node,
456-
llvm::Value* retv,
457-
const Type& arrayBaseType,
458-
llvm::Value* sizeVal,
459-
llvm::Value* explicitInitValue) const
455+
llvm::Value* postInit(const ApplyNode* node,
456+
llvm::Value* retv,
457+
const Type& arrayBaseType,
458+
llvm::Value* sizeVal,
459+
llvm::Value* explicitInitValue) const override
460460
{
461461
llvm::Function *curFunction = fApply->builder().GetInsertBlock()->getParent();
462462
llvm::AllocaInst* counter = fApply->tools().createEntryBlockAlloca(
@@ -532,17 +532,17 @@ class Int32ArrayAllocateStrategy : public ArrayAllocateStrategy
532532
: ArrayAllocateStrategy(apply)
533533
{}
534534

535-
virtual bool passInitValueToAllocateCall() const
535+
bool passInitValueToAllocateCall() const override
536536
{
537537
return true;
538538
}
539539

540-
virtual String allocateFuncName() const
540+
String allocateFuncName() const override
541541
{
542542
return String("h7_allocate_int32_array");
543543
}
544544

545-
virtual std::vector<llvm::Type*> allocateFuncSignature() const
545+
std::vector<llvm::Type*> allocateFuncSignature() const override
546546
{
547547
return std::vector<llvm::Type*>{
548548
fApply->types().getAtomType()->getPointerTo(),
@@ -551,21 +551,21 @@ class Int32ArrayAllocateStrategy : public ArrayAllocateStrategy
551551
fApply->types().getSizeTTy() };
552552
}
553553

554-
virtual llvm::Value* initValue(const ApplyNode* node) const
554+
llvm::Value* initValue(const ApplyNode* node) const override
555555
{
556556
return llvm::Constant::getNullValue(llvm::Type::getInt32Ty(fApply->context()));
557557
}
558558

559-
virtual llvm::Value* typeTagArgument(const ApplyNode* node) const
559+
llvm::Value* typeTagArgument(const ApplyNode* node) const override
560560
{
561561
return fApply->tools().emitTypeId(CodegenTools::kAtomInt32Array);
562562
}
563563

564-
virtual llvm::Value* postInit(const ApplyNode* node,
565-
llvm::Value* retv,
566-
const Type& arrayBaseType,
567-
llvm::Value* sizeVal,
568-
llvm::Value* explicitInitValue) const
564+
llvm::Value* postInit(const ApplyNode* node,
565+
llvm::Value* retv,
566+
const Type& arrayBaseType,
567+
llvm::Value* sizeVal,
568+
llvm::Value* explicitInitValue) const override
569569
{
570570
return retv;
571571
}
@@ -579,39 +579,39 @@ class CharArrayAllocateStrategy : public ArrayAllocateStrategy
579579
: ArrayAllocateStrategy(apply)
580580
{}
581581

582-
virtual bool passInitValueToAllocateCall() const
582+
bool passInitValueToAllocateCall() const override
583583
{
584584
return true;
585585
}
586586

587-
virtual String allocateFuncName() const
587+
String allocateFuncName() const override
588588
{
589589
return String("allocate_char_array");
590590
}
591591

592-
virtual std::vector<llvm::Type*> allocateFuncSignature() const
592+
std::vector<llvm::Type*> allocateFuncSignature() const override
593593
{
594594
return std::vector<llvm::Type*>{ fApply->types().getAtomType()->getPointerTo(),
595595
fApply->types().getTagIdType(),
596596
llvm::Type::getInt32Ty(fApply->context()),
597597
fApply->types().getSizeTTy() };
598598
}
599599

600-
virtual llvm::Value* initValue(const ApplyNode* node) const
600+
llvm::Value* initValue(const ApplyNode* node) const override
601601
{
602602
return llvm::Constant::getNullValue(llvm::Type::getInt32Ty(fApply->context()));
603603
}
604604

605-
virtual llvm::Value* typeTagArgument(const ApplyNode* node) const
605+
llvm::Value* typeTagArgument(const ApplyNode* node) const override
606606
{
607607
return fApply->tools().emitTypeId(CodegenTools::kAtomCharArray);
608608
}
609609

610-
virtual llvm::Value* postInit(const ApplyNode* node,
611-
llvm::Value* retv,
612-
const Type& arrayBaseType,
613-
llvm::Value* sizeVal,
614-
llvm::Value* explicitInitValue) const
610+
llvm::Value* postInit(const ApplyNode* node,
611+
llvm::Value* retv,
612+
const Type& arrayBaseType,
613+
llvm::Value* sizeVal,
614+
llvm::Value* explicitInitValue) const override
615615
{
616616
return retv;
617617
}

bootstrap/codegen-init.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace herschel
8888
{ }
8989

9090

91-
virtual llvm::Type* entityType() const
91+
llvm::Type* entityType() const override
9292
{
9393
return fInitializer.types().getTypeType();
9494
}
@@ -105,19 +105,19 @@ namespace herschel
105105
}
106106

107107

108-
virtual String entityGetterFunctionName() const
108+
String entityGetterFunctionName() const override
109109
{
110110
return getterFunctionName(fType);
111111
}
112112

113113

114-
virtual String entityGetterGlobalVarName() const
114+
String entityGetterGlobalVarName() const override
115115
{
116116
return fType.typeId() + "_type";
117117
}
118118

119119

120-
virtual llvm::Value* makeEntity() const
120+
llvm::Value* makeEntity() const override
121121
{
122122
return fInitializer.makeTypeOrCallRegistration(fType);
123123
}
@@ -140,7 +140,7 @@ namespace herschel
140140
{ }
141141

142142

143-
virtual llvm::Type* entityType() const
143+
llvm::Type* entityType() const override
144144
{
145145
return fInitializer.types().getGenericFuncType();
146146
}
@@ -152,19 +152,19 @@ namespace herschel
152152
}
153153

154154

155-
virtual String entityGetterFunctionName() const
155+
String entityGetterFunctionName() const override
156156
{
157157
return getterFunctionName(fNode->name());
158158
}
159159

160160

161-
virtual String entityGetterGlobalVarName() const
161+
String entityGetterGlobalVarName() const override
162162
{
163163
return fNode->name() + "_generic_function";
164164
}
165165

166166

167-
virtual llvm::Value* makeEntity() const
167+
llvm::Value* makeEntity() const override
168168
{
169169
return fInitializer.makeGenericFunctionRegistration(fNode);
170170
}

bootstrap/compilepass.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ namespace herschel
5656

5757
~TokenCompilePass() { }
5858

59-
virtual Token apply(const Token& src, bool doTrace);
59+
Token apply(const Token& src, bool doTrace) override;
6060

61-
virtual int passLevel() const { return fLevel; }
61+
int passLevel() const override { return fLevel; }
6262

6363
private:
6464
int fLevel;
@@ -80,9 +80,9 @@ namespace herschel
8080

8181
~Token2AptNodeCompilePass() { }
8282

83-
virtual std::shared_ptr<AptNode> apply(const Token& src, bool doTrace);
83+
std::shared_ptr<AptNode> apply(const Token& src, bool doTrace) override;
8484

85-
virtual int passLevel() const { return fLevel; }
85+
int passLevel() const override { return fLevel; }
8686

8787
private:
8888
int fLevel;
@@ -104,10 +104,10 @@ namespace herschel
104104

105105
~AptNodeCompilePass() { }
106106

107-
virtual std::shared_ptr<AptNode> apply(std::shared_ptr<AptNode> src,
108-
bool doTrace);
107+
std::shared_ptr<AptNode> apply(std::shared_ptr<AptNode> src,
108+
bool doTrace) override;
109109

110-
virtual int passLevel() const { return fLevel; }
110+
int passLevel() const override { return fLevel; }
111111

112112
private:
113113
int fLevel;

bootstrap/parsertypes.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace herschel
3737
ConfigVarRegistry();
3838
ConfigVarRegistry(std::shared_ptr<ConfigVarRegistry> parent);
3939

40-
virtual bool lookup(const String& name, Token* out) const;
40+
bool lookup(const String& name, Token* out) const override;
4141

4242
private:
4343
std::shared_ptr<ConfigVarRegistry> fParent;

bootstrap/pass1.cpp

+24-24
Original file line numberDiff line numberDiff line change
@@ -4370,10 +4370,10 @@ namespace herschel {
43704370

43714371
struct ExprParamSyntaxMatcher : public ParameterSyntaxMatcher
43724372
{
4373-
virtual bool match(FirstPass* pass,
4374-
const String& paramName,
4375-
NamedReplacementMap* bindings,
4376-
SyntaxTreeNode& followSet)
4373+
bool match(FirstPass* pass,
4374+
const String& paramName,
4375+
NamedReplacementMap* bindings,
4376+
SyntaxTreeNode& followSet) override
43774377
{
43784378
SrcPos pos = pass->fToken.srcpos();
43794379
Token expr = pass->parseExpr(!K(acceptComma));
@@ -4392,10 +4392,10 @@ namespace herschel {
43924392

43934393
struct NameParamSyntaxMatcher : public ParameterSyntaxMatcher
43944394
{
4395-
virtual bool match(FirstPass* pass,
4396-
const String& paramName,
4397-
NamedReplacementMap* bindings,
4398-
SyntaxTreeNode& followSet)
4395+
bool match(FirstPass* pass,
4396+
const String& paramName,
4397+
NamedReplacementMap* bindings,
4398+
SyntaxTreeNode& followSet) override
43994399
{
44004400
if (pass->fToken == kSymbol) {
44014401
bindings->insert(std::make_pair(paramName,
@@ -4414,10 +4414,10 @@ namespace herschel {
44144414

44154415
struct OperatorParamSyntaxMatcher : public ParameterSyntaxMatcher
44164416
{
4417-
virtual bool match(FirstPass* pass,
4418-
const String& paramName,
4419-
NamedReplacementMap* bindings,
4420-
SyntaxTreeNode& followSet)
4417+
bool match(FirstPass* pass,
4418+
const String& paramName,
4419+
NamedReplacementMap* bindings,
4420+
SyntaxTreeNode& followSet) override
44214421
{
44224422
OperatorType op = tokenTypeToOperator(pass->fToken.tokenType());
44234423
if (op != kOpInvalid) {
@@ -4437,10 +4437,10 @@ namespace herschel {
44374437

44384438
struct AnyParamParamSyntaxMatcher : public ParameterSyntaxMatcher
44394439
{
4440-
virtual bool match(FirstPass* pass,
4441-
const String& paramName,
4442-
NamedReplacementMap* bindings,
4443-
SyntaxTreeNode& followSet)
4440+
bool match(FirstPass* pass,
4441+
const String& paramName,
4442+
NamedReplacementMap* bindings,
4443+
SyntaxTreeNode& followSet) override
44444444
{
44454445
SrcPos pos = pass->fToken.srcpos();
44464446
FirstPass::ParamType expected = FirstPass::kPositional;
@@ -4469,10 +4469,10 @@ namespace herschel {
44694469
: fReqType(reqType)
44704470
{ }
44714471

4472-
virtual bool match(FirstPass* pass,
4473-
const String& paramName,
4474-
NamedReplacementMap* bindings,
4475-
SyntaxTreeNode& followSet)
4472+
bool match(FirstPass* pass,
4473+
const String& paramName,
4474+
NamedReplacementMap* bindings,
4475+
SyntaxTreeNode& followSet) override
44764476
{
44774477
SrcPos pos = pass->fToken.srcpos();
44784478
FirstPass::ParamType expected = FirstPass::kPositional;
@@ -4495,10 +4495,10 @@ namespace herschel {
44954495

44964496
struct ParamListParamSyntax : public ParameterSyntaxMatcher
44974497
{
4498-
virtual bool match(FirstPass* pass,
4499-
const String& paramName,
4500-
NamedReplacementMap* bindings,
4501-
SyntaxTreeNode& followSet)
4498+
bool match(FirstPass* pass,
4499+
const String& paramName,
4500+
NamedReplacementMap* bindings,
4501+
SyntaxTreeNode& followSet) override
45024502
{
45034503
SrcPos pos = pass->fToken.srcpos();
45044504
TokenVector params;

bootstrap/pass1.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ namespace herschel
301301
public:
302302
ExprPass(int level, Compiler& compiler, const Token& currentToken,
303303
std::shared_ptr<Scope> scope);
304-
virtual Token doApply(const Token& src);
304+
Token doApply(const Token& src) override;
305305

306306
private:
307307
Token fCurrentToken;

bootstrap/pass2.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ namespace herschel
274274
{
275275
public:
276276
NodifyPass(int level, Compiler& compiler, std::shared_ptr<Scope> scope);
277-
virtual std::shared_ptr<AptNode> doApply(const Token& src);
277+
std::shared_ptr<AptNode> doApply(const Token& src) override;
278278
std::shared_ptr<Scope> currentScope();
279279

280280
private:

0 commit comments

Comments
 (0)