Skip to content

Commit

Permalink
readability-redundant-declaration: Fix crash
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D26911

llvm-svn: 287540
  • Loading branch information
Daniel Marjamaki committed Nov 21, 2016
1 parent 35369c1 commit ae66045
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Expand Up @@ -28,6 +28,8 @@ void RedundantDeclarationCheck::check(const MatchFinder::MatchResult &Result) {
const auto *Prev = D->getPreviousDecl();
if (!Prev)
return;
if (!Prev->getLocation().isValid())
return;
if (Prev->getLocation() == D->getLocation())
return;

Expand Down
Expand Up @@ -21,3 +21,10 @@ static int f();
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: redundant 'f' declaration
// CHECK-FIXES: {{^}}{{$}}
static int f() {}

// Original check crashed for the code below.
namespace std {
typedef long unsigned int size_t;
}
void* operator new(std::size_t) __attribute__((__externally_visible__));
void* operator new[](std::size_t) __attribute__((__externally_visible__));

0 comments on commit ae66045

Please sign in to comment.