[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
Wed Jan 18 05:33:16 PST 2023
VitaNuo updated this revision to Diff 490117.
VitaNuo marked an inline comment as done.
VitaNuo added a comment.
Minor adjustments in accordance with review comments.
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
@@ -28,9 +28,11 @@
get a "cppreference/reference" directory.
4. Run the command:
// Generate C++ symbols
- python3 gen_std.py -cppreference cppreference/reference -language=cpp > StdSymbolMap.inc
+ python3 gen_std.py -cppreference cppreference/reference -symbols=cpp > StdSymbolMap.inc
+ // Generate C++ removed symbols
+ python3 gen_std.py -cppreference cppreference/reference -symbols=cpp_removed > RemovedSymbolMap.inc
// Generate C symbols
- python3 gen_std.py -cppreference cppreference/reference -language=c > CSymbolMap.inc
+ python3 gen_std.py -cppreference cppreference/reference -symbols=c > CSymbolMap.inc
"""
@@ -60,16 +62,16 @@
help='path to the cppreference offline HTML directory',
required=True
)
- parser.add_argument('-language',
+ parser.add_argument('-symbols',
default='cpp',
- help='Generate c or cpp symbols',
- required=True)
+ help='Generate c or cpp (removed) symbols. One of {cpp, c, cpp_removed}.',
+ 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 +89,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 == 'cpp_removed':
+ 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::")]
+ 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)]
-
+ parse_pages = [(page_root, "index.html", None)]
+
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.490117.patch
Type: text/x-patch
Size: 3112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230118/83d7067d/attachment-0001.bin>
More information about the cfe-commits
mailing list