diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py index 0cbfd2e2910e1..5254d16e410d5 100755 --- a/llvm/utils/extract_symbols.py +++ b/llvm/utils/extract_symbols.py @@ -97,6 +97,16 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration): # don't elif symbol.startswith("??_G") or symbol.startswith("??_E"): return None + # Delete template instantiations. These start with ?$ and can be discarded + # because they will be instantiated in the importing translation unit if + # needed. + elif symbol.startswith("??$"): + return None + # Delete lambda object constructors and operator() functions. These start + # with ??R ::= exceptions are not allowed - elif re.search(r"(llvm|clang)@@[A-Z][A-Z0-9_]*[A-JQ].+(X|.+@|.*Z)$", symbol): + elif re.search(r"@(llvm|clang)@@[A-Z][A-Z0-9_]*[A-JQ].+(X|.+@|.*Z)$", symbol): + # Remove llvm::::dump and clang::::dump methods because + # they are used for debugging only. + if symbol.startswith("?dump@"): + return None + return symbol + # Keep mangled global variables and static class members in llvm:: namespace. + # These have a type mangling that looks like (this is derived from + # clang/lib/AST/MicrosoftMangle.cpp): + # ::= + # ::= 0 # private static member + # ::= 1 # protected static member + # ::= 2 # public static member + # ::= 3 # global + # ::= 4 # static local + # ::= + # ::= # pointers, references + elif re.search(r"@llvm@@[0-3].*$", symbol): return symbol return None