Differential Revision: https://reviews.llvm.org/D26911
llvm-svn: 287540
const auto *Prev = D->getPreviousDecl();
if (!Prev)
return;
+ if (!Prev->getLocation().isValid())
+ return;
if (Prev->getLocation() == D->getLocation())
return;
// 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__));