Re: Issue 951 in include-what-you-use: Bug: parsing /usr/lib/llvm-12/include/llvm/Support/Casting.h fails?

1 view
Skip to first unread message

notifi...@include-what-you-use.org

unread,
Jan 5, 2022, 9:21:01 PM1/5/22
to include-wh...@googlegroups.com
Comment #16 on issue 951 by bccox: Bug: parsing /usr/lib/llvm-12/include/llvm/Support/Casting.h fails?
https://github.com/include-what-you-use/include-what-you-use/issues/951

I'm seeing the same problem, except that IWYU is compiled against llvm-13 on my Debian system. Is there any hope of fixing this? I'd rather not have to choose between using include-what-you-use and fmt.


notifi...@include-what-you-use.org

unread,
Jan 6, 2022, 9:29:09 AM1/6/22
to include-wh...@googlegroups.com
Comment #16 on issue 951 by kimgr: Bug: parsing /usr/lib/llvm-12/include/llvm/Support/Casting.h fails?
https://github.com/include-what-you-use/include-what-you-use/issues/951

@bccox I've worked on this off and on, but haven't come to any conclusive root cause or fix. I'm pretty sure it's a bug in Clang. I'll try to finish up my repro case and open a proper Clang bug today.


notifi...@include-what-you-use.org

unread,
Jan 6, 2022, 3:24:23 PM1/6/22
to include-wh...@googlegroups.com
Comment #18 on issue 951 by gabyx: Bug: parsing /usr/lib/llvm-12/include/llvm/Support/Casting.h fails?
https://github.com/include-what-you-use/include-what-you-use/issues/951

@kimgr Thanks for your effort.


notifi...@include-what-you-use.org

unread,
Jan 7, 2022, 4:05:35 PM1/7/22
to include-wh...@googlegroups.com
Comment #18 on issue 951 by kimgr: Bug: parsing /usr/lib/llvm-12/include/llvm/Support/Casting.h fails?
https://github.com/include-what-you-use/include-what-you-use/issues/951

It's now confirmed to be a Clang bug, and I managed to reduce the repro case to this:
```
// consteval.cpp
struct X {
consteval X(const char*) {
}
};

void t() {
X x = "foobar";
}
```
The `consteval` is what triggers it:
```
$ include-what-you-use -std=c++20 consteval.cpp
include-what-you-use: /usr/lib/llvm-14/include/llvm/Support/Casting.h:269: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = clang::FunctionDecl; Y = const clang::NamedDecl; typename llvm::cast_retty<X, Y*>::ret_type = const clang::FunctionDecl*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Aborted (core dumped)
```

Hopefully I can get


notifi...@include-what-you-use.org

unread,
Jan 7, 2022, 4:05:47 PM1/7/22
to include-wh...@googlegroups.com
Comment #19 on issue 951 by kimgr: Bug: parsing /usr/lib/llvm-12/include/llvm/Support/Casting.h fails?

notifi...@include-what-you-use.org

unread,
Jan 15, 2022, 5:46:03 AM1/15/22
to include-wh...@googlegroups.com
Comment #20 on issue 951 by kimgr: Bug: parsing /usr/lib/llvm-12/include/llvm/Support/Casting.h fails?
https://github.com/include-what-you-use/include-what-you-use/issues/951

Update! I have a Clang patch open for this now: https://reviews.llvm.org/D117391. :crossed_fingers:


Reply all
Reply to author
Forward
0 new messages