[PATCH] D141855: [include-mapping] Parse zombie_names.html into a removed symbols map.

Viktoriia Bakalova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 17 07:53:17 PST 2023


VitaNuo updated this revision to Diff 489827.
VitaNuo added a comment.

Remove extra whitespace.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141855

Files:
  clang/tools/include-mapping/gen_std.py


Index: clang/tools/include-mapping/gen_std.py
===================================================================
--- clang/tools/include-mapping/gen_std.py
+++ clang/tools/include-mapping/gen_std.py
@@ -60,16 +60,16 @@
                       help='path to the cppreference offline HTML directory',
                       required=True
                      )
-  parser.add_argument('-language',
-                      default='cpp',
-                      help='Generate c or cpp symbols',
-                      required=True)
+  parser.add_argument('-symbols',
+                      default='cpp_symbols',
+                      help='Generate c or cpp (removed) symbols. One of {cpp_symbols, c_symbols, cpp_removed_symbols}.',
+                      required=True) 
   return parser.parse_args()
 
 
 def main():
   args = ParseArg()
-  if args.language == 'cpp':
+  if args.symbols == 'cpp':
     page_root = os.path.join(args.cppreference, "en", "cpp")
     symbol_index_root = os.path.join(page_root, "symbol_index")
     parse_pages =  [
@@ -87,22 +87,26 @@
       (symbol_index_root, "regex_constants.html", "std::regex_constants::"),
       (symbol_index_root, "this_thread.html", "std::this_thread::"),
     ]
-  elif args.language == 'c':
+  elif args.symbols == 'c':
     page_root = os.path.join(args.cppreference, "en", "c")
     symbol_index_root = page_root
     parse_pages = [(page_root, "index.html", None)]
-
+  elif args.symbols == 'cpp_removed_symbols':
+    page_root = os.path.join(args.cppreference, "en", "cpp")
+    symbol_index_root = os.path.join(page_root, "symbol_index")
+    parse_pages = [(symbol_index_root, "zombie_names.html", "std::")]
+    
   if not os.path.exists(symbol_index_root):
     exit("Path %s doesn't exist!" % symbol_index_root)
 
   symbols = cppreference_parser.GetSymbols(parse_pages)
-
+  
   # We don't have version information from the unzipped offline HTML files.
   # so we use the modified time of the symbol_index.html as the version.
   index_page_path = os.path.join(page_root, "index.html")
   cppreference_modified_date = datetime.datetime.fromtimestamp(
     os.stat(index_page_path).st_mtime).strftime('%Y-%m-%d')
-  print(CODE_PREFIX % (args.language.upper(), cppreference_modified_date))
+  print(CODE_PREFIX % (args.symbols.upper(), cppreference_modified_date))
   for symbol in symbols:
     if len(symbol.headers) == 1:
       # SYMBOL(unqualified_name, namespace, header)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141855.489827.patch
Type: text/x-patch
Size: 2448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230117/cd974aef/attachment.bin>


More information about the cfe-commits mailing list