Unverified Commit 764c3afd authored by Krzysztof Parzyszek's avatar Krzysztof Parzyszek Committed by GitHub
Browse files

[Tooling/Inclusion] Avoid narrowing conversions in macro expansion (#72664)

```
clang/lib/Tooling/Inclusions/Stdlib/StandardLibrary.cpp:144:65: warning:
 narrowing conversion of ‘llvm::StringRef(((const char*)"std::experiment
al::filesystem::")).llvm::StringRef::size()’ from ‘size_t’ {aka ‘long un
signed int’} to ‘unsigned int’ [-Wnarrowing]
  144 | #define SYMBOL(Name, NS, Header) {#NS #Name, StringRef(#NS).size
(), #Header},
      |                                              ~~~~~~~~~~~~~~~~~~~
^~
clang/lib/Tooling/Inclusions/Stdlib/StdTsSymbolMap.inc:51:1: note: in ex
pansion of macro ‘SYMBOL’
   51 | SYMBOL(temp_directory_path, std::experimental::filesystem::, <ex
perimental/filesystem>)
      | ^~~~~~
```
parent 33e41c45
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -141,7 +141,9 @@ static int initialize(Lang Language) {
    unsigned NSLen;
    const char *HeaderName;
  };
#define SYMBOL(Name, NS, Header) {#NS #Name, StringRef(#NS).size(), #Header},
#define SYMBOL(Name, NS, Header)                                               \
  {#NS #Name, static_cast<decltype(Symbol::NSLen)>(StringRef(#NS).size()),     \
   #Header},
  switch (Language) {
  case Lang::C: {
    static constexpr Symbol CSymbols[] = {