summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/ClangASTContext.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-12-29 21:28:31 +0100
committerRaphael Isemann <teemperor@gmail.com>2019-12-29 21:54:07 +0100
commit6991d5728f12594cabfd8d8d570361efb07f1d5a (patch)
tree43b3375227ec5f1b80d02128445f982de2dd4509 /lldb/source/Symbol/ClangASTContext.cpp
parentf7d9584c56d9d8e6092cc37d5e859db47b1a40d7 (diff)
downloadbcm5719-llvm-6991d5728f12594cabfd8d8d570361efb07f1d5a.tar.gz
bcm5719-llvm-6991d5728f12594cabfd8d8d570361efb07f1d5a.zip
[lldb][NFC] Make integer types functions in ClangASTContext not static
These functions need a ClangASTContext instance that we would otherwise recalculate by calling GetASTContext (which is no longer necessary with this patch).
Diffstat (limited to 'lldb/source/Symbol/ClangASTContext.cpp')
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp77
1 files changed, 32 insertions, 45 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 0664db37a04..e9727399d7e 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -2094,66 +2094,53 @@ ClangASTContext::CreateEnumerationType(const char *name, DeclContext *decl_ctx,
return CompilerType();
}
-CompilerType ClangASTContext::GetIntTypeFromBitSize(clang::ASTContext *ast,
- size_t bit_size,
+CompilerType ClangASTContext::GetIntTypeFromBitSize(size_t bit_size,
bool is_signed) {
- if (ast) {
- auto *clang_ast_context = ClangASTContext::GetASTContext(ast);
- if (is_signed) {
- if (bit_size == ast->getTypeSize(ast->SignedCharTy))
- return CompilerType(clang_ast_context,
- ast->SignedCharTy.getAsOpaquePtr());
+ clang::ASTContext &ast = getASTContext();
- if (bit_size == ast->getTypeSize(ast->ShortTy))
- return CompilerType(clang_ast_context, ast->ShortTy.getAsOpaquePtr());
+ if (is_signed) {
+ if (bit_size == ast.getTypeSize(ast.SignedCharTy))
+ return CompilerType(this, ast.SignedCharTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->IntTy))
- return CompilerType(clang_ast_context, ast->IntTy.getAsOpaquePtr());
+ if (bit_size == ast.getTypeSize(ast.ShortTy))
+ return CompilerType(this, ast.ShortTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->LongTy))
- return CompilerType(clang_ast_context, ast->LongTy.getAsOpaquePtr());
+ if (bit_size == ast.getTypeSize(ast.IntTy))
+ return CompilerType(this, ast.IntTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->LongLongTy))
- return CompilerType(clang_ast_context,
- ast->LongLongTy.getAsOpaquePtr());
+ if (bit_size == ast.getTypeSize(ast.LongTy))
+ return CompilerType(this, ast.LongTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->Int128Ty))
- return CompilerType(clang_ast_context, ast->Int128Ty.getAsOpaquePtr());
- } else {
- if (bit_size == ast->getTypeSize(ast->UnsignedCharTy))
- return CompilerType(clang_ast_context,
- ast->UnsignedCharTy.getAsOpaquePtr());
+ if (bit_size == ast.getTypeSize(ast.LongLongTy))
+ return CompilerType(this, ast.LongLongTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->UnsignedShortTy))
- return CompilerType(clang_ast_context,
- ast->UnsignedShortTy.getAsOpaquePtr());
+ if (bit_size == ast.getTypeSize(ast.Int128Ty))
+ return CompilerType(this, ast.Int128Ty.getAsOpaquePtr());
+ } else {
+ if (bit_size == ast.getTypeSize(ast.UnsignedCharTy))
+ return CompilerType(this, ast.UnsignedCharTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->UnsignedIntTy))
- return CompilerType(clang_ast_context,
- ast->UnsignedIntTy.getAsOpaquePtr());
+ if (bit_size == ast.getTypeSize(ast.UnsignedShortTy))
+ return CompilerType(this, ast.UnsignedShortTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->UnsignedLongTy))
- return CompilerType(clang_ast_context,
- ast->UnsignedLongTy.getAsOpaquePtr());
+ if (bit_size == ast.getTypeSize(ast.UnsignedIntTy))
+ return CompilerType(this, ast.UnsignedIntTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->UnsignedLongLongTy))
- return CompilerType(clang_ast_context,
- ast->UnsignedLongLongTy.getAsOpaquePtr());
+ if (bit_size == ast.getTypeSize(ast.UnsignedLongTy))
+ return CompilerType(this, ast.UnsignedLongTy.getAsOpaquePtr());
- if (bit_size == ast->getTypeSize(ast->UnsignedInt128Ty))
- return CompilerType(clang_ast_context,
- ast->UnsignedInt128Ty.getAsOpaquePtr());
- }
+ if (bit_size == ast.getTypeSize(ast.UnsignedLongLongTy))
+ return CompilerType(this, ast.UnsignedLongLongTy.getAsOpaquePtr());
+
+ if (bit_size == ast.getTypeSize(ast.UnsignedInt128Ty))
+ return CompilerType(this, ast.UnsignedInt128Ty.getAsOpaquePtr());
}
return CompilerType();
}
-CompilerType ClangASTContext::GetPointerSizedIntType(clang::ASTContext *ast,
- bool is_signed) {
- if (ast)
- return GetIntTypeFromBitSize(ast, ast->getTypeSize(ast->VoidPtrTy),
- is_signed);
- return CompilerType();
+CompilerType ClangASTContext::GetPointerSizedIntType(bool is_signed) {
+ return GetIntTypeFromBitSize(
+ getASTContext().getTypeSize(getASTContext().VoidPtrTy), is_signed);
}
void ClangASTContext::DumpDeclContextHiearchy(clang::DeclContext *decl_ctx) {
OpenPOWER on IntegriCloud