[llvm] r286841 - Handle non-inlined clang::Type::getAs specializations in extract_symbols.py

Stephan Bergmann via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 09:07:09 PST 2016


Author: sberg
Date: Mon Nov 14 11:07:09 2016
New Revision: 286841

URL: http://llvm.org/viewvc/llvm-project?rev=286841&view=rev
Log:
Handle non-inlined clang::Type::getAs specializations in extract_symbols.py

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.

Differential Revision: https://reviews.llvm.org/D26455

Modified:
    llvm/trunk/utils/extract_symbols.py

Modified: llvm/trunk/utils/extract_symbols.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/extract_symbols.py?rev=286841&r1=286840&r2=286841&view=diff
==============================================================================
--- llvm/trunk/utils/extract_symbols.py (original)
+++ llvm/trunk/utils/extract_symbols.py Mon Nov 14 11:07:09 2016
@@ -128,8 +128,12 @@ def should_keep_microsoft_symbol(symbol,
             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 instantiations of
+    # clang::Type::getAs, as some of them are explipict specializations that are
+    # defined in clang's lib/AST/Type.cpp; discard the rest as it's assumed that
+    # the definition is public
+    elif re.match('\?\?\$getAs at .+@Type at clang@@', symbol):
+        return symbol
     elif symbol.startswith('??$'):
         return None
     # Deleting destructors start with ?_G or ?_E and can be discarded because
@@ -195,8 +199,12 @@ def should_keep_itanium_symbol(symbol, c
     # 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
-    # definition is public
+    # Keep the instantiations of clang::Type::getAs, as some of them are
+    # explipict specializations 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.startswith('_ZNK5clang4Type5getAs'):
+        return symbol
     elif names[-1][1]:
         return None
     # Keep llvm:: and clang:: names




More information about the llvm-commits mailing list