From: Kaelyn Uhrain Date: Tue, 24 Jan 2012 19:45:35 +0000 (+0000) Subject: Small code cleanup/simplification in Sema::ClassifyName. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5ee6345b5af1c88262d02d248e76ad2423161a0;p=clang Small code cleanup/simplification in Sema::ClassifyName. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148850 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 980c59c4c9..a84612edfc 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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