Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp @@ -28,6 +28,8 @@ const auto *Prev = D->getPreviousDecl(); if (!Prev) return; + if (!Prev->getLocation().isValid()) + return; if (Prev->getLocation() == D->getLocation()) return; Index: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp +++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp @@ -21,3 +21,10 @@ // 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__));