From: Alexander Kornienko Date: Wed, 23 Mar 2016 14:28:52 +0000 (+0000) Subject: Use an enum instead of hardcoded indices. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a0f0641024537e78b44d0f37c4b9b077b77d62f;p=clang Use an enum instead of hardcoded indices. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264158 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 65ca8dd44d..1abd7d0ae6 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -6423,16 +6423,20 @@ void Sema::CheckShadow(Scope *S, VarDecl *D, const LookupResult& R) { } // Determine what kind of declaration we're shadowing. - unsigned Kind; + + // The order must be consistent with the %select in the warning message. + enum ShadowedDeclKind { Local, Global, StaticMember, Field }; + ShadowedDeclKind Kind; if (isa(OldDC)) { if (isa(ShadowedDecl)) - Kind = 3; // field + Kind = Field; else - Kind = 2; // static data member - } else if (OldDC->isFileContext()) - Kind = 1; // global - else - Kind = 0; // local + Kind = StaticMember; + } else if (OldDC->isFileContext()) { + Kind = Global; + } else { + Kind = Local; + } DeclarationName Name = R.getLookupName();