]> granicus.if.org Git - clang/commitdiff
Small code cleanup/simplification in Sema::ClassifyName.
authorKaelyn Uhrain <rikka@google.com>
Tue, 24 Jan 2012 19:45:35 +0000 (19:45 +0000)
committerKaelyn Uhrain <rikka@google.com>
Tue, 24 Jan 2012 19:45:35 +0000 (19:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148850 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index 980c59c4c94b12261d34b6a79b0fe455819162f5..a84612edfc0b1e9f35034834e2fab645d944f611 100644 (file)
@@ -604,19 +604,19 @@ Corrected:
         // Update the name, so that the caller has the new name.
         Name = Corrected.getCorrectionAsIdentifierInfo();
         
+        // Typo correction corrected to a keyword.
+        if (Corrected.isKeyword())
+          return Corrected.getCorrectionAsIdentifierInfo();
+
         // Also update the LookupResult...
         // FIXME: This should probably go away at some point
         Result.clear();
         Result.setLookupName(Corrected.getCorrection());
-        if (FirstDecl) Result.addDecl(FirstDecl);
-
-        // Typo correction corrected to a keyword.
-        if (Corrected.isKeyword())
-          return Corrected.getCorrectionAsIdentifierInfo();
-        
-        if (FirstDecl)
+        if (FirstDecl) {
+          Result.addDecl(FirstDecl);
           Diag(FirstDecl->getLocation(), diag::note_previous_decl)
             << CorrectedQuotedStr;
+        }
 
         // If we found an Objective-C instance variable, let
         // LookupInObjCMethod build the appropriate expression to