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@VAttributedType@clang@@@Type@clang@@QEBAPEBVAttributedType@1@XZ' \ + or symbol == '??$getAs@VTemplateSpecializationType@clang@@@Type@clang@@QEBAPEBVTemplateSpecializationType@1@XZ' \ + or symbol == '??$getAs@VTypedefType@clang@@@Type@clang@@QEBAPEBVTypedefType@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