| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This class was a bit overengineered, and was triggering some PVS warnings.
Instead, put strings into a NameType and let clients unconditionally treat it
as a Node.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements demangling support for the mangling extensions specified
in https://github.com/itanium-cxx-abi/cxx-abi/pull/85, much of which is
implemented in Clang r359967 and r371004.
Specifically, this provides demangling for:
* <template-param-decl> in <lambda-sig>
* <template-param> with non-zero level
* lambda-expression literals (not emitted by Clang yet)
* nullptr literals
* string literals
(The final two seem unrelated, but handling them was necessary in order
to disambiguate between lambda expressions and the other forms of
literal for which we have a type but no value.)
When demangling a <lambda-sig>, we form template parameters with no
corresponding argument, so we cannot substitute in the argument in the
demangling. Instead we invent synthetic names for the template
parameters (eg, '[]<typename $T>($T *x)').
llvm-svn: 371273
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.
We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.
Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.
llvm-svn: 351648
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this patch, the copies of the files ItaniumDemangle.h,
StringView.h, and Utility.h are kept byte-for-byte in sync between
libcxxabi and llvm. All differences (namespaces, fallthrough, and
unreachable macros) are defined in each copies' DemanglerConfig.h.
This patch also adds a script to copy changes from libcxxabi
(cp-to-llvm.sh), and a README.txt explaining the situation.
Differential revision: https://reviews.llvm.org/D53538
llvm-svn: 351474
|
|
|
|
| |
llvm-svn: 346607
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This uses CRTP (for performance reasons) to allow a user the override
demangler functions to implement custom parsing logic. The motivation
for this is LLDB, which needs to occasionaly modify the mangled names.
One such instance is already implemented via the TypeCallback member,
but this is very specific functionality which does not help with any
other use case. Currently we have a use case for modifying the
constructor flavours, which would require adding another callback. This
approach does not scale.
With CRTP, the user (LLDB) can override any function it needs without
any special support from the demangler library. After LLDB is ported to
use this instead of the TypeCallback mechanism, the callback can be
removed.
More context can be found in D50599.
Reviewers: erik.pilkington, rsmith
Subscribers: christof, ldionne, llvm-commits, libcxx-commits
Differential Revision: https://reviews.llvm.org/D52992
llvm-svn: 344607
|
|
|
|
| |
llvm-svn: 344564
|
|
|
|
|
|
| |
Differential Revision: https://reviews.llvm.org/D52104
llvm-svn: 342331
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move Itanium demangler implementation into a header file and add visitation support.
Summary:
This transforms the Itanium demangler into a generic reusable library that can
be used to build, traverse, and transform Itanium mangled name trees.
This is in preparation for adding a canonicalizing demangler, which
cannot live in the Demangle library for layering reasons. In order to
keep the diffs simpler, this patch moves more code to the new header
than is strictly necessary: in particular, all of the printLeft /
printRight implementations can be moved to the implementation file.
(And indeed we could make them non-virtual now if we wished, and remove
the vptr from Node.)
All nodes are now included in the Kind enumeration, rather than omitting
some of the Expr nodes, and the three different floating-point literal
node types now have distinct Kind values.
As a proof of concept for the visitation / matching mechanism, this
patch implements a Node dumping facility on top of it, replacing the
prior mechanism that produced the pretty-printed output rather than a
tree dump. Sample dump output:
FunctionEncoding(
NameType("int"),
NameWithTemplateArgs(
NestedName(
NameWithTemplateArgs(
NameType("A"),
TemplateArgs(
{NameType("B")})),
NameType("f")),
TemplateArgs(
{NameType("int")})),
{},
<null>,
QualConst, FunctionRefQual::FrefQualLValue)
As a next step, it would make sense to move the LLVM high-level interface to
the demangler (the itaniumDemangler function and ItaniumPartialDemangler class)
into the Support library, and implement them in terms of the Demangle library.
This would allow the libc++abi demangler implementation to be an identical copy
of the llvm Demangle library, and would allow the LLVM implementation to reuse
LLVM components such as llvm::BumpPtrAllocator, but we'll need to decide how to
coordinate that with the MS ABI demangler, so I'm not doing that in this patch.
No functionality change intended other than the behavior of dump().
Reviewers: erik.pilkington, zturner, chandlerc, dlj
Subscribers: aheejin, llvm-commits
Differential Revision: https://reviews.llvm.org/D50930
llvm-svn: 340207
|
|
|
|
|
|
| |
(This is a port of llvm r339944 to libcxxabi.)
llvm-svn: 339952
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function calls a callback whenever a <type> is parsed.
This is necessary to implement FindAlternateFunctionManglings in LLDB, which
uses a similar hack in FastDemangle. Once that function has been updated to use
this version, FastDemangle can finally be removed.
Differential revision: https://reviews.llvm.org/D50586
llvm-svn: 339580
|
|
|
|
|
|
| |
rdar://32378759
llvm-svn: 338747
|
|
|
|
|
|
|
|
| |
Stack overflow on invalid. While collapsing references, we were skipping over a
cycle check in ForwardTemplateReference leading to a stack overflow. This commit
fixes the problem by duplicating the cycle check in ReferenceType.
llvm-svn: 338190
|
|
|
|
|
|
| |
llvm.org/PR38323
llvm-svn: 338138
|
|
|
|
|
|
|
|
|
|
| |
We really should set *status to memory_alloc_failure, but we need to refactor
the demangler a bit to properly propagate the failure up the stack. Until then,
its better to explicitly terminate then rely on a null dereference crash.
rdar://31240372
llvm-svn: 337759
|
|
|
|
|
|
|
|
|
|
|
| |
ItaniumDemangle had a small NFC refactor to make some of its
code reusable by the newly added Microsoft demangler. To keep
the libcxxabi demangler as close as possible to the master copy
this refactor is being merged over.
Differential Revision: https://reviews.llvm.org/D49575
llvm-svn: 337582
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The alignment specified by a constant for the field
`BumpPointerAllocator::InitialBuffer` exceeded the alignment
guaranteed by `malloc` and `new` on Windows. This change set
the alignment value to that of `long double`, which is defined
by the used platform.
It fixes https://bugs.llvm.org/show_bug.cgi?id=37944.
Differential Revision: https://reviews.llvm.org/D48889
llvm-svn: 336312
|
|
|
|
|
|
|
|
|
|
|
| |
other on unqualified max_align_t.
I'll take another stab at this tomorrow. Any ideas for fixing this would be appreciated!
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/23071/steps/build_Lld/logs/stdio
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/11185/steps/build-stage1-compiler/logs/stdio
llvm-svn: 336162
|
|
|
|
| |
llvm-svn: 336159
|
|
|
|
|
|
| |
This should fix llvm.org/PR37944
llvm-svn: 336157
|
|
|
|
|
|
|
| |
I'm committing this to libcxxabi too so that the two demanglers remain as
simular as possible.
llvm-svn: 329950
|
|
|
|
| |
llvm-svn: 329601
|
|
|
|
| |
llvm-svn: 329600
|
|
|
|
| |
llvm-svn: 329599
|
|
|
|
| |
llvm-svn: 328507
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Strictly in a conversion operator's type, a <template-param> refers to a
<template-arg> that is further ahead in the mangled name. Instead of
doing a second parse to resolve these, introduce a
ForwardTemplateReference Node and back-patch the referenced
<template-arg> when we're in the right context.
This is also a correctness fix, previously we would only do a second
parse if the <template-param> was out of bounds in the current set of
<template-args>. This lead to misdemangles (gasp!) when the conversion
operator was a member of a templated struct, for instance.
llvm-svn: 328464
|
|
|
|
|
|
|
|
| |
Rather than eagerly propagating up parameter pack sizes in Node ctors,
find the parameter pack size during printing. This is being done to
support back-patching forward referencing <template-param>s.
llvm-svn: 328463
|
|
|
|
|
|
| |
Fixes PR33569.
llvm-svn: 328462
|
|
|
|
|
|
|
| |
These <template-param>s refer to "artifical" <template-arg>s that don't appear
in the mangled name, so we just print them as "auto".
llvm-svn: 327690
|
|
|
|
|
|
| |
Thanks to Richard Smith for the post-commit review!
llvm-svn: 327228
|
|
|
|
| |
llvm-svn: 327227
|
|
|
|
| |
llvm-svn: 327226
|
|
|
|
|
|
| |
Thanks to Nico Weber for pointing this out!
llvm-svn: 326871
|
|
|
|
| |
llvm-svn: 326797
|
|
|
|
| |
llvm-svn: 326796
|
|
|
|
| |
llvm-svn: 326717
|
|
|
|
| |
llvm-svn: 325093
|
|
|
|
| |
llvm-svn: 325092
|
|
|
|
|
|
| |
Fixes PR33223.
llvm-svn: 325023
|
|
|
|
| |
llvm-svn: 325022
|
|
|
|
| |
llvm-svn: 324970
|
|
|
|
| |
llvm-svn: 324969
|
|
|
|
|
|
|
|
| |
substitution table.
Previously, both <extended-qualifier>s and <CV-qualifiers> got their own entries.
llvm-svn: 324968
|
|
|
|
|
|
| |
Differential revision: https://reviews.llvm.org/D41889
llvm-svn: 324282
|
|
|
|
|
|
| |
This should fix some bugs found by oss-fuzz.
llvm-svn: 324203
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit cleans up the expression parser, using a new style:
- parse* functions now return Node pointers.
- The mangled name is now held in Db and accessed with look() and consume()
- LLVM coding style
This style is meant to avoid the 2 most common types of bugs in the
old demanger, namely misusing the Names stack (ie, calling back() on
empty) and going out of bounds on the mangled name. I also think it
makes the demangler a lot cleaner.
Differential revision: https://reviews.llvm.org/D41887
llvm-svn: 324111
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit changes how variadic templates are represented in the
demangler, in order to fix some longstanding bugs. Now instead of
expanding variadic templates during parsing, the expansion is done
during printing by reusing the unexpanded AST. This allows the
demangler to handle cases where multiple packs contribute to a single
production, and correctly handle "Dp" and "sp" productions, which
corrispond to pack expansions in type and expression contexts.
Differential revision: https://reviews.llvm.org/D41885
llvm-svn: 323906
|
|
|
|
|
|
| |
Differential revision: https://reviews.llvm.org/D40279
llvm-svn: 318874
|
|
|
|
| |
llvm-svn: 318765
|
|
|
|
| |
llvm-svn: 310546
|