[PATCH] D22299: [include-fixer] Implement adding missing namespace qualifiers in vim integration.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 13 03:45:42 PDT 2016


bkramer added inline comments.

================
Comment at: include-fixer/IncludeFixerContext.cpp:54
@@ +53,3 @@
+    llvm::StringRef Name, llvm::StringRef ScopeQualifiers,
+    const std::vector<find_all_symbols::SymbolInfo> Symbols,
+    tooling::Range Range)
----------------
Drop the const ...

================
Comment at: include-fixer/IncludeFixerContext.cpp:57
@@ +56,3 @@
+    : SymbolIdentifier(Name), SymbolScopedQualifiers(ScopeQualifiers),
+      MatchedSymbols(Symbols), SymbolRange(Range) {
+  for (const auto &Symbol : MatchedSymbols) {
----------------
... use std::move to move Symbols into place.

================
Comment at: include-fixer/IncludeFixerContext.h:32
@@ +31,3 @@
+    std::string Header;
+    /// \brief A symbol name with completed namespace qulifiers which will
+    /// replace the original symbol.
----------------
Typo: qulifiers

================
Comment at: include-fixer/IncludeFixerContext.h:65
@@ +64,3 @@
+
+  /// \brief The header informations.
+  std::vector<HeaderInfo> HeaderInfos;
----------------
s/informations/information/

================
Comment at: include-fixer/tool/ClangIncludeFixer.cpp:252
@@ +251,3 @@
+    // Only accept an unique header.
+    bool IsUniqueHeader =
+        std::adjacent_find(HeaderInfos.begin(), HeaderInfos.end(),
----------------
Is it guaranteed that two headers with the same name are adjacent in the HeaderInfos vector? If so, point that out in a comment, otherwise adjacent_find isn't the right algorithm here.

================
Comment at: include-fixer/tool/ClangIncludeFixer.cpp:259
@@ -209,1 +258,3 @@
+    if (!IsUniqueHeader) {
+      errs() << "Expect exactly an unique header.\n";
       return 1;
----------------
"Expected exactly one unique header"?

================
Comment at: include-fixer/tool/clang-include-fixer.py:119
@@ +118,3 @@
+  header_infos = include_fixer_context["HeaderInfos"]
+  # Reduplicate headers, so that the same header would not be suggested twice.
+  headers = list(set([header_info["Header"] for header_info in header_infos]))
----------------
Reduplicate?


http://reviews.llvm.org/D22299





More information about the cfe-commits mailing list