[PATCH] D33440: clang-format: better handle statement macros
Daniel Jasper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 14 02:30:44 PDT 2017
djasper added inline comments.
================
Comment at: lib/Format/FormatTokenLexer.cpp:642
tok::pp_define) &&
- std::find(ForEachMacros.begin(), ForEachMacros.end(),
- FormatTok->Tok.getIdentifierInfo()) != ForEachMacros.end()) {
- FormatTok->Type = TT_ForEachMacro;
+ (it = std::find(Macros.begin(), Macros.end(),
+ FormatTok->Tok.getIdentifierInfo())) != Macros.end()) {
----------------
This does a binary search. Why aren't you implementing it with a hashtable?
================
Comment at: lib/Format/FormatTokenLexer.h:101
+
+ struct MacroInfo {
+ MacroInfo() : Identifier(NULL), TokType(TT_Unknown) {}
----------------
What does this class do and why do we need it? Describe it's purpose in a comment.
================
Comment at: lib/Format/FormatTokenLexer.h:102
+ struct MacroInfo {
+ MacroInfo() : Identifier(NULL), TokType(TT_Unknown) {}
+ MacroInfo(IdentifierInfo *Identifier, TokenType TokType)
----------------
nullptr
================
Comment at: lib/Format/FormatTokenLexer.h:109
+
+ bool operator==(const MacroInfo &Other) const {
+ return Identifier == Other.Identifier;
----------------
Are all of these used?
https://reviews.llvm.org/D33440
More information about the cfe-commits
mailing list