[PATCH] D143214: [include-mapping] Add C-compatibility symbol entries.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 6 04:30:53 PST 2023


kadircet added inline comments.


================
Comment at: clang/tools/include-mapping/gen_std.py:123
+    c_header = "<" + header[2:-1] +  ".h>"
+    if not any(re.fullmatch(x, symbol.name) for x in exception_symbols):
+      if symbol.namespace != None:
----------------
nit: early exits

```
if header not in c_compat_headers:
  return []
if any(re.fullmatch(x, symbol.name) for x in exception_symbols)::
  return []
...
```


================
Comment at: clang/tools/include-mapping/gen_std.py:124
+    if not any(re.fullmatch(x, symbol.name) for x in exception_symbols):
+      if symbol.namespace != None:
+        # avoid printing duplicated entries, for C macros!
----------------
maybe add a comment like: `Introduce two more entries, both in the global namespace, one using the C++-compat header and another using the C header`.


================
Comment at: clang/tools/include-mapping/gen_std.py:127
+        results.append(cppreference_parser.Symbol(symbol.name, None, [header]))
+        # print("SYMBOL(%s, None, %s)" % (symbol.name, symbol.headers[0]))
+      results.append(cppreference_parser.Symbol(symbol.name, None, [c_header]))
----------------
i think it might be better to delete this line.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143214



More information about the cfe-commits mailing list