1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[Support] Remove redundant qualifiers in YAMLTraits (NFC)

llvm-svn: 344166
This commit is contained in:
Scott Linder 2018-10-10 18:14:02 +00:00
parent ed7ac50b0a
commit 3aeeb26969
2 changed files with 28 additions and 40 deletions

View File

@ -250,7 +250,6 @@ struct has_ScalarEnumerationTraits
template <typename U>
static double test(...);
public:
static bool const value =
(sizeof(test<ScalarEnumerationTraits<T>>(nullptr)) == 1);
};
@ -267,7 +266,6 @@ struct has_ScalarBitSetTraits
template <typename U>
static double test(...);
public:
static bool const value = (sizeof(test<ScalarBitSetTraits<T>>(nullptr)) == 1);
};
@ -287,7 +285,6 @@ struct has_ScalarTraits
template <typename U>
static double test(...);
public:
static bool const value =
(sizeof(test<ScalarTraits<T>>(nullptr, nullptr, nullptr)) == 1);
};
@ -306,7 +303,6 @@ struct has_BlockScalarTraits
template <typename U>
static double test(...);
public:
static bool const value =
(sizeof(test<BlockScalarTraits<T>>(nullptr, nullptr)) == 1);
};
@ -321,7 +317,6 @@ template <class T, class Context> struct has_MappingTraits {
template <typename U>
static double test(...);
public:
static bool const value =
(sizeof(test<MappingContextTraits<T, Context>>(nullptr)) == 1);
};
@ -335,7 +330,6 @@ template <class T> struct has_MappingTraits<T, EmptyContext> {
template <typename U> static double test(...);
public:
static bool const value = (sizeof(test<MappingTraits<T>>(nullptr)) == 1);
};
@ -349,7 +343,6 @@ template <class T, class Context> struct has_MappingValidateTraits {
template <typename U>
static double test(...);
public:
static bool const value =
(sizeof(test<MappingContextTraits<T, Context>>(nullptr)) == 1);
};
@ -363,7 +356,6 @@ template <class T> struct has_MappingValidateTraits<T, EmptyContext> {
template <typename U> static double test(...);
public:
static bool const value = (sizeof(test<MappingTraits<T>>(nullptr)) == 1);
};
@ -379,7 +371,6 @@ struct has_SequenceMethodTraits
template <typename U>
static double test(...);
public:
static bool const value = (sizeof(test<SequenceTraits<T>>(nullptr)) == 1);
};
@ -395,7 +386,6 @@ struct has_CustomMappingTraits
template <typename U>
static double test(...);
public:
static bool const value =
(sizeof(test<CustomMappingTraits<T>>(nullptr)) == 1);
};
@ -425,7 +415,6 @@ struct has_FlowTraits<T, true>
template<typename C>
static char (&f(...))[2];
public:
static bool const value = sizeof(f<Derived>(nullptr)) == 2;
};
@ -446,7 +435,6 @@ struct has_DocumentListTraits
template <typename U>
static double test(...);
public:
static bool const value = (sizeof(test<DocumentListTraits<T>>(nullptr))==1);
};

View File

@ -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::HNode> Input::createHNodes(Node *N) {
} else if (SequenceNode *SQ = dyn_cast<SequenceNode>(N)) {
auto SQHNode = llvm::make_unique<SequenceHNode>(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::HNode> 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::HNode> 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;