Skip to content

Commit ba74d2c

Browse files
committed
fix gcc warnings
1 parent 345012b commit ba74d2c

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

llvm/lib/Support/Mustache.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class ASTNode {
147147
llvm::DenseMap<char, std::string> &Escapes)
148148
: Allocator(Alloc), Partials(Partials), Lambdas(Lambdas),
149149
SectionLambdas(SectionLambdas), Escapes(Escapes), Ty(Ty),
150-
Parent(Parent), Accessor(std::move(Accessor)), ParentContext(nullptr) {}
150+
Parent(Parent), AccessorValue(std::move(Accessor)), ParentContext(nullptr) {}
151151

152152
void addChild(ASTNode *Child) { Children.emplace_back(Child); };
153153

@@ -183,7 +183,7 @@ class ASTNode {
183183
ASTNode *Parent;
184184
// TODO: switch implementation to SmallVector<T>
185185
std::vector<ASTNode *> Children;
186-
const Accessor Accessor;
186+
const Accessor AccessorValue;
187187
const llvm::json::Value *ParentContext;
188188
};
189189

@@ -595,13 +595,13 @@ void ASTNode::render(const json::Value &Data, raw_ostream &OS) {
595595
OS << Body;
596596
return;
597597
case Partial: {
598-
auto Partial = Partials.find(Accessor[0]);
598+
auto Partial = Partials.find(AccessorValue[0]);
599599
if (Partial != Partials.end())
600600
renderPartial(Data, OS, Partial->getValue());
601601
return;
602602
}
603603
case Variable: {
604-
auto Lambda = Lambdas.find(Accessor[0]);
604+
auto Lambda = Lambdas.find(AccessorValue[0]);
605605
if (Lambda != Lambdas.end())
606606
renderLambdas(Data, OS, Lambda->getValue());
607607
else {
@@ -611,7 +611,7 @@ void ASTNode::render(const json::Value &Data, raw_ostream &OS) {
611611
return;
612612
}
613613
case UnescapeVariable: {
614-
auto Lambda = Lambdas.find(Accessor[0]);
614+
auto Lambda = Lambdas.find(AccessorValue[0]);
615615
if (Lambda != Lambdas.end())
616616
renderLambdas(Data, OS, Lambda->getValue());
617617
else
@@ -620,7 +620,7 @@ void ASTNode::render(const json::Value &Data, raw_ostream &OS) {
620620
}
621621
case Section: {
622622
// Sections are not rendered if the context is falsey.
623-
auto SectionLambda = SectionLambdas.find(Accessor[0]);
623+
auto SectionLambda = SectionLambdas.find(AccessorValue[0]);
624624
bool IsLambda = SectionLambda != SectionLambdas.end();
625625
if (isFalsey(Context) && !IsLambda)
626626
return;
@@ -640,7 +640,7 @@ void ASTNode::render(const json::Value &Data, raw_ostream &OS) {
640640
return;
641641
}
642642
case InvertSection: {
643-
bool IsLambda = SectionLambdas.find(Accessor[0]) != SectionLambdas.end();
643+
bool IsLambda = SectionLambdas.find(AccessorValue[0]) != SectionLambdas.end();
644644
if (!isFalsey(Context) || IsLambda)
645645
return;
646646
renderChild(Context, OS);
@@ -656,13 +656,13 @@ const json::Value *ASTNode::findContext() {
656656
// We attempt to find the JSON context in the current node, if it is not
657657
// found, then we traverse the parent nodes to find the context until we
658658
// reach the root node or the context is found.
659-
if (Accessor.empty())
659+
if (AccessorValue.empty())
660660
return nullptr;
661-
if (Accessor[0] == ".")
661+
if (AccessorValue[0] == ".")
662662
return ParentContext;
663663

664664
const json::Object *CurrentContext = ParentContext->getAsObject();
665-
StringRef CurrentAccessor = Accessor[0];
665+
StringRef CurrentAccessor = AccessorValue[0];
666666
ASTNode *CurrentParent = Parent;
667667

668668
while (!CurrentContext || !CurrentContext->get(CurrentAccessor)) {
@@ -674,11 +674,11 @@ const json::Value *ASTNode::findContext() {
674674
return nullptr;
675675
}
676676
const json::Value *Context = nullptr;
677-
for (auto [Idx, Acc] : enumerate(Accessor)) {
677+
for (auto [Idx, Acc] : enumerate(AccessorValue)) {
678678
const json::Value *CurrentValue = CurrentContext->get(Acc);
679679
if (!CurrentValue)
680680
return nullptr;
681-
if (Idx < Accessor.size() - 1) {
681+
if (Idx < AccessorValue.size() - 1) {
682682
CurrentContext = CurrentValue->getAsObject();
683683
if (!CurrentContext)
684684
return nullptr;
@@ -769,9 +769,10 @@ Template::Template(StringRef TemplateStr) {
769769
Template::Template(Template &&Other) noexcept
770770
: Partials(std::move(Other.Partials)), Lambdas(std::move(Other.Lambdas)),
771771
SectionLambdas(std::move(Other.SectionLambdas)),
772-
Escapes(std::move(Other.Escapes)), Tree(Other.Tree),
772+
Escapes(std::move(Other.Escapes)),
773773
AstAllocator(std::move(Other.AstAllocator)),
774-
RenderAllocator(std::move(Other.RenderAllocator)) {
774+
RenderAllocator(std::move(Other.RenderAllocator)),
775+
Tree(Other.Tree) {
775776
Other.Tree = nullptr;
776777
}
777778

0 commit comments

Comments
 (0)