[PATCH] D35483: clang-format: fix block OpeningLineIndex around preprocessor

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 20 02:47:47 PDT 2017


krasimir added inline comments.


================
Comment at: lib/Format/UnwrappedLineParser.cpp:464
+  for (const auto &i : PPStack) {
+    hash_combine(h, i.Kind);
+    hash_combine(h, i.Line);
----------------
When I patch this, I get an `UnwrappedLineParser.cpp:457:16 error: implicit instantiation of undefined template 'std::hash<clang::format::UnwrappedLineParser::PPBranchKind>'`. 


================
Comment at: lib/Format/UnwrappedLineParser.h:158
   bool isOnNewLine(const FormatToken &FormatTok);
+  size_t computePPHash() const;
 
----------------
Please add a short comment of why is the preprocessor hash needed.


================
Comment at: lib/Format/UnwrappedLineParser.h:213
+    PPBranch(PPBranchKind Kind, size_t Line) : Kind(Kind), Line(Line) {}
+    bool operator==(PPBranchKind Kind) const { return Kind == this->Kind; }
+    PPBranchKind Kind;
----------------
This `operator==` is confusing. Please remove it.


https://reviews.llvm.org/D35483





More information about the cfe-commits mailing list