[clang-tools-extra] r287540 - readability-redundant-declaration: Fix crash
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 21 07:59:13 PST 2016
On Mon, Nov 21, 2016 at 9:29 AM, Daniel Marjamaki via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Author: danielmarjamaki
> Date: Mon Nov 21 08:29:53 2016
> New Revision: 287540
>
> URL: http://llvm.org/viewvc/llvm-project?rev=287540&view=rev
> Log:
> readability-redundant-declaration: Fix crash
>
> Differential Revision: https://reviews.llvm.org/D26911
>
>
> Modified:
> clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp
> clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp
>
> Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp?rev=287540&r1=287539&r2=287540&view=diff
> ==============================================================================
> --- clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp (original)
> +++ clang-tools-extra/trunk/clang-tidy/readability/RedundantDeclarationCheck.cpp Mon Nov 21 08:29:53 2016
> @@ -28,6 +28,8 @@ void RedundantDeclarationCheck::check(co
> const auto *Prev = D->getPreviousDecl();
> if (!Prev)
> return;
> + if (!Prev->getLocation().isValid())
> + return;
> if (Prev->getLocation() == D->getLocation())
> return;
>
>
> Modified: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp?rev=287540&r1=287539&r2=287540&view=diff
> ==============================================================================
> --- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp (original)
> +++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-declaration.cpp Mon Nov 21 08:29:53 2016
> @@ -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;
Instead of this (or your current fix that specifies the target), why
not do: typedef decltype(sizeof(0)) size_t; ?
~Aaron
> +}
> +void* operator new(std::size_t) __attribute__((__externally_visible__));
> +void* operator new[](std::size_t) __attribute__((__externally_visible__));
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list