Closed GoogleCodeExporter closed 9 years ago
I think your patch may be papering over a real problem, which I'd rather get at
here. With the patch, you get
Invalid location: warning: is defined in <jsanalyze.h>, which isn't directly #included.
You suggest that this might be an 'anonymous decl', but I suspect it's not: I
suspect we're making a OneUse object with NULL values for everything, somehow.
(Then the question is not 'why is the spelling loc 0', but 'why is the
instantiation loc not-0' :-) )
One way to test this is in gdb, to 'print use' (in the GetWarningMsg frame).
What does it show?
Original comment by csilv...@gmail.com
on 15 May 2011 at 10:32
Here's p use:
$1 = (const include_what_you_use::OneUse &) @0x1f72ec0: {symbol_name_ = {static
npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3759cf9018 ""}}, short_symbol_name_ = {
static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
_M_p = 0x3759cf9018 ""}}, decl_ = 0x0, decl_filepath_ = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x1f7a348 "<jsanalyze.h>"}}, use_loc_ = {
ID = 0}, use_kind_ = include_what_you_use::OneUse::kFullUse, in_cxx_method_body_ = false, comment_ = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3759cf9018 ""}},
public_headers_ = {<std::_Vector_base<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {
_M_impl = {<std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {<__gnu_cxx::new_allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >> = {<No data fields>}, <No data fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data fields>},
suggested_header_ = {static npos = 18446744073709551615,
_M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x1f79528 "<jsanalyze.h>"}},
ignore_use_ = false, is_iwyu_violation_ = true}
Original comment by Ehren.M
on 15 May 2011 at 10:48
I think this was a problem with __FILE__ but it looks like it's been fixed
somehow.
When I run the same testcase now with the latest rev. of clang and iwyu with
IWYU_VERBOSE=7 I don't actually get any lines matching "is defined in
<jsscript.h>, which isn't directly #included." though so I couldn't say exactly
why there's no more failure.
However, when you compiled
const char *file = __FILE__;
it used to produce verbose output like
[ Use macro ] file.cpp:1:20: (from Invalid location)
now you get
[ Use macro ] file.cpp:1:20: __FILE__ (from Invalid location)
...probably the reason there's no more crash (although it's odd that I don't
see any mention of __FILE__ in the verbose output from the original
spidermonkey tescase)
Original comment by Ehren.M
on 3 Jun 2011 at 1:15
Hmm, so it sounds like the bug has magically fixed itself? I'm happy to let it
lie, in that case, and will close this Fixed (there's no "MagicallyFixed"
status :-) ). If I misunderstood, feel free to reopen the bug.
Original comment by csilv...@gmail.com
on 3 Jun 2011 at 8:37
Original issue reported on code.google.com by
Ehren.M
on 15 May 2011 at 8:56Attachments: