[PATCH] D142092: [include-mapping] Allow multiple headers for the same symbol. Choose the first header of available ones.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 27 05:55:25 PST 2023


kadircet added inline comments.


================
Comment at: clang/include/clang/Tooling/Inclusions/StdSymbolMap.inc:205
 SYMBOL(basic_syncbuf, std::, <syncstream>)
 SYMBOL(begin, std::, <iterator>)
 SYMBOL(bernoulli_distribution, std::, <random>)
----------------
i think we should have other providers here, https://en.cppreference.com/w/cpp/iterator/begin. do we know why they're dropped?


================
Comment at: clang/tools/include-mapping/cppreference_parser.py:165
       # FIXME: use these as a fallback rather than ignoring entirely.
-      variants_for_symbol = variants_to_accept.get(
-          (namespace or "") + symbol_name, ())
-      if variant and variant not in variants_for_symbol:
+      header_to_accept = variants_to_accept.get(
+          (namespace or "") + symbol_name, "")
----------------
`variant` is not necessarily the `header`, eg:
```
acos()
acos<>() (std::complex) (since C++11)
acos<>() (std::valarray)
```

in this case variants are `std::complex` and `std::valarray`. 

hence we're not trying to "infer" the header we want to preserve but rather decide on which symbol page we want to parse. we should still accept "all the headers" mentioned in that variant symbol page.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142092/new/

https://reviews.llvm.org/D142092



More information about the cfe-commits mailing list