aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Symbol/TypeSystem.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Symbol/TypeSystem.h')
-rw-r--r--include/lldb/Symbol/TypeSystem.h51
1 files changed, 34 insertions, 17 deletions
diff --git a/include/lldb/Symbol/TypeSystem.h b/include/lldb/Symbol/TypeSystem.h
index 4bef2a4446eb..07295c244a5d 100644
--- a/include/lldb/Symbol/TypeSystem.h
+++ b/include/lldb/Symbol/TypeSystem.h
@@ -14,8 +14,11 @@
#include <mutex>
#include <string>
+#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APSInt.h"
+#include "llvm/ADT/SmallBitVector.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Error.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Expression/Expression.h"
@@ -29,7 +32,24 @@ class PDBASTParser;
namespace lldb_private {
-// Interface for representing the Type Systems in different languages.
+/// A SmallBitVector that represents a set of source languages (\p
+/// lldb::LanguageType). Each lldb::LanguageType is represented by
+/// the bit with the position of its enumerator. The largest
+/// LanguageType is < 64, so this is space-efficient and on 64-bit
+/// architectures a LanguageSet can be completely stack-allocated.
+struct LanguageSet {
+ llvm::SmallBitVector bitvector;
+ LanguageSet();
+
+ /// If the set contains a single language only, return it.
+ llvm::Optional<lldb::LanguageType> GetSingularLanguage();
+ void Insert(lldb::LanguageType language);
+ bool Empty() const;
+ size_t Size() const;
+ bool operator[](unsigned i) const;
+};
+
+/// Interface for representing the Type Systems in different languages.
class TypeSystem : public PluginInterface {
public:
// Intrusive type system that allows us to use llvm casting.
@@ -107,6 +127,8 @@ public:
virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
size_t arg_idx);
+ virtual CompilerType GetTypeForDecl(void *opaque_decl) = 0;
+
// CompilerDeclContext functions
virtual std::vector<CompilerDecl>
@@ -255,6 +277,8 @@ public:
// Exploring the type
+ virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 0;
+
virtual llvm::Optional<uint64_t>
GetBitSize(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) = 0;
@@ -375,12 +399,6 @@ public:
lldb::offset_t data_offset,
size_t data_byte_size) = 0;
- // Converts "s" to a floating point value and place resulting floating point
- // bytes in the "dst" buffer.
- virtual size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
- const char *s, uint8_t *dst,
- size_t dst_size) = 0;
-
// TODO: Determine if these methods should move to ClangASTContext.
virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
@@ -391,7 +409,9 @@ public:
virtual bool IsCStringType(lldb::opaque_compiler_type_t type,
uint32_t &length) = 0;
- virtual size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) = 0;
+ virtual llvm::Optional<size_t>
+ GetTypeBitAlign(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) = 0;
virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) = 0;
@@ -491,18 +511,15 @@ public:
// callback to keep iterating, false to stop iterating.
void ForEach(std::function<bool(TypeSystem *)> const &callback);
- TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
- Module *module, bool can_create);
+ llvm::Expected<TypeSystem &>
+ GetTypeSystemForLanguage(lldb::LanguageType language, Module *module,
+ bool can_create);
- TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
- Target *target, bool can_create);
+ llvm::Expected<TypeSystem &>
+ GetTypeSystemForLanguage(lldb::LanguageType language, Target *target,
+ bool can_create);
protected:
- // This function does not take the map mutex, and should only be called from
- // functions that do take the mutex.
- void AddToMap(lldb::LanguageType language,
- lldb::TypeSystemSP const &type_system_sp);
-
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> collection;
mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
///multi-threaded environments.