//===------------------------- ItaniumDemangle.h ----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Generic itanium demangler library. This file has two byte-per-byte identical
// copies in the source tree, one in libcxxabi, and the other in llvm.
//
//===----------------------------------------------------------------------===//
#ifndef DEMANGLE_ITANIUMDEMANGLE_H
#define DEMANGLE_ITANIUMDEMANGLE_H
// FIXME: (possibly) incomplete list of features that clang mangles that this
// file does not yet support:
// - C++ modules TS
#include "DemangleConfig.h"
#include "StringView.h"
#include "Utility.h"
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <utility>
#define FOR_EACH_NODE_KIND(X) \
X(NodeArrayNode) \
X(DotSuffix) \
X(VendorExtQualType) \
X(QualType) \
X(ConversionOperatorType) \
X(PostfixQualifiedType) \
X(ElaboratedTypeSpefType) \
X(NameType) \
X(AbiTagAttr) \
X(EnableIfAttr) \
X(ObjCProtoName) \
X(PointerType) \
X(ReferenceType) \
X(PointerToMemberType) \
X(ArrayType) \
X(FunctionType) \
X(NoexceptSpec) \
X(DynamicExceptionSpec) \
X(FunctionEncoding) \
X(LiteralOperator) \
X(SpecialName) \
X(CtorVtableSpecialName) \
X(QualifiedName) \
X(NestedName) \
X(LocalName) \
X(VectorType) \
X(PixelVectorType) \
X(BinaryFPType) \
X(SyntheticTemplateParamName) \
X(TypeTemplateParamDecl) \
X(NonTypeTemplateParamDecl) \
X(TemplateTemplateParamDecl) \
X(TemplateParamPackDecl) \
X(ParameterPack) \
X(TemplateArgumentPack) \
X(ParameterPackExpansion) \
X(TemplateArgs) \
X(ForwardTemplateReference) \
X(NameWithTemplateArgs) \
X(GlobalQualifiedName) \
X(StdQualifiedName) \
X(ExpandedSpecialSubstitution) \
X(SpecialSubstitution) \
X(CtorDtorName) \
X(DtorName) \
X(UnnamedTypeName) \
X(ClosureTypeName) \
X(StructuredBindingName) \
X(BinaryExpr) \
X(ArraySubscriptExpr) \
X(PostfixExpr) \
X(ConditionalExpr) \
X(MemberExpr) \
X(SubobjectExpr) \
X(EnclosingExpr) \
X(CastExpr) \
X(SizeofParamPackExpr) \
X(CallExpr) \
X(NewExpr) \
X(DeleteExpr) \
X(PrefixExpr) \
X(FunctionParam) \
X(ConversionExpr) \
X(PointerToMemberConversionExpr) \
X(InitListExpr) \
X(FoldExpr) \
X(ThrowExpr) \
X(BoolExpr) \
X(StringLiteral) \
X(LambdaExpr) \
X(EnumLiteral) \
X(IntegerLiteral) \
X(FloatLiteral) \
X(DoubleLiteral) \
X(LongDoubleLiteral) \
X(BracedExpr) \
X(BracedRangeExpr)
DEMANGLE_NAMESPACE_BEGIN
template <class T, size_t N> class PODSmallVector {
static_assert(std::is_pod<T>::value,
"T is required to be a plain old data type");
T *First = nullptr;
T *Last = nullptr;
T *Cap = nullptr;
T Inline[N] = {0};
bool isInline() const { return First == Inline; }
void clearInline() {
First = Inline;
Last = Inline;
Cap = Inline + N;
}
void reserve(size_t NewCap) {
size_t S = size();
if (isInline()) {
auto *Tmp = static_cast<T *>(std::malloc(NewCap * sizeof(T)));
if (Tmp == nullptr)
std::terminate();
std::copy(First, Last, Tmp);
First = Tmp;
} else {
First = static_cast<T *>(std::realloc(First, NewCap * sizeof(T)));
if (First == nullptr)
std::terminate();
}
Last = First + S;
Cap = First + NewCap;
}
public:
PODSmallVector() : First(Inline), Last(First), Cap(Inline + N) {}
PODSmallVector(const PODSmallVector &) = delete;
PODSmallVector &operator=(const PODSmallVector &) = delete;
PODSmallVector(PODSmallVector &&Other) : PODSmallVector() {
if (Other.isInline()) {
std::copy(Other.begin(), Other.end(), First);
Last = First + Other.size();
Other.clear();
return;
}
First = Other.First;
Last = Other.Last;
Cap = Other.Cap;
Other.clearInline();
}
PODSmallVector &operator=(PODSmallVector &&Other) {
if (Other.isInline()) {
if (!isInline()) {
std::free(First);
clearInline();
}
std::copy(Other.begin(), Other.end(), First);
Last = First + Other.size();
Other.clear();
return *this;
}
if (isInline()) {
First = Other.First;
Last = Other.Last;
Cap = Other.Cap;
Other.clearInline();
return *this;
}
std::swap(First, Other.First);
std::swap(Last, Other.Last);
std::swap(Cap, Other.Cap);
Other.clear();
return *this;
}
// NOLINTNEXTLINE(readability-identifier-naming)
void push_back(const T &Elem) {
if (Last == Cap)
reserve(size() * 2);
*Last++ = Elem;
}
// NOLINTNEXTLINE(readability-identifier-naming)
void pop_back() {
assert(Last != First && "Popping empty vector!");
--Last;
}
void dropBack(size_t Index) {
assert(Index <= size() && "dropBack() can't expand!");
Last = First + Index;
}
T *begin() { return First; }
T *end() { return Last; }
bool empty() const { return First == Last; }
size_t size() const { return static_cast<size_t>(Last - First); }
T &back() {
assert(Last != First && "Calling back() on empty vector!");
return *(Last - 1);
}
T &operator[](size_t Index) {
assert(Index < size() && "Invalid access!");
return *(begin() + Index);
}
void clear() { Last = First; }
~PODSmallVector() {
if (!isInline())
std::free(First);
}
};
// Base class of all AST nodes. The AST is built by the parser, then is
// traversed by the printLeft/Right functions to produce a demangled string.
class Node {
public:
enum Kind : unsigned char {
#define ENUMERATOR(NodeKind) K ## NodeKind,
FOR_EACH_NODE_KIND(ENUMERATOR)
#undef ENUMERATOR
};
/// Three-way bool to track a cached value. Unknown is possible if this node
/// has an unexpanded parameter pack below it that may affect this cache.
enum class Cache : unsigned char { Yes, No, Unknown, };
private:
Kind K;
// FIXME: Make these protected.
public:
/// Tracks if this node has a component on its right side, in which case we
/// need to call printRight.
Cache RHSComponentCache;
/// Track if this node is a (possibly qualified) array type. This can affect
/// how we format the output string.
Cache ArrayCache;
/// Track if this node is a (possibly qualified) function type. This can
/// affect how we format the output string.
Cache FunctionCache;
public:
Node(Kind K_, Cache RHSComponentCache_ = Cache::No,
Cache ArrayCache_ = Cache::No, Cache FunctionCache_ = Cache::No)
: K(K_), RHSComponentCache(RHSComponentCache_), ArrayCache(ArrayCache_),
FunctionCache(FunctionCache_) {}
/// Visit the most-derived object corresponding to this object.
template<typename Fn> void visit(Fn F) const;
// The following function is provided by all derived classes:
//
// Call F with arguments that, when passed to the constructor of this node,
// would construct an equivalent node.
//template<typename Fn> void match(Fn F) const;
bool hasRHSComponent(OutputStream &S) const {
if (RHSComponentCache != Cache::Unknown)
return RHSComponentCache == Cache::Yes;
return hasRHSComponentSlow(S);
}
bool hasArray(OutputStream &S) const {
if (ArrayCache != Cache::Unknown)
return ArrayCac
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
webrtc 音视频库 头文件 (2000个子文件)
ItaniumDemangle.h 173KB
syscall_map.h 105KB
signal_processing_library.h 61KB
benchmark.h 55KB
shared_ptr.h 54KB
math.h 53KB
libtest_array.h 44KB
rapid-cxx-test.h 41KB
audio_processing.h 39KB
windows_private.h 37KB
media_channel.h 37KB
fec_rate_table.h 35KB
libunwind.h 30KB
webrtc_video_engine.h 30KB
rtcstats_objects.h 28KB
stun.h 28KB
color_space_data.h 28KB
rtp_parameters.h 27KB
compare_types.h 26KB
peerconnection_quality_test_fixture.h 25KB
filesystem_test_helper.h 25KB
audio_processing_impl.h 24KB
unique_ptr.h 24KB
isac.h 23KB
core_audio_utility_win.h 23KB
test_iterators.h 22KB
fake_media_engine.h 21KB
rtc_stats.h 20KB
opus_interface.h 20KB
rtp_rtcp_interface.h 20KB
map_allocator_requirement_test_templates.h 20KB
cxa_guard_impl.h 19KB
compact_unwind_encoding.h 19KB
skia_image_filter_proto_converter.h 19KB
video_encoder.h 18KB
iterator_traits.h 18KB
forward_error_correction.h 18KB
container_test_types.h 18KB
rtcp_receiver.h 17KB
isacfix.h 17KB
neteq_impl.h 17KB
RTCPeerConnection.h 17KB
invoke_helpers.h 17KB
rtp_rtcp_defines.h 16KB
bwe_test_logging.h 16KB
allocator_traits.h 16KB
filesystem_common.h 16KB
fake_webrtc_call.h 16KB
posix_compat.h 16KB
aecm_core.h 15KB
network_emulation_manager.h 15KB
entropy_coding.h 15KB
test_allocator.h 15KB
min_allocator.h 14KB
assembler.h 14KB
controlled_allocators.h 14KB
audio_device_template.h 14KB
rtp_header_extensions.h 14KB
neteq.h 14KB
nasty_containers.h 14KB
uses_alloc_types.h 14KB
archetypes.h 14KB
webrtc_voice_engine.h 13KB
audio_device_ios.h 13KB
rtcp_sender.h 13KB
audio_device_pulse_linux.h 13KB
java_types.h 13KB
count_new.h 13KB
stream_params.h 13KB
byte_io.h 13KB
array_view.h 13KB
structs.h 13KB
audio_device_mac.h 12KB
rtp_rtcp_impl2.h 12KB
usrsctp_transport.h 12KB
media_opt_util.h 12KB
RTCAudioSession.h 12KB
test_macros.h 12KB
network_emulation_interfaces.h 12KB
video_stream_adapter.h 12KB
any_helpers.h 11KB
rtp_rtcp_impl.h 11KB
aec_state.h 11KB
videoprocessor.h 11KB
audio_encoder.h 11KB
delay_estimator_wrapper.h 11KB
stubs.h 11KB
apm_data_dumper.h 11KB
structs.h 11KB
audio_device_core_win.h 11KB
jitter_buffer.h 11KB
model.h 11KB
dwarf2.h 11KB
video_receive_stream.h 11KB
rtp_sender_video.h 11KB
dxgi_duplicator_controller.h 11KB
Config.h 10KB
video_send_stream.h 10KB
RTCConfiguration.h 10KB
Edge.h 10KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
liu1675
- 粉丝: 0
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功