Commit Graph

8 Commits

Author SHA1 Message Date
Saleem Abdulrasool a577509f0a Demangle: remove references to allocator for default allocator
The demangler had stopped using a custom allocator but had not been updated to
remove the use of the explicit allocator passing.  This removes that as we do
not need to do anything special here anymore.  This just makes the code more
compact.  NFC.

llvm-svn: 287472
2016-11-20 00:20:27 +00:00
Saleem Abdulrasool 54ec3f9cf8 Demangle: remove unnecessary typedef for std::vector
We could create a local typedef for std::vector called Vector.  Inline the use
of std::vector rather than use the typedef.  NFC.

llvm-svn: 287471
2016-11-20 00:20:25 +00:00
Saleem Abdulrasool be1fd54f85 Demangle: replace custom typedef for std::string with std::string
We created a local typedef for `std::basic_string<char, std::char_traits<char>>`
which is just `std::string`.  Remove the local typedef and propagate the type
information through the rest of the demangler.  NFC.

llvm-svn: 287470
2016-11-20 00:20:23 +00:00
Saleem Abdulrasool 0da9050976 Demangle: use direct member initialization (NFC)
Prefer direct member initialization over the explicit out-of-line initialization
for the construction of the local type.  NFC.

llvm-svn: 287469
2016-11-20 00:20:20 +00:00
Saleem Abdulrasool d6da74f22b Demangle: only demangle mangled symbols
Only attempt to demangle symbols which have the itanium C++ prefix of `_Z`.
This ensures that we do not treat any symbol name as a managled named.  We would
previously treat a C function `f` as a mangled name and decode that to `float`
incorrectly.

While it is easy to add tests for this, Mehdi recommended against introducing
tests for the demangler as libc++abi should cover the testing.

llvm-svn: 286795
2016-11-14 04:54:47 +00:00
Rafael Espindola d5aa733769 Avoid using alignas and constexpr.
This requires removing the custom allocator, since Demangle cannot
depend on Support and so cannot use Compiler.h.

llvm-svn: 280750
2016-09-06 20:36:24 +00:00
Reid Kleckner b2881f1fbe Fix ItaniumDemangle.cpp build with MSVC 2013
llvm-svn: 280740
2016-09-06 19:39:56 +00:00
Rafael Espindola b940b66c60 Add an c++ itanium demangler to llvm.
This adds a copy of the demangler in libcxxabi.

The code also has no dependencies on anything else in LLVM. To enforce
that I added it as another library. That way a BUILD_SHARED_LIBS will
fail if anyone adds an use of StringRef for example.

The no llvm dependency combined with the fact that this has to build
on linux, OS X and Windows required a few changes to the code. In
particular:

    No constexpr.
    No alignas

On OS X at least this library has only one global symbol:
__ZN4llvm16itanium_demangleEPKcPcPmPi

My current plan is:

    Commit something like this
    Change lld to use it
    Change lldb to use it as the fallback

    Add a few #ifdefs so that exactly the same file can be used in
    libcxxabi to export abi::__cxa_demangle.

Once the fast demangler in lldb can handle any names this
implementation can be replaced with it and we will have the one true
demangler.

llvm-svn: 280732
2016-09-06 19:16:48 +00:00