[llvm] r361835 - llvm-undname: Add support for local static thread guards

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 07:54:49 PDT 2019


Author: nico
Date: Tue May 28 07:54:49 2019
New Revision: 361835

URL: http://llvm.org/viewvc/llvm-project?rev=361835&view=rev
Log:
llvm-undname: Add support for local static thread guards

Modified:
    llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h
    llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h
    llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
    llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp
    llvm/trunk/test/Demangle/ms-operators.test

Modified: llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h?rev=361835&r1=361834&r2=361835&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h (original)
+++ llvm/trunk/include/llvm/Demangle/MicrosoftDemangle.h Tue May 28 07:54:49 2019
@@ -223,7 +223,7 @@ private:
   demangleSpecialTableSymbolNode(StringView &MangledName,
                                  SpecialIntrinsicKind SIK);
   LocalStaticGuardVariableNode *
-  demangleLocalStaticGuard(StringView &MangledName);
+  demangleLocalStaticGuard(StringView &MangledName, bool IsThread);
   VariableSymbolNode *demangleUntypedVariable(ArenaAllocator &Arena,
                                               StringView &MangledName,
                                               StringView VariableName);

Modified: llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h?rev=361835&r1=361834&r2=361835&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h (original)
+++ llvm/trunk/include/llvm/Demangle/MicrosoftDemangleNodes.h Tue May 28 07:54:49 2019
@@ -408,6 +408,7 @@ struct LocalStaticGuardIdentifierNode :
 
   void output(OutputStream &OS, OutputFlags Flags) const override;
 
+  bool IsThread = false;
   uint32_t ScopeIndex = 0;
 };
 

Modified: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp?rev=361835&r1=361834&r2=361835&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Tue May 28 07:54:49 2019
@@ -293,9 +293,10 @@ Demangler::demangleSpecialTableSymbolNod
 }
 
 LocalStaticGuardVariableNode *
-Demangler::demangleLocalStaticGuard(StringView &MangledName) {
+Demangler::demangleLocalStaticGuard(StringView &MangledName, bool IsThread) {
   LocalStaticGuardIdentifierNode *LSGI =
       Arena.alloc<LocalStaticGuardIdentifierNode>();
+  LSGI->IsThread = IsThread;
   QualifiedNameNode *QN = demangleNameScopeChain(MangledName, LSGI);
   LocalStaticGuardVariableNode *LSGVN =
       Arena.alloc<LocalStaticGuardVariableNode>();
@@ -443,7 +444,9 @@ SymbolNode *Demangler::demangleSpecialIn
   case SpecialIntrinsicKind::VcallThunk:
     return demangleVcallThunkNode(MangledName);
   case SpecialIntrinsicKind::LocalStaticGuard:
-    return demangleLocalStaticGuard(MangledName);
+    return demangleLocalStaticGuard(MangledName, /*IsThread=*/false);
+  case SpecialIntrinsicKind::LocalStaticThreadGuard:
+    return demangleLocalStaticGuard(MangledName, /*IsThread=*/true);
   case SpecialIntrinsicKind::RttiTypeDescriptor: {
     TypeNode *T = demangleType(MangledName, QualifierMangleMode::Result);
     if (Error)

Modified: llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp?rev=361835&r1=361834&r2=361835&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangleNodes.cpp Tue May 28 07:54:49 2019
@@ -349,7 +349,10 @@ void IntrinsicFunctionIdentifierNode::ou
 
 void LocalStaticGuardIdentifierNode::output(OutputStream &OS,
                                             OutputFlags Flags) const {
-  OS << "`local static guard'";
+  if (IsThread)
+    OS << "`local static thread guard'";
+  else
+    OS << "`local static guard'";
   if (ScopeIndex > 0)
     OS << "{" << ScopeIndex << "}";
 }

Modified: llvm/trunk/test/Demangle/ms-operators.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/ms-operators.test?rev=361835&r1=361834&r2=361835&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/ms-operators.test (original)
+++ llvm/trunk/test/Demangle/ms-operators.test Tue May 28 07:54:49 2019
@@ -230,6 +230,9 @@
 ??__F_decisionToDFA at XPathLexer@@0V?$vector at VDFA@dfa at antlr4@@V?$allocator at VDFA@dfa at antlr4@@@std@@@std@@A at YAXXZ
 ; CHECK: void __cdecl `dynamic atexit destructor for `private: static class std::vector<class antlr4::dfa::DFA, class std::allocator<class antlr4::dfa::DFA>> XPathLexer::_decisionToDFA''(void)
 
+??__J?1??f@@YAAAUS@@XZ at 51
+; CHECK: `struct S & __cdecl f(void)'::`2'::`local static thread guard'{2}
+
 ??__K_deg@@YAHO at Z
 ; CHECK: int __cdecl operator ""_deg(long double)
 




More information about the llvm-commits mailing list