[Lldb-commits] [PATCH] D68674: Remove the is_mangled flag from Mangled and Symbol

2019-10-09 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG939411c1aaa8: Remove the is_mangled flag from Mangled and 
Symbol (authored by aprantl).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D68674?vs=223965=224079#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68674/new/

https://reviews.llvm.org/D68674

Files:
  lldb/include/lldb/Core/Mangled.h
  lldb/include/lldb/Symbol/Function.h
  lldb/include/lldb/Symbol/Symbol.h
  lldb/source/API/SBType.cpp
  lldb/source/Core/Mangled.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/unittests/Core/MangledTest.cpp

Index: lldb/unittests/Core/MangledTest.cpp
===
--- lldb/unittests/Core/MangledTest.cpp
+++ lldb/unittests/Core/MangledTest.cpp
@@ -29,9 +29,7 @@
 
 TEST(MangledTest, ResultForValidName) {
   ConstString MangledName("_ZN1a1b1cIiiiEEvm");
-  bool IsMangled = true;
-
-  Mangled TheMangled(MangledName, IsMangled);
+  Mangled TheMangled(MangledName);
   ConstString TheDemangled =
   TheMangled.GetDemangledName(eLanguageTypeC_plus_plus);
 
@@ -41,9 +39,7 @@
 
 TEST(MangledTest, EmptyForInvalidName) {
   ConstString MangledName("_ZN1a1b1cmxktpEEvm");
-  bool IsMangled = true;
-
-  Mangled TheMangled(MangledName, IsMangled);
+  Mangled TheMangled(MangledName);
   ConstString TheDemangled =
   TheMangled.GetDemangledName(eLanguageTypeC_plus_plus);
 
Index: lldb/source/Symbol/Symbol.cpp
===
--- lldb/source/Symbol/Symbol.cpp
+++ lldb/source/Symbol/Symbol.cpp
@@ -31,9 +31,8 @@
   m_is_weak(false), m_type(eSymbolTypeInvalid), m_mangled(), m_addr_range(),
   m_flags() {}
 
-Symbol::Symbol(uint32_t symID, const char *name, bool name_is_mangled,
-   SymbolType type, bool external, bool is_debug,
-   bool is_trampoline, bool is_artificial,
+Symbol::Symbol(uint32_t symID, llvm::StringRef name, SymbolType type, bool external,
+   bool is_debug, bool is_trampoline, bool is_artificial,
const lldb::SectionSP _sp, addr_t offset, addr_t size,
bool size_is_valid, bool contains_linker_annotations,
uint32_t flags)
@@ -42,9 +41,9 @@
   m_is_debug(is_debug), m_is_external(external), m_size_is_sibling(false),
   m_size_is_synthesized(false), m_size_is_valid(size_is_valid || size > 0),
   m_demangled_is_synthesized(false),
-  m_contains_linker_annotations(contains_linker_annotations), 
+  m_contains_linker_annotations(contains_linker_annotations),
   m_is_weak(false), m_type(type),
-  m_mangled(ConstString(name), name_is_mangled),
+  m_mangled(name),
   m_addr_range(section_sp, offset, size), m_flags(flags) {}
 
 Symbol::Symbol(uint32_t symID, const Mangled , SymbolType type,
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -59,10 +59,11 @@
   return m_name.MemorySize() + m_declaration.MemorySize();
 }
 
-InlineFunctionInfo::InlineFunctionInfo(const char *name, const char *mangled,
+InlineFunctionInfo::InlineFunctionInfo(const char *name,
+   llvm::StringRef mangled,
const Declaration *decl_ptr,
const Declaration *call_decl_ptr)
-: FunctionInfo(name, decl_ptr), m_mangled(ConstString(mangled), true),
+: FunctionInfo(name, decl_ptr), m_mangled(mangled),
   m_call_decl(call_decl_ptr) {}
 
 InlineFunctionInfo::InlineFunctionInfo(ConstString name,
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1422,7 +1422,6 @@
 symtab.AddSymbol(
 Symbol(pub_symbol->getSymIndexId(),   // symID
pub_symbol->getName().c_str(), // name
-   true,  // name_is_mangled
pub_symbol->isCode() ? eSymbolTypeCode : eSymbolTypeData, // type
true,  // external
false, // is_debug
Index: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ 

[Lldb-commits] [PATCH] D68674: Remove the is_mangled flag from Mangled and Symbol

2019-10-09 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.

Looks like a nice cleanup, if we can get away with that. I tried to come up 
with a situation where we would have a more authoritative source on whether 
something is mangled or not than just looking at the string, but I haven't come 
up with anything, so the answer is hopefully yes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68674/new/

https://reviews.llvm.org/D68674



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68674: Remove the is_mangled flag from Mangled and Symbol

2019-10-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.

Neat!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68674/new/

https://reviews.llvm.org/D68674



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68674: Remove the is_mangled flag from Mangled and Symbol

2019-10-08 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

LGTM


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68674/new/

https://reviews.llvm.org/D68674



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68674: Remove the is_mangled flag from Mangled and Symbol

2019-10-08 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 223965.
aprantl added a comment.

Updated unit test.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68674/new/

https://reviews.llvm.org/D68674

Files:
  lldb/include/lldb/Core/Mangled.h
  lldb/include/lldb/Symbol/Function.h
  lldb/include/lldb/Symbol/Symbol.h
  lldb/source/API/SBType.cpp
  lldb/source/Core/Mangled.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/Symbol.cpp
  lldb/unittests/Core/MangledTest.cpp

Index: lldb/unittests/Core/MangledTest.cpp
===
--- lldb/unittests/Core/MangledTest.cpp
+++ lldb/unittests/Core/MangledTest.cpp
@@ -29,9 +29,7 @@
 
 TEST(MangledTest, ResultForValidName) {
   ConstString MangledName("_ZN1a1b1cIiiiEEvm");
-  bool IsMangled = true;
-
-  Mangled TheMangled(MangledName, IsMangled);
+  Mangled TheMangled(MangledName);
   ConstString TheDemangled =
   TheMangled.GetDemangledName(eLanguageTypeC_plus_plus);
 
@@ -41,9 +39,7 @@
 
 TEST(MangledTest, EmptyForInvalidName) {
   ConstString MangledName("_ZN1a1b1cmxktpEEvm");
-  bool IsMangled = true;
-
-  Mangled TheMangled(MangledName, IsMangled);
+  Mangled TheMangled(MangledName);
   ConstString TheDemangled =
   TheMangled.GetDemangledName(eLanguageTypeC_plus_plus);
 
Index: lldb/source/Symbol/Symbol.cpp
===
--- lldb/source/Symbol/Symbol.cpp
+++ lldb/source/Symbol/Symbol.cpp
@@ -31,9 +31,8 @@
   m_is_weak(false), m_type(eSymbolTypeInvalid), m_mangled(), m_addr_range(),
   m_flags() {}
 
-Symbol::Symbol(uint32_t symID, const char *name, bool name_is_mangled,
-   SymbolType type, bool external, bool is_debug,
-   bool is_trampoline, bool is_artificial,
+Symbol::Symbol(uint32_t symID, llvm::StringRef name, SymbolType type, bool external,
+   bool is_debug, bool is_trampoline, bool is_artificial,
const lldb::SectionSP _sp, addr_t offset, addr_t size,
bool size_is_valid, bool contains_linker_annotations,
uint32_t flags)
@@ -42,9 +41,9 @@
   m_is_debug(is_debug), m_is_external(external), m_size_is_sibling(false),
   m_size_is_synthesized(false), m_size_is_valid(size_is_valid || size > 0),
   m_demangled_is_synthesized(false),
-  m_contains_linker_annotations(contains_linker_annotations), 
+  m_contains_linker_annotations(contains_linker_annotations),
   m_is_weak(false), m_type(type),
-  m_mangled(ConstString(name), name_is_mangled),
+  m_mangled(name),
   m_addr_range(section_sp, offset, size), m_flags(flags) {}
 
 Symbol::Symbol(uint32_t symID, const Mangled , SymbolType type,
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -59,10 +59,11 @@
   return m_name.MemorySize() + m_declaration.MemorySize();
 }
 
-InlineFunctionInfo::InlineFunctionInfo(const char *name, const char *mangled,
+InlineFunctionInfo::InlineFunctionInfo(const char *name,
+   llvm::StringRef mangled,
const Declaration *decl_ptr,
const Declaration *call_decl_ptr)
-: FunctionInfo(name, decl_ptr), m_mangled(ConstString(mangled), true),
+: FunctionInfo(name, decl_ptr), m_mangled(mangled),
   m_call_decl(call_decl_ptr) {}
 
 InlineFunctionInfo::InlineFunctionInfo(ConstString name,
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1422,7 +1422,6 @@
 symtab.AddSymbol(
 Symbol(pub_symbol->getSymIndexId(),   // symID
pub_symbol->getName().c_str(), // name
-   true,  // name_is_mangled
pub_symbol->isCode() ? eSymbolTypeCode : eSymbolTypeData, // type
true,  // external
false, // is_debug
Index: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -340,8 +340,8 @@
   return;
 }
 symbols.try_emplace(
-address, /*symID*/ 0, Mangled(name, /*is_mangled*/ false),
-eSymbolTypeCode, /*is_global*/ true, /*is_debug*/ false,
+address, /*symID*/ 0, 

[Lldb-commits] [PATCH] D68674: Remove the is_mangled flag from Mangled and Symbol

2019-10-08 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: JDevlieghere, jasonmolenda, labath.
Herald added subscribers: MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.

Testing whether a name is mangled or not is extremely cheap and can be done by 
looking at the first two characters. `Mangled` knows how to do it. On the flip 
side, many call sites that currently pass in an `is_mangled` determination do 
not know how to correctly do it (for example, they leave out Swift mangling 
prefixes).

This patch removes this entry point and just forced Mangled to determine the 
mangledness of a string itself.


https://reviews.llvm.org/D68674

Files:
  lldb/include/lldb/Core/Mangled.h
  lldb/include/lldb/Symbol/Function.h
  lldb/include/lldb/Symbol/Symbol.h
  lldb/source/API/SBType.cpp
  lldb/source/Core/Mangled.cpp
  lldb/source/Expression/IRExecutionUnit.cpp
  
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Symbol/Function.cpp
  lldb/source/Symbol/Symbol.cpp

Index: lldb/source/Symbol/Symbol.cpp
===
--- lldb/source/Symbol/Symbol.cpp
+++ lldb/source/Symbol/Symbol.cpp
@@ -31,9 +31,8 @@
   m_is_weak(false), m_type(eSymbolTypeInvalid), m_mangled(), m_addr_range(),
   m_flags() {}
 
-Symbol::Symbol(uint32_t symID, const char *name, bool name_is_mangled,
-   SymbolType type, bool external, bool is_debug,
-   bool is_trampoline, bool is_artificial,
+Symbol::Symbol(uint32_t symID, llvm::StringRef name, SymbolType type, bool external,
+   bool is_debug, bool is_trampoline, bool is_artificial,
const lldb::SectionSP _sp, addr_t offset, addr_t size,
bool size_is_valid, bool contains_linker_annotations,
uint32_t flags)
@@ -42,9 +41,9 @@
   m_is_debug(is_debug), m_is_external(external), m_size_is_sibling(false),
   m_size_is_synthesized(false), m_size_is_valid(size_is_valid || size > 0),
   m_demangled_is_synthesized(false),
-  m_contains_linker_annotations(contains_linker_annotations), 
+  m_contains_linker_annotations(contains_linker_annotations),
   m_is_weak(false), m_type(type),
-  m_mangled(ConstString(name), name_is_mangled),
+  m_mangled(name),
   m_addr_range(section_sp, offset, size), m_flags(flags) {}
 
 Symbol::Symbol(uint32_t symID, const Mangled , SymbolType type,
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -59,10 +59,11 @@
   return m_name.MemorySize() + m_declaration.MemorySize();
 }
 
-InlineFunctionInfo::InlineFunctionInfo(const char *name, const char *mangled,
+InlineFunctionInfo::InlineFunctionInfo(const char *name,
+   llvm::StringRef mangled,
const Declaration *decl_ptr,
const Declaration *call_decl_ptr)
-: FunctionInfo(name, decl_ptr), m_mangled(ConstString(mangled), true),
+: FunctionInfo(name, decl_ptr), m_mangled(mangled),
   m_call_decl(call_decl_ptr) {}
 
 InlineFunctionInfo::InlineFunctionInfo(ConstString name,
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1422,7 +1422,6 @@
 symtab.AddSymbol(
 Symbol(pub_symbol->getSymIndexId(),   // symID
pub_symbol->getName().c_str(), // name
-   true,  // name_is_mangled
pub_symbol->isCode() ? eSymbolTypeCode : eSymbolTypeData, // type
true,  // external
false, // is_debug
Index: lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
===
--- lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -340,8 +340,8 @@
   return;
 }
 symbols.try_emplace(
-address, /*symID*/ 0, Mangled(name, /*is_mangled*/ false),
-eSymbolTypeCode, /*is_global*/ true, /*is_debug*/ false,
+address, /*symID*/ 0, Mangled(name), eSymbolTypeCode,
+/*is_global*/ true, /*is_debug*/ false,
 /*is_trampoline*/ false, /*is_artificial*/ false,
 AddressRange(section_sp, address - section_sp->GetFileAddress(),
  size.getValueOr(0)),
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
---