Files
clang-p2996/lldb/source/Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h
Aleksandr Urakov c1e530ee92 [PDB] Introduce MSVCUndecoratedNameParser
This patch introduces the simple MSVCUndecoratedNameParser. It is needed for
parsing names of PDB symbols corresponding to template instantiations. For
example, for the name `operator<<A>'::`2'::B::operator> we can't just split the
name with :: (as it is implemented for now) to retrieve its scopes. This parser
processes such names in a more correct way.

Differential Revision: https://reviews.llvm.org/D52461

llvm-svn: 346213
2018-11-06 08:02:55 +00:00

52 lines
1.5 KiB
C++

//===-- MSVCUndecoratedNameParser.h -----------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_MSVCUndecoratedNameParser_h_
#define liblldb_MSVCUndecoratedNameParser_h_
#include <vector>
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
class MSVCUndecoratedNameSpecifier {
public:
MSVCUndecoratedNameSpecifier(llvm::StringRef full_name,
llvm::StringRef base_name)
: m_full_name(full_name), m_base_name(base_name) {}
llvm::StringRef GetFullName() const { return m_full_name; }
llvm::StringRef GetBaseName() const { return m_base_name; }
private:
llvm::StringRef m_full_name;
llvm::StringRef m_base_name;
};
class MSVCUndecoratedNameParser {
public:
explicit MSVCUndecoratedNameParser(llvm::StringRef name);
llvm::ArrayRef<MSVCUndecoratedNameSpecifier> GetSpecifiers() const {
return m_specifiers;
}
static bool IsMSVCUndecoratedName(llvm::StringRef name);
static bool ExtractContextAndIdentifier(llvm::StringRef name,
llvm::StringRef &context,
llvm::StringRef &identifier);
static llvm::StringRef DropScope(llvm::StringRef name);
private:
std::vector<MSVCUndecoratedNameSpecifier> m_specifiers;
};
#endif