[clang-tools-extra] r269194 - [include-fixer] Also output the location where we found an unknown identifier.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Wed May 11 08:33:28 PDT 2016


Author: d0k
Date: Wed May 11 10:33:28 2016
New Revision: 269194

URL: http://llvm.org/viewvc/llvm-project?rev=269194&view=rev
Log:
[include-fixer] Also output the location where we found an unknown identifier.

For debugging only, makes it a bit easier when there are queries coming
out of headers.

Modified:
    clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp

Modified: clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp?rev=269194&r1=269193&r2=269194&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Wed May 11 10:33:28 2016
@@ -95,7 +95,7 @@ public:
   bool MaybeDiagnoseMissingCompleteType(clang::SourceLocation Loc,
                                         clang::QualType T) override {
     clang::ASTContext &context = getCompilerInstance().getASTContext();
-    query(T.getUnqualifiedType().getAsString(context.getPrintingPolicy()));
+    query(T.getUnqualifiedType().getAsString(context.getPrintingPolicy()), Loc);
     return false;
   }
 
@@ -141,7 +141,7 @@ public:
       QueryString = Typo.getAsString();
     }
 
-    return query(QueryString);
+    return query(QueryString, Typo.getLoc());
   }
 
   StringRef filename() const { return Filename; }
@@ -226,14 +226,16 @@ public:
 
 private:
   /// Query the database for a given identifier.
-  clang::TypoCorrection query(StringRef Query) {
+  clang::TypoCorrection query(StringRef Query, SourceLocation Loc) {
     assert(!Query.empty() && "Empty query!");
 
     // Save database lookups by not looking up identifiers multiple times.
     if (!SeenQueries.insert(Query).second)
       return clang::TypoCorrection();
 
-    DEBUG(llvm::dbgs() << "Looking up " << Query << " ... ");
+    DEBUG(llvm::dbgs() << "Looking up '" << Query << "' at ");
+    DEBUG(Loc.print(llvm::dbgs(), getCompilerInstance().getSourceManager()));
+    DEBUG(llvm::dbgs() << " ...");
 
     std::string error_text;
     auto SearchReply = XrefsDBMgr.search(Query);




More information about the cfe-commits mailing list