[cfe-commits] r148441 - in /cfe/trunk: include/clang/Sema/Sema.h lib/Sema/SemaLookup.cpp

Kaelyn Uhrain rikka at google.com
Wed Jan 18 16:33:34 PST 2012


Author: rikka
Date: Wed Jan 18 18:33:34 2012
New Revision: 148441

URL: http://llvm.org/viewvc/llvm-project?rev=148441&view=rev
Log:
Remove the now-unused CorrectTypoContext enum.

Modified:
    cfe/trunk/include/clang/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaLookup.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=148441&r1=148440&r2=148441&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Jan 18 18:33:34 2012
@@ -1833,41 +1833,6 @@
                           VisibleDeclConsumer &Consumer,
                           bool IncludeGlobalScope = true);
 
-  /// \brief The context in which typo-correction occurs.
-  ///
-  /// The typo-correction context affects which keywords (if any) are
-  /// considered when trying to correct for typos.
-  enum CorrectTypoContext {
-    /// \brief An unknown context, where any keyword might be valid.
-    CTC_Unknown,
-    /// \brief A context where no keywords are used (e.g. we expect an actual
-    /// name).
-    CTC_NoKeywords,
-    /// \brief A context where we're correcting a type name.
-    CTC_Type,
-    /// \brief An expression context.
-    CTC_Expression,
-    /// \brief A type cast, or anything else that can be followed by a '<'.
-    CTC_CXXCasts,
-    /// \brief A member lookup context.
-    CTC_MemberLookup,
-    /// \brief An Objective-C ivar lookup context (e.g., self->ivar).
-    CTC_ObjCIvarLookup,
-    /// \brief An Objective-C property lookup context (e.g., self.prop).
-    CTC_ObjCPropertyLookup,
-    /// \brief The receiver of an Objective-C message send within an
-    /// Objective-C method where 'super' is a valid keyword.
-    CTC_ObjCMessageReceiver
-  };
-
-  TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo,
-                             Sema::LookupNameKind LookupKind,
-                             Scope *S, CXXScopeSpec *SS,
-                             DeclContext *MemberContext = 0,
-                             bool EnteringContext = false,
-                             CorrectTypoContext CTC = CTC_Unknown,
-                             const ObjCObjectPointerType *OPT = 0);
-
   TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo,
                              Sema::LookupNameKind LookupKind,
                              Scope *S, CXXScopeSpec *SS,

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=148441&r1=148440&r2=148441&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Jan 18 18:33:34 2012
@@ -3503,77 +3503,6 @@
   }
 }
 
-namespace {
-
-// Simple CorrectionCandidateCallback class that sets the keyword flags based
-// on a given CorrectTypoContext, but does not perform any extra validation
-// of typo correction candidates.
-class CorrectTypoContextReplacementCCC : public CorrectionCandidateCallback {
- public:
-  CorrectTypoContextReplacementCCC(
-      Sema &SemaRef, Sema::CorrectTypoContext CTC = Sema::CTC_Unknown) {
-    WantTypeSpecifiers = false;
-    WantExpressionKeywords = false;
-    WantCXXNamedCasts = false;
-    WantRemainingKeywords = false;
-    switch (CTC) {
-      case Sema::CTC_Unknown:
-        WantTypeSpecifiers = true;
-        WantExpressionKeywords = true;
-        WantCXXNamedCasts = true;
-        WantRemainingKeywords = true;
-        if (ObjCMethodDecl *Method = SemaRef.getCurMethodDecl())
-          WantObjCSuper = Method->getClassInterface() &&
-                          Method->getClassInterface()->getSuperClass();
-        break;
-
-      case Sema::CTC_Type:
-        WantTypeSpecifiers = true;
-        break;
-
-      case Sema::CTC_ObjCMessageReceiver:
-        WantObjCSuper = true;
-        // Fall through to handle message receivers like expressions.
-
-      case Sema::CTC_Expression:
-        if (SemaRef.getLangOptions().CPlusPlus)
-          WantTypeSpecifiers = true;
-        WantExpressionKeywords = true;
-        // Fall through to get C++ named casts.
-
-      case Sema::CTC_CXXCasts:
-        WantCXXNamedCasts = true;
-        break;
-
-      case Sema::CTC_MemberLookup:
-      case Sema::CTC_NoKeywords:
-      case Sema::CTC_ObjCPropertyLookup:
-        break;
-
-      case Sema::CTC_ObjCIvarLookup:
-        IsObjCIvarLookup = true;
-        break;
-    }
-  }
-};
-
-}
-
-/// \brief Compatibility wrapper for call sites that pass a CorrectTypoContext
-/// value to CorrectTypo instead of providing a callback object.
-TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
-                                 Sema::LookupNameKind LookupKind,
-                                 Scope *S, CXXScopeSpec *SS,
-                                 DeclContext *MemberContext,
-                                 bool EnteringContext,
-                                 CorrectTypoContext CTC,
-                                 const ObjCObjectPointerType *OPT) {
-  CorrectTypoContextReplacementCCC CTCVerifier(*this, CTC);
-
-  return CorrectTypo(TypoName, LookupKind, S, SS, &CTCVerifier, MemberContext,
-                     EnteringContext, OPT);
-}
-
 /// \brief Try to "correct" a typo in the source code by finding
 /// visible declarations whose names are similar to the name that was
 /// present in the source code.
@@ -3708,7 +3637,7 @@
     }
   }
 
-  CorrectTypoContextReplacementCCC DefaultCCC(*this);
+  CorrectionCandidateCallback DefaultCCC;
   AddKeywordsToConsumer(*this, Consumer, S, CCC ? *CCC : DefaultCCC);
 
   // If we haven't found anything, we're done.





More information about the cfe-commits mailing list