summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDecl.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 65ca8dd44d7..1abd7d0ae6b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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<RecordDecl>(OldDC)) {
if (isa<FieldDecl>(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();
OpenPOWER on IntegriCloud