From 2a9ea3459b2a29c629a23d1d9b1287a20e7f7c1a Mon Sep 17 00:00:00 2001 From: Scott Linder Date: Wed, 10 Oct 2018 18:14:02 +0000 Subject: [PATCH] [Support] Remove redundant qualifiers in YAMLTraits (NFC) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344166 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/YAMLTraits.h | 12 --------- lib/Support/YAMLTraits.cpp | 56 +++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 40 deletions(-) diff --git a/include/llvm/Support/YAMLTraits.h b/include/llvm/Support/YAMLTraits.h index 6836aa2aa06..5d029ad5ce9 100644 --- a/include/llvm/Support/YAMLTraits.h +++ b/include/llvm/Support/YAMLTraits.h @@ -250,7 +250,6 @@ struct has_ScalarEnumerationTraits template static double test(...); -public: static bool const value = (sizeof(test>(nullptr)) == 1); }; @@ -267,7 +266,6 @@ struct has_ScalarBitSetTraits template static double test(...); -public: static bool const value = (sizeof(test>(nullptr)) == 1); }; @@ -287,7 +285,6 @@ struct has_ScalarTraits template static double test(...); -public: static bool const value = (sizeof(test>(nullptr, nullptr, nullptr)) == 1); }; @@ -306,7 +303,6 @@ struct has_BlockScalarTraits template static double test(...); -public: static bool const value = (sizeof(test>(nullptr, nullptr)) == 1); }; @@ -321,7 +317,6 @@ template struct has_MappingTraits { template static double test(...); -public: static bool const value = (sizeof(test>(nullptr)) == 1); }; @@ -335,7 +330,6 @@ template struct has_MappingTraits { template static double test(...); -public: static bool const value = (sizeof(test>(nullptr)) == 1); }; @@ -349,7 +343,6 @@ template struct has_MappingValidateTraits { template static double test(...); -public: static bool const value = (sizeof(test>(nullptr)) == 1); }; @@ -363,7 +356,6 @@ template struct has_MappingValidateTraits { template static double test(...); -public: static bool const value = (sizeof(test>(nullptr)) == 1); }; @@ -379,7 +371,6 @@ struct has_SequenceMethodTraits template static double test(...); -public: static bool const value = (sizeof(test>(nullptr)) == 1); }; @@ -395,7 +386,6 @@ struct has_CustomMappingTraits template static double test(...); -public: static bool const value = (sizeof(test>(nullptr)) == 1); }; @@ -425,7 +415,6 @@ struct has_FlowTraits template static char (&f(...))[2]; -public: static bool const value = sizeof(f(nullptr)) == 2; }; @@ -446,7 +435,6 @@ struct has_DocumentListTraits template static double test(...); -public: static bool const value = (sizeof(test>(nullptr))==1); }; diff --git a/lib/Support/YAMLTraits.cpp b/lib/Support/YAMLTraits.cpp index d6345efd00c..f8492c96bab 100644 --- a/lib/Support/YAMLTraits.cpp +++ b/lib/Support/YAMLTraits.cpp @@ -98,7 +98,7 @@ bool Input::setCurrentDocument() { ++DocIterator; return setCurrentDocument(); } - TopNode = this->createHNodes(N); + TopNode = createHNodes(N); CurrentNode = TopNode.get(); return true; } @@ -343,7 +343,7 @@ void Input::blockScalarString(StringRef &S) { scalarString(S, QuotingType::None) void Input::setError(HNode *hnode, const Twine &message) { assert(hnode && "HNode must not be NULL"); - this->setError(hnode->_node, message); + setError(hnode->_node, message); } void Input::setError(Node *node, const Twine &message) { @@ -366,7 +366,7 @@ std::unique_ptr Input::createHNodes(Node *N) { } else if (SequenceNode *SQ = dyn_cast(N)) { auto SQHNode = llvm::make_unique(N); for (Node &SN : *SQ) { - auto Entry = this->createHNodes(&SN); + auto Entry = createHNodes(&SN); if (EC) break; SQHNode->Entries.push_back(std::move(Entry)); @@ -391,7 +391,7 @@ std::unique_ptr Input::createHNodes(Node *N) { // Copy string to permanent storage KeyStr = StringStorage.str().copy(StringAllocator); } - auto ValueHNode = this->createHNodes(Value); + auto ValueHNode = createHNodes(Value); if (EC) break; mapHNode->Mapping[KeyStr] = std::move(ValueHNode); @@ -406,7 +406,7 @@ std::unique_ptr Input::createHNodes(Node *N) { } void Input::setError(const Twine &Message) { - this->setError(CurrentNode, Message); + setError(CurrentNode, Message); } bool Input::canElideEmptySequence() { @@ -440,11 +440,11 @@ bool Output::mapTag(StringRef Tag, bool Use) { StateStack.size() > 1 && (StateStack[StateStack.size() - 2] == inSeq || StateStack[StateStack.size() - 2] == inFlowSeq); if (SequenceElement && StateStack.back() == inMapFirstKey) { - this->newLineCheck(); + newLineCheck(); } else { - this->output(" "); + output(" "); } - this->output(Tag); + output(Tag); if (SequenceElement) { // If we're writing the tag during the first element of a map, the tag // takes the place of the first element in the sequence. @@ -476,8 +476,8 @@ bool Output::preflightKey(const char *Key, bool Required, bool SameAsDefault, if (State == inFlowMapFirstKey || State == inFlowMapOtherKey) { flowKey(Key); } else { - this->newLineCheck(); - this->paddedKey(Key); + newLineCheck(); + paddedKey(Key); } return true; } @@ -496,23 +496,23 @@ void Output::postflightKey(void *) { void Output::beginFlowMapping() { StateStack.push_back(inFlowMapFirstKey); - this->newLineCheck(); + newLineCheck(); ColumnAtMapFlowStart = Column; output("{ "); } void Output::endFlowMapping() { StateStack.pop_back(); - this->outputUpToEndOfLine(" }"); + outputUpToEndOfLine(" }"); } void Output::beginDocuments() { - this->outputUpToEndOfLine("---"); + outputUpToEndOfLine("---"); } bool Output::preflightDocument(unsigned index) { if (index > 0) - this->outputUpToEndOfLine("\n---"); + outputUpToEndOfLine("\n---"); return true; } @@ -542,7 +542,7 @@ void Output::postflightElement(void *) { unsigned Output::beginFlowSequence() { StateStack.push_back(inFlowSeq); - this->newLineCheck(); + newLineCheck(); ColumnAtFlowStart = Column; output("[ "); NeedFlowSequenceComma = false; @@ -551,7 +551,7 @@ unsigned Output::beginFlowSequence() { void Output::endFlowSequence() { StateStack.pop_back(); - this->outputUpToEndOfLine(" ]"); + outputUpToEndOfLine(" ]"); } bool Output::preflightFlowElement(unsigned, void *&) { @@ -577,8 +577,8 @@ void Output::beginEnumScalar() { bool Output::matchEnumScalar(const char *Str, bool Match) { if (Match && !EnumerationMatchFound) { - this->newLineCheck(); - this->outputUpToEndOfLine(Str); + newLineCheck(); + outputUpToEndOfLine(Str); EnumerationMatchFound = true; } return false; @@ -597,7 +597,7 @@ void Output::endEnumScalar() { } bool Output::beginBitSetScalar(bool &DoClear) { - this->newLineCheck(); + newLineCheck(); output("[ "); NeedBitValueComma = false; DoClear = false; @@ -608,27 +608,27 @@ bool Output::bitSetMatch(const char *Str, bool Matches) { if (Matches) { if (NeedBitValueComma) output(", "); - this->output(Str); + output(Str); NeedBitValueComma = true; } return false; } void Output::endBitSetScalar() { - this->outputUpToEndOfLine(" ]"); + outputUpToEndOfLine(" ]"); } void Output::scalarString(StringRef &S, QuotingType MustQuote) { - this->newLineCheck(); + newLineCheck(); if (S.empty()) { // Print '' for the empty string because leaving the field empty is not // allowed. - this->outputUpToEndOfLine("''"); + outputUpToEndOfLine("''"); return; } if (MustQuote == QuotingType::None) { // Only quote if we must. - this->outputUpToEndOfLine(S); + outputUpToEndOfLine(S); return; } @@ -645,7 +645,7 @@ void Output::scalarString(StringRef &S, QuotingType MustQuote) { // escapes. This is handled in yaml::escape. if (MustQuote == QuotingType::Double) { output(yaml::escape(Base, /* EscapePrintable= */ false)); - this->outputUpToEndOfLine(Quote); + outputUpToEndOfLine(Quote); return; } @@ -659,7 +659,7 @@ void Output::scalarString(StringRef &S, QuotingType MustQuote) { ++j; } output(StringRef(&Base[i], j - i)); - this->outputUpToEndOfLine(Quote); // Ending quote. + outputUpToEndOfLine(Quote); // Ending quote. } void Output::blockScalarString(StringRef &S) { @@ -702,7 +702,7 @@ void Output::output(StringRef s) { } void Output::outputUpToEndOfLine(StringRef s) { - this->output(s); + output(s); if (StateStack.empty() || (StateStack.back() != inFlowSeq && StateStack.back() != inFlowMapFirstKey && StateStack.back() != inFlowMapOtherKey)) @@ -723,7 +723,7 @@ void Output::newLineCheck() { return; NeedsNewLine = false; - this->outputNewLine(); + outputNewLine(); assert(StateStack.size() > 0); unsigned Indent = StateStack.size() - 1; -- 2.11.0