| 1 | //===-- MSVCUndecoratedNameParser.h -----------------------------*- C++ -*-===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_MSVCUNDECORATEDNAMEPARSER_H |
| 10 | #define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_MSVCUNDECORATEDNAMEPARSER_H |
| 11 | |
| 12 | #include <vector> |
| 13 | |
| 14 | #include "llvm/ADT/ArrayRef.h" |
| 15 | #include "llvm/ADT/StringRef.h" |
| 16 | |
| 17 | class MSVCUndecoratedNameSpecifier { |
| 18 | public: |
| 19 | MSVCUndecoratedNameSpecifier(llvm::StringRef full_name, |
| 20 | llvm::StringRef base_name) |
| 21 | : m_full_name(full_name), m_base_name(base_name) {} |
| 22 | |
| 23 | llvm::StringRef GetFullName() const { return m_full_name; } |
| 24 | llvm::StringRef GetBaseName() const { return m_base_name; } |
| 25 | |
| 26 | private: |
| 27 | llvm::StringRef m_full_name; |
| 28 | llvm::StringRef m_base_name; |
| 29 | }; |
| 30 | |
| 31 | class MSVCUndecoratedNameParser { |
| 32 | public: |
| 33 | explicit MSVCUndecoratedNameParser(llvm::StringRef name); |
| 34 | |
| 35 | llvm::ArrayRef<MSVCUndecoratedNameSpecifier> GetSpecifiers() const { |
| 36 | return m_specifiers; |
| 37 | } |
| 38 | |
| 39 | static bool IsMSVCUndecoratedName(llvm::StringRef name); |
| 40 | static bool ExtractContextAndIdentifier(llvm::StringRef name, |
| 41 | llvm::StringRef &context, |
| 42 | llvm::StringRef &identifier); |
| 43 | |
| 44 | static llvm::StringRef DropScope(llvm::StringRef name); |
| 45 | |
| 46 | private: |
| 47 | std::vector<MSVCUndecoratedNameSpecifier> m_specifiers; |
| 48 | }; |
| 49 | |
| 50 | #endif |
| 51 |
