diff options
author | David Kilroy <kilroyd@googlemail.com> | 2023-04-09 13:42:29 +0100 |
---|---|---|
committer | Kim Gräsman <kim.grasman@gmail.com> | 2023-04-10 11:41:35 +0200 |
commit | e7a0577dd6ca968323ee5ea3f82d77a9694ff6f9 (patch) | |
tree | b6a7dfb342f0878e4609ca4e09331d5b1be7b77c | |
parent | 5095537c4b3b79d5ffd6e6f5dd0dfe65c4cc940d (diff) |
libstdcxx std::declval source
std::declval is defined in <utility>. Currently libstdcxx actually
defines it in <type_traits>, so add a mapping so we suggest the
canonical include.
This also fixes a problem with MSVC builds, which don't like empty
arrays.
-rw-r--r-- | gcc.symbols.imp | 3 | ||||
-rw-r--r-- | iwyu_include_picker.cc | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc.symbols.imp b/gcc.symbols.imp index d666b70..e72abf6 100644 --- a/gcc.symbols.imp +++ b/gcc.symbols.imp @@ -259,6 +259,9 @@ { symbol: [ "NULL", private, "<unistd.h>", public ] }, { symbol: [ "NULL", private, "<wchar.h>", public ] }, + # GCC defines std::declval in <type_traits>, but the canonical location is <utility> + { symbol: [ "std::declval", private, "<utility>", public ] }, + # Kludge time: almost all STL types take an allocator, but they # almost always use the default value. Usually we detect that # and don't try to do IWYU, but sometimes it passes through. diff --git a/iwyu_include_picker.cc b/iwyu_include_picker.cc index 638bf3f..ac78d77 100644 --- a/iwyu_include_picker.cc +++ b/iwyu_include_picker.cc @@ -375,7 +375,10 @@ const IncludeMapEntry stdlib_cxx_symbol_map[] = { }; // Symbol -> include mappings for GNU libstdc++ -const IncludeMapEntry libstdcpp_symbol_map[] = {}; +const IncludeMapEntry libstdcpp_symbol_map[] = { + // GCC defines std::declval in <type_traits>, but the canonical location is <utility> + { "std::declval", kPrivate, "<utility>", kPublic }, +}; const IncludeMapEntry libc_include_map[] = { // Private -> public include mappings for GNU libc |