[PATCH] D113320: [clang-format] Address fixme
This revision was automatically updated to reflect the committed changes. Closed by commit rG66336056911e: [clang-format] Address fixme (authored by HazardyKnusperkeks). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113320/new/ https://reviews.llvm.org/D113320 Files: clang/lib/Format/TokenAnnotator.h clang/lib/Format/UnwrappedLineParser.cpp clang/lib/Format/UnwrappedLineParser.h Index: clang/lib/Format/UnwrappedLineParser.h === --- clang/lib/Format/UnwrappedLineParser.h +++ clang/lib/Format/UnwrappedLineParser.h @@ -19,8 +19,8 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" #include "llvm/Support/Regex.h" -#include #include +#include namespace clang { namespace format { @@ -36,9 +36,8 @@ struct UnwrappedLine { UnwrappedLine(); - // FIXME: Don't use std::list here. /// The \c Tokens comprising this \c UnwrappedLine. - std::list Tokens; + std::vector Tokens; /// The indent level of the \c UnwrappedLine. unsigned Level; Index: clang/lib/Format/UnwrappedLineParser.cpp === --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3034,24 +3034,15 @@ llvm::dbgs() << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -llvm::dbgs() << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() - << ", OC=" << I->Tok->OriginalColumn << "] "; - } - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -const UnwrappedLineNode = *I; -for (SmallVectorImpl::const_iterator - I = Node.Children.begin(), - E = Node.Children.end(); - I != E; ++I) { - printDebugInfo(*I, "\nChild: "); -} + for (const auto : Line.Tokens) { +llvm::dbgs() << Node.Tok->Tok.getName() << "[" + << "T=" << static_cast(Node.Tok->getType()) + << ", OC=" << Node.Tok->OriginalColumn << "] "; } + for (const auto : Line.Tokens) +for (const auto : Node.Children) + printDebugInfo(ChildNode, "\nChild: "); + llvm::dbgs() << "\n"; } Index: clang/lib/Format/TokenAnnotator.h === --- clang/lib/Format/TokenAnnotator.h +++ clang/lib/Format/TokenAnnotator.h @@ -53,9 +53,7 @@ // left them in a different state. First->Previous = nullptr; FormatToken *Current = First; -for (std::list::const_iterator I = ++Line.Tokens.begin(), - E = Line.Tokens.end(); - I != E; ++I) { +for (auto I = ++Line.Tokens.begin(), E = Line.Tokens.end(); I != E; ++I) { const UnwrappedLineNode = *I; Current->Next = I->Tok; I->Tok->Previous = Current; Index: clang/lib/Format/UnwrappedLineParser.h === --- clang/lib/Format/UnwrappedLineParser.h +++ clang/lib/Format/UnwrappedLineParser.h @@ -19,8 +19,8 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" #include "llvm/Support/Regex.h" -#include #include +#include namespace clang { namespace format { @@ -36,9 +36,8 @@ struct UnwrappedLine { UnwrappedLine(); - // FIXME: Don't use std::list here. /// The \c Tokens comprising this \c UnwrappedLine. - std::list Tokens; + std::vector Tokens; /// The indent level of the \c UnwrappedLine. unsigned Level; Index: clang/lib/Format/UnwrappedLineParser.cpp === --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3034,24 +3034,15 @@ llvm::dbgs() << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -llvm::dbgs() << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() - << ", OC=" << I->Tok->OriginalColumn << "] "; - } - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -const UnwrappedLineNode = *I; -for (SmallVectorImpl::const_iterator - I = Node.Children.begin(), - E =
[PATCH] D113320: [clang-format] Address fixme
MyDeveloperDay accepted this revision. MyDeveloperDay added a comment. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113320/new/ https://reviews.llvm.org/D113320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113320: [clang-format] Address fixme
HazardyKnusperkeks updated this revision to Diff 385248. HazardyKnusperkeks marked an inline comment as done. HazardyKnusperkeks added a reviewer: owenpan. HazardyKnusperkeks added a comment. Dropped braces. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113320/new/ https://reviews.llvm.org/D113320 Files: clang/lib/Format/TokenAnnotator.h clang/lib/Format/UnwrappedLineParser.cpp clang/lib/Format/UnwrappedLineParser.h Index: clang/lib/Format/UnwrappedLineParser.h === --- clang/lib/Format/UnwrappedLineParser.h +++ clang/lib/Format/UnwrappedLineParser.h @@ -19,8 +19,8 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" #include "llvm/Support/Regex.h" -#include #include +#include namespace clang { namespace format { @@ -36,9 +36,8 @@ struct UnwrappedLine { UnwrappedLine(); - // FIXME: Don't use std::list here. /// The \c Tokens comprising this \c UnwrappedLine. - std::list Tokens; + std::vector Tokens; /// The indent level of the \c UnwrappedLine. unsigned Level; Index: clang/lib/Format/UnwrappedLineParser.cpp === --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3056,24 +3056,15 @@ llvm::dbgs() << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -llvm::dbgs() << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() - << ", OC=" << I->Tok->OriginalColumn << "] "; - } - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -const UnwrappedLineNode = *I; -for (SmallVectorImpl::const_iterator - I = Node.Children.begin(), - E = Node.Children.end(); - I != E; ++I) { - printDebugInfo(*I, "\nChild: "); -} + for (const auto : Line.Tokens) { +llvm::dbgs() << Node.Tok->Tok.getName() << "[" + << "T=" << static_cast(Node.Tok->getType()) + << ", OC=" << Node.Tok->OriginalColumn << "] "; } + for (const auto : Line.Tokens) +for (const auto : Node.Children) + printDebugInfo(ChildNode, "\nChild: "); + llvm::dbgs() << "\n"; } Index: clang/lib/Format/TokenAnnotator.h === --- clang/lib/Format/TokenAnnotator.h +++ clang/lib/Format/TokenAnnotator.h @@ -53,9 +53,7 @@ // left them in a different state. First->Previous = nullptr; FormatToken *Current = First; -for (std::list::const_iterator I = ++Line.Tokens.begin(), - E = Line.Tokens.end(); - I != E; ++I) { +for (auto I = ++Line.Tokens.begin(), E = Line.Tokens.end(); I != E; ++I) { const UnwrappedLineNode = *I; Current->Next = I->Tok; I->Tok->Previous = Current; Index: clang/lib/Format/UnwrappedLineParser.h === --- clang/lib/Format/UnwrappedLineParser.h +++ clang/lib/Format/UnwrappedLineParser.h @@ -19,8 +19,8 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" #include "llvm/Support/Regex.h" -#include #include +#include namespace clang { namespace format { @@ -36,9 +36,8 @@ struct UnwrappedLine { UnwrappedLine(); - // FIXME: Don't use std::list here. /// The \c Tokens comprising this \c UnwrappedLine. - std::list Tokens; + std::vector Tokens; /// The indent level of the \c UnwrappedLine. unsigned Level; Index: clang/lib/Format/UnwrappedLineParser.cpp === --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3056,24 +3056,15 @@ llvm::dbgs() << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -llvm::dbgs() << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() - << ", OC=" << I->Tok->OriginalColumn << "] "; - } - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -const UnwrappedLineNode = *I; -for (SmallVectorImpl::const_iterator - I =
[PATCH] D113320: [clang-format] Address fixme
owenpan added a comment. Looks okay. Comment at: clang/lib/Format/UnwrappedLineParser.cpp:3064-3068 + for (const auto : Line.Tokens) { +for (const auto : Node.Children) + printDebugInfo(ChildNode, "\nChild: "); + } Nit: elide braces. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113320/new/ https://reviews.llvm.org/D113320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113320: [clang-format] Address fixme
HazardyKnusperkeks created this revision. HazardyKnusperkeks added reviewers: MyDeveloperDay, djasper. HazardyKnusperkeks added a project: clang-format. HazardyKnusperkeks requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D113320 Files: clang/lib/Format/TokenAnnotator.h clang/lib/Format/UnwrappedLineParser.cpp clang/lib/Format/UnwrappedLineParser.h Index: clang/lib/Format/UnwrappedLineParser.h === --- clang/lib/Format/UnwrappedLineParser.h +++ clang/lib/Format/UnwrappedLineParser.h @@ -19,8 +19,8 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" #include "llvm/Support/Regex.h" -#include #include +#include namespace clang { namespace format { @@ -36,9 +36,8 @@ struct UnwrappedLine { UnwrappedLine(); - // FIXME: Don't use std::list here. /// The \c Tokens comprising this \c UnwrappedLine. - std::list Tokens; + std::vector Tokens; /// The indent level of the \c UnwrappedLine. unsigned Level; Index: clang/lib/Format/UnwrappedLineParser.cpp === --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3056,23 +3056,15 @@ llvm::dbgs() << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -llvm::dbgs() << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() - << ", OC=" << I->Tok->OriginalColumn << "] "; + for (const auto : Line.Tokens) { +llvm::dbgs() << Node.Tok->Tok.getName() << "[" + << "T=" << static_cast(Node.Tok->getType()) + << ", OC=" << Node.Tok->OriginalColumn << "] "; } - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -const UnwrappedLineNode = *I; -for (SmallVectorImpl::const_iterator - I = Node.Children.begin(), - E = Node.Children.end(); - I != E; ++I) { - printDebugInfo(*I, "\nChild: "); -} + for (const auto : Line.Tokens) { +for (const auto : Node.Children) + printDebugInfo(ChildNode, "\nChild: "); + } llvm::dbgs() << "\n"; } Index: clang/lib/Format/TokenAnnotator.h === --- clang/lib/Format/TokenAnnotator.h +++ clang/lib/Format/TokenAnnotator.h @@ -53,9 +53,7 @@ // left them in a different state. First->Previous = nullptr; FormatToken *Current = First; -for (std::list::const_iterator I = ++Line.Tokens.begin(), - E = Line.Tokens.end(); - I != E; ++I) { +for (auto I = ++Line.Tokens.begin(), E = Line.Tokens.end(); I != E; ++I) { const UnwrappedLineNode = *I; Current->Next = I->Tok; I->Tok->Previous = Current; Index: clang/lib/Format/UnwrappedLineParser.h === --- clang/lib/Format/UnwrappedLineParser.h +++ clang/lib/Format/UnwrappedLineParser.h @@ -19,8 +19,8 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" #include "llvm/Support/Regex.h" -#include #include +#include namespace clang { namespace format { @@ -36,9 +36,8 @@ struct UnwrappedLine { UnwrappedLine(); - // FIXME: Don't use std::list here. /// The \c Tokens comprising this \c UnwrappedLine. - std::list Tokens; + std::vector Tokens; /// The indent level of the \c UnwrappedLine. unsigned Level; Index: clang/lib/Format/UnwrappedLineParser.cpp === --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3056,23 +3056,15 @@ llvm::dbgs() << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -llvm::dbgs() << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() - << ", OC=" << I->Tok->OriginalColumn << "] "; + for (const auto : Line.Tokens) { +llvm::dbgs() << Node.Tok->Tok.getName() << "[" + << "T=" << static_cast(Node.Tok->getType()) + << ", OC=" << Node.Tok->OriginalColumn << "] "; } - for (std::list::const_iterator I =