[clang-tools-extra] r258356 - Make modernize-use-default tolerant of delayed template parsing; this code was previously causing failed assertions because dyn_cast was being passed a null pointer due to the delay-parsed body.

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 21 13:03:51 PST 2016


On Thu, Jan 21, 2016 at 12:00 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Thu, Jan 21, 2016 at 1:01 PM, Hans Wennborg <hans at chromium.org> wrote:
>> Thanks.
>>
>> Aaron, do you want to go ahead and merge this with
>> utils/release/merge.sh? Or let me know if you'd prefer me to do the
>> merge.
>
> I'd prefer if you'd handle the merge (I'm on Windows), if you don't mind.

No problem, r258431.

Cheers,
Hans


>> On Thu, Jan 21, 2016 at 10:00 AM, Alexander Kornienko <alexfh at google.com> wrote:
>>> I'm fine with including this to 3.8. BTW, I'm working on release notes.
>>>
>>> On Thu, Jan 21, 2016 at 6:01 PM, Hans Wennborg <hans at chromium.org> wrote:
>>>>
>>>> I'm fine with it. Alex, what do you think?
>>>>
>>>> On Wed, Jan 20, 2016 at 3:07 PM, Aaron Ballman <aaron at aaronballman.com>
>>>> wrote:
>>>> > Uncertain whether this meets the bar for inclusion in 3.8.
>>>> > clang-modernize was moved into clang-tidy and from what I can tell, it
>>>> > did not suffer from this crash. I wouldn't normally recommend this,
>>>> > but just about any use of clang-tidy (that does not filter out this
>>>> > check) over code that includes the MSVC STL headers will trigger that
>>>> > assert without this fix.
>>>> >
>>>> > ~Aaron
>>>> >
>>>> > On Wed, Jan 20, 2016 at 5:14 PM, Aaron Ballman via cfe-commits
>>>> > <cfe-commits at lists.llvm.org> wrote:
>>>> >> Author: aaronballman
>>>> >> Date: Wed Jan 20 16:14:10 2016
>>>> >> New Revision: 258356
>>>> >>
>>>> >> URL: http://llvm.org/viewvc/llvm-project?rev=258356&view=rev
>>>> >> Log:
>>>> >> Make modernize-use-default tolerant of delayed template parsing; this
>>>> >> code was previously causing failed assertions because dyn_cast was being
>>>> >> passed a null pointer due to the delay-parsed body.
>>>> >>
>>>> >> Added:
>>>> >>
>>>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>>>> >> Modified:
>>>> >>     clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>>> >>
>>>> >> Modified:
>>>> >> clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>>> >> URL:
>>>> >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp?rev=258356&r1=258355&r2=258356&view=diff
>>>> >>
>>>> >> ==============================================================================
>>>> >> --- clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>>> >> (original)
>>>> >> +++ clang-tools-extra/trunk/clang-tidy/modernize/UseDefaultCheck.cpp
>>>> >> Wed Jan 20 16:14:10 2016
>>>> >> @@ -272,6 +272,7 @@ void UseDefaultCheck::check(const MatchF
>>>> >>    // that are not user-provided (automatically generated).
>>>> >>    if (SpecialFunctionDecl->isDeleted() ||
>>>> >>        SpecialFunctionDecl->isExplicitlyDefaulted() ||
>>>> >> +      SpecialFunctionDecl->isLateTemplateParsed() ||
>>>> >>        !SpecialFunctionDecl->isUserProvided() ||
>>>> >> !SpecialFunctionDecl->hasBody())
>>>> >>      return;
>>>> >>
>>>> >>
>>>> >> Added:
>>>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>>>> >> URL:
>>>> >> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp?rev=258356&view=auto
>>>> >>
>>>> >> ==============================================================================
>>>> >> ---
>>>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>>>> >> (added)
>>>> >> +++
>>>> >> clang-tools-extra/trunk/test/clang-tidy/modernize-use-default-delayed.cpp
>>>> >> Wed Jan 20 16:14:10 2016
>>>> >> @@ -0,0 +1,8 @@
>>>> >> +// RUN: clang-tidy %s -checks=-*,modernize-use-default -- -std=c++11
>>>> >> -fdelayed-template-parsing -fexceptions | count 0
>>>> >> +// Note: this test expects no diagnostics, but FileCheck cannot handle
>>>> >> that,
>>>> >> +// hence the use of | count 0.
>>>> >> +
>>>> >> +template <typename Ty>
>>>> >> +struct S {
>>>> >> +  S<Ty>& operator=(const S<Ty>&) { return *this; }
>>>> >> +};
>>>> >>
>>>> >>
>>>> >> _______________________________________________
>>>> >> 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