[PATCH] D26455: Handle non-inlined clang::Type::getAs specializations in extract_symbols.py
Stephan Bergmann via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 9 09:14:28 PST 2016
sberg created this revision.
sberg added a reviewer: john.brawn.
sberg added a subscriber: llvm-commits.
The existing logic was to discard any symbols representing function template instantiations, as the definitions were assumed to be inline. But there are three explicit specializations of clang::Type::getAs that are only defined in Clang's lib/AST/Type.cpp, and at least the plugin used by the LibreOffice build (https://wiki.documentfoundation.org/Development/Clang_plugins) uses those functions.
https://reviews.llvm.org/D26455
Files:
utils/extract_symbols.py
Index: utils/extract_symbols.py
===================================================================
--- utils/extract_symbols.py
+++ utils/extract_symbols.py
@@ -128,8 +128,15 @@
if match:
return match.group(1)
return symbol
- # Function template instantiations start with ?$, discard them as it's
- # assumed that the definition is public
+ # Function template instantiations start with ?$, keep the explicit
+ # specializations of clang::Type::getAs for clang::AttributedType,
+ # clang::TemplateSpecializationType, and clang::TypedefType that are defined
+ # in clang's lib/AST/Type.cpp; discard the rest as it's assumed that the
+ # definition is public
+ elif symbol == '??$getAs at VAttributedType@clang@@@Type at clang@@QEBAPEBVAttributedType at 1@XZ' \
+ or symbol == '??$getAs at VTemplateSpecializationType@clang@@@Type at clang@@QEBAPEBVTemplateSpecializationType at 1@XZ' \
+ or symbol == '??$getAs at VTypedefType@clang@@@Type at clang@@QEBAPEBVTypedefType at 1@XZ':
+ return symbol
elif symbol.startswith('??$'):
return None
# Deleting destructors start with ?_G or ?_E and can be discarded because
@@ -195,8 +202,15 @@
# defined in headers and not required to be kept
if re.match('[CD][123]', names[-1][0]) and names[-2][1]:
return None
- # Discard function template instantiations as it's assumed that the
+ # Keep the explicit specializations of clang::Type::getAs for
+ # clang::AttributedType, clang::TemplateSpecializationType, and
+ # clang::TypedefType that are defined in clang's lib/AST/Type.cpp; discard
+ # any other function template instantiations as it's assumed that the
# definition is public
+ elif symbol == '_ZNK5clang4Type5getAsINS_14AttributedTypeEEEPKT_v' \
+ or symbol == '_ZNK5clang4Type5getAsINS_26TemplateSpecializationTypeEEEPKT_v' \
+ or symbol == '_ZNK5clang4Type5getAsINS_11TypedefTypeEEEPKT_v':
+ return symbol
elif names[-1][1]:
return None
# Keep llvm:: and clang:: names
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26455.77359.patch
Type: text/x-patch
Size: 2082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161109/6ac2c88e/attachment.bin>
More information about the llvm-commits
mailing list