[PATCH] D21603: [include-fixer] Add missing namespace qualifiers after inserting a missing header.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 6 05:21:20 PDT 2016


hokein added a comment.

In http://reviews.llvm.org/D21603#475011, @bkramer wrote:

> In the future I'd prefer to have patches like this split up in a part that refactors and a part that contains the actual change. Having that in one patch makes it really hard to review.


Acknowledged. I'm sorry for it. I didn't foresee that I would change so much code before I implementing this.

So let me summarize the changes of this patch:

1. Instead of returning raw string headers, make `SymbolIndexManager::search` return `Symbolnfos`.
2. Move `rankByPopularity`  unique SymbolInfo code from `SymbolIndexManager.cpp` to `IncludeFixerContext.cpp`.
3. Extend `IncludeFixerContext` to track more `SymbolInfo` information (e.g. `SymbolRange`, `SymbolScopedQualifiers`).
4. Some move stuff in `Action::query` API.
5. Create `adding namespace qualifiers` replacement for the unidentified symbol.


================
Comment at: include-fixer/IncludeFixer.cpp:73
@@ -72,2 +72,3 @@
     clang::ASTContext &context = getCompilerInstance().getASTContext();
-    query(T.getUnqualifiedType().getAsString(context.getPrintingPolicy()), Loc);
+    llvm::StringRef QueryString =
+        T.getUnqualifiedType().getAsString(context.getPrintingPolicy());
----------------
bkramer wrote:
> std::string, otherwise this will be a user after free.
Good catch. Done.


http://reviews.llvm.org/D21603





More information about the cfe-commits mailing list