[cfe-dev] [clang-tidy] using isInTemplateInstantiation asserts
Piotr Padlewski via cfe-dev
cfe-dev at lists.llvm.org
Tue Apr 12 10:44:48 PDT 2016
It requires this patch:
http://reviews.llvm.org/D18274
I am trying to reproduce it right now with clang-query
2016-04-12 19:27 GMT+02:00 Alexander Kornienko <alexfh at google.com>:
> I can't reproduce the issue (how I understand it) using clang-query, and
> http://reviews.llvm.org/D18136 doesn't apply cleanly, since it depends on
> some other patch.
>
> $ cat /tmp/q.cc
> namespace boost {
> template <typename T, typename C>
> T lexical_cast(const C&) {
> return T();
> }
> }
>
> namespace std {
> template <typename T>
> class basic_string {};
> using string = basic_string<char>;
> }
>
> int g();
> long long f(int p);
> using namespace boost;
>
> template <typename T>
> void string_as_T() {
> boost::lexical_cast<T>(42);
> }
>
> int main() { string_as_T<std::string>(); }
>
> $ clang-query /tmp/q.cc -- -std=c++11
> clang-query> m callExpr()
>
> Match #1:
>
> /tmp/q.cc:20:3: note: "root" binds here
> boost::lexical_cast<T>(42);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Match #2:
>
> /tmp/q.cc:20:3: note: "root" binds here
> boost::lexical_cast<T>(42);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Match #3:
>
> /tmp/q.cc:23:14: note: "root" binds here
> int main() { string_as_T<std::string>(); }
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> 3 matches.
> clang-query> m callExpr(unless(isInTemplateInstantiation()))
>
> Match #1:
>
> /tmp/q.cc:20:3: note: "root" binds here
> boost::lexical_cast<T>(42);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Match #2:
>
> /tmp/q.cc:23:14: note: "root" binds here
> int main() { string_as_T<std::string>(); }
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> 2 matches.
> clang-query>
>
>
> On Thu, Apr 7, 2016 at 8:25 PM, Piotr Padlewski <piotr.padlewski at gmail.com
> > wrote:
>
>> This should be enough to break this matcher
>> http://pastebin.com/CH7a3hur
>>
>> 2016-04-07 18:56 GMT+02:00 Alexander Kornienko <alexfh at google.com>:
>>
>>> Can you provide a minimal test for this?
>>>
>>> On Thu, Apr 7, 2016 at 4:04 PM, Piotr Padlewski <
>>> piotr.padlewski at gmail.com> wrote:
>>>
>>>> bump.
>>>>
>>>> 2016-04-04 20:48 GMT+02:00 Piotr Padlewski <piotr.padlewski at gmail.com>:
>>>>
>>>>>
>>>>> Hi guys,
>>>>> I am having trobles with isInTemplateInstantiation matcher. When I run
>>>>> my matcher (http://reviews.llvm.org/D18136), it fails on the assert
>>>>> in ASTTypeTraits.h:299, when KindId is NodeKindId::NKI_TemplateArgument.
>>>>>
>>>>> I think my matcher is fine, and there is bug somewhere. Can someone
>>>>> please tell me if I am doing something wrong, and if not, why it doesn't
>>>>> work and what I should fix?
>>>>>
>>>>> Here is my backtrace http://4programmers.net/Pastebin/5347
>>>>>
>>>>> Best
>>>>> Piotr
>>>>>
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160412/c126f83c/attachment.html>
More information about the cfe-dev
mailing list