[PATCH] D60956: [Sema] Fix the lookup for a declaration conflicting with an enumerator (bogus use of LookupResult::getAsSingle)

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 21 14:42:46 PDT 2019


riccibruno created this revision.
riccibruno added reviewers: aaron.ballman, rnk, rsmith.
riccibruno added a project: clang.
Herald added a subscriber: cfe-commits.

Currently the lookup for a declaration conflicting with an enumerator is pretty broken, because of the use of `LookupResult::getAsSingle<NameDecl>()` (see the tests for examples).

This patch fixes this by removing the bogus use of `getAsSingle<NameDecl>()`. While we are at it, also do the check for a conflicting declaration before calling `CheckShadow` (which implements `Wshadow`). This avoids redundant `Wshadow` warnings where we already have an error.

This is not the only place where `getAsSingle` is mistakenly used, but this is better addressed in a later patch.


Repository:
  rC Clang

https://reviews.llvm.org/D60956

Files:
  lib/Sema/SemaDecl.cpp
  test/CXX/dcl.dcl/dcl.enum/p11-enumerator_scope.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60956.196023.patch
Type: text/x-patch
Size: 11554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190421/2aa7a412/attachment.bin>


More information about the cfe-commits mailing list