[clang-tools-extra] r269195 - [include-fixer] Always ignore SFINAE contexts.

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


Author: d0k
Date: Wed May 11 10:33:30 2016
New Revision: 269195

URL: http://llvm.org/viewvc/llvm-project?rev=269195&view=rev
Log:
[include-fixer] Always ignore SFINAE contexts.

This could lead to spurious includes being added for identifiers that
are supposed to be not available.

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=269195&r1=269194&r2=269195&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/IncludeFixer.cpp Wed May 11 10:33:30 2016
@@ -94,6 +94,10 @@ public:
   /// have the fully qualified name ready. Just query that.
   bool MaybeDiagnoseMissingCompleteType(clang::SourceLocation Loc,
                                         clang::QualType T) override {
+    // Ignore spurious callbacks from SFINAE contexts.
+    if (getCompilerInstance().getSema().isSFINAEContext())
+      return false;
+
     clang::ASTContext &context = getCompilerInstance().getASTContext();
     query(T.getUnqualifiedType().getAsString(context.getPrintingPolicy()), Loc);
     return false;
@@ -107,6 +111,10 @@ public:
                                     DeclContext *MemberContext,
                                     bool EnteringContext,
                                     const ObjCObjectPointerType *OPT) override {
+    // Ignore spurious callbacks from SFINAE contexts.
+    if (getCompilerInstance().getSema().isSFINAEContext())
+      return clang::TypoCorrection();
+
     /// If we have a scope specification, use that to get more precise results.
     std::string QueryString;
     if (SS && SS->getRange().isValid()) {




More information about the cfe-commits mailing list