diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-10-08 22:47:55 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-10-08 22:47:55 +0000 |
commit | 6eeaff169ddfbce483790bc6db3e08fe424f14ed (patch) | |
tree | be3d2af93ef3db0dbde74c843431c740296cb52e /llvm/lib/Support/YAMLParser.cpp | |
parent | 066c8db3478ae4c15ba24955b1bafb1ae4e860b4 (diff) | |
download | bcm5719-llvm-6eeaff169ddfbce483790bc6db3e08fe424f14ed.tar.gz bcm5719-llvm-6eeaff169ddfbce483790bc6db3e08fe424f14ed.zip |
Support: Stop relying on iterator auto-conversion, NFC
Stop relying on ilist implicit conversions from `value_type&` to
`iterator` in YAMLParser.cpp.
I eventually want to outlaw this entirely. It encourages
`getNextNode()` and `getPrevNode()` in iterator logic, which is
extremely fragile (and relies on them never returning `nullptr`).
FTR, there's nothing nefarious going on in this case, it was just easy
to clean up since the callers really wanted iterators to begin with.
llvm-svn: 249767
Diffstat (limited to 'llvm/lib/Support/YAMLParser.cpp')
-rw-r--r-- | llvm/lib/Support/YAMLParser.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp index d55da5ef1e4..bb02bbbc5b4 100644 --- a/llvm/lib/Support/YAMLParser.cpp +++ b/llvm/lib/Support/YAMLParser.cpp @@ -801,7 +801,7 @@ Token &Scanner::peekNext() { removeStaleSimpleKeyCandidates(); SimpleKey SK; - SK.Tok = TokenQueue.front(); + SK.Tok = TokenQueue.begin(); if (std::find(SimpleKeys.begin(), SimpleKeys.end(), SK) == SimpleKeys.end()) break; @@ -1163,7 +1163,7 @@ bool Scanner::scanFlowCollectionStart(bool IsSequence) { TokenQueue.push_back(T); // [ and { may begin a simple key. - saveSimpleKeyCandidate(TokenQueue.back(), Column - 1, false); + saveSimpleKeyCandidate(--TokenQueue.end(), Column - 1, false); // And may also be followed by a simple key. IsSimpleKeyAllowed = true; @@ -1326,7 +1326,7 @@ bool Scanner::scanFlowScalar(bool IsDoubleQuoted) { T.Range = StringRef(Start, Current - Start); TokenQueue.push_back(T); - saveSimpleKeyCandidate(TokenQueue.back(), ColStart, false); + saveSimpleKeyCandidate(--TokenQueue.end(), ColStart, false); IsSimpleKeyAllowed = false; @@ -1404,7 +1404,7 @@ bool Scanner::scanPlainScalar() { TokenQueue.push_back(T); // Plain scalars can be simple keys. - saveSimpleKeyCandidate(TokenQueue.back(), ColStart, false); + saveSimpleKeyCandidate(--TokenQueue.end(), ColStart, false); IsSimpleKeyAllowed = false; @@ -1439,7 +1439,7 @@ bool Scanner::scanAliasOrAnchor(bool IsAlias) { TokenQueue.push_back(T); // Alias and anchors can be simple keys. - saveSimpleKeyCandidate(TokenQueue.back(), ColStart, false); + saveSimpleKeyCandidate(--TokenQueue.end(), ColStart, false); IsSimpleKeyAllowed = false; @@ -1669,7 +1669,7 @@ bool Scanner::scanTag() { TokenQueue.push_back(T); // Tags can be simple keys. - saveSimpleKeyCandidate(TokenQueue.back(), ColStart, false); + saveSimpleKeyCandidate(--TokenQueue.end(), ColStart, false); IsSimpleKeyAllowed = false; |