rtti.c
47.5 KB
-
c/c++: Add fix-it hints for suggested missing #includes · eea77d1f
gcc/c-family/ChangeLog: * c-common.c (try_to_locate_new_include_insertion_point): New function. (per_file_includes_t): New typedef. (added_includes_t): New typedef. (added_includes): New variable. (maybe_add_include_fixit): New function. * c-common.h (maybe_add_include_fixit): New decl. gcc/c/ChangeLog: * c-decl.c (implicitly_declare): When suggesting a missing #include, provide a fix-it hint. gcc/cp/ChangeLog: * name-lookup.c (get_std_name_hint): Add '<' and '>' around the header names. (maybe_suggest_missing_header): Update for addition of '<' and '>' to above. Provide a fix-it hint. * pt.c: Include "gcc-rich-location.h" (listify): Attempt to add fix-it hint for missing #include <initializer_list>. * rtti.c: Include "gcc-rich-location.h". (typeid_ok_p): Attempt to add fix-it hint for missing #include <typeinfo>. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/missing-initializer_list-include.C: New test case. * g++.dg/lookup/missing-std-include-2.C: New test case. * g++.dg/lookup/missing-std-include-3.C: New test case. * g++.dg/rtti/missing-typeinfo-include.C: New test case. * gcc.dg/missing-header-fixit-1.c: New test case. * gcc.dg/missing-header-fixit-2.c: New test case. * gcc.dg/missing-header-fixit-2.h: New header. From-SVN: r250203
David Malcolm committed