diff options
| author | Zachary Turner <zturner@google.com> | 2016-03-28 22:53:41 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2016-03-28 22:53:41 +0000 |
| commit | d133f6acf14ab84e364baa55ebe3aafecd0451d0 (patch) | |
| tree | 3b12690da0ab37bcfa209584525b86049fe28064 /lldb/source/Plugins/ExpressionParser | |
| parent | ecabac6244f67c477ae2e8f71c41bb12d35e42be (diff) | |
| download | bcm5719-llvm-d133f6acf14ab84e364baa55ebe3aafecd0451d0.tar.gz bcm5719-llvm-d133f6acf14ab84e364baa55ebe3aafecd0451d0.zip | |
Move some functions from DWARFASTParserClang to ClangASTImporter.
This allows these functions to be re-used by a forthcoming
PDBASTParser. The functions in question are CanCompleteType,
CompleteType, and CanImport. Conceptually, these functions belong
on ClangASTImporter anyway, and previously they were just ping
ponging around through a few levels of indirection to end up there
as well, so this patch actually makes the code somewhat simpler.
A few methods were moved to a new file called ClangUtil, so that
they can be shared between ClangASTImporter and ClangASTContext
without creating a circular dependency between those two cpp
files.
Differential Revision: http://reviews.llvm.org/D18381
llvm-svn: 264685
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser')
3 files changed, 17 insertions, 22 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp index 976310610f5..0b819948115 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp @@ -11,6 +11,7 @@ #include "lldb/Core/Log.h" #include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompilerType.h" #include "llvm/Support/raw_ostream.h" @@ -83,7 +84,7 @@ ASTDumper::ASTDumper (lldb::opaque_compiler_type_t type) ASTDumper::ASTDumper (const CompilerType &compiler_type) { - m_dump = ClangASTContext::GetQualType(compiler_type).getAsString(); + m_dump = ClangUtil::GetQualType(compiler_type).getAsString(); } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index 7d8cedf6845..7a3b16e0b31 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -12,12 +12,11 @@ #include "ASTDumper.h" #include "ClangModulesDeclVendor.h" -#include "clang/AST/ASTContext.h" -#include "clang/AST/RecordLayout.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" #include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompilerDeclContext.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SymbolFile.h" @@ -25,6 +24,8 @@ #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Target.h" +#include "clang/AST/ASTContext.h" +#include "clang/AST/RecordLayout.h" #include <vector> @@ -277,7 +278,7 @@ ClangASTSource::CompleteType (TagDecl *tag_decl) if (!clang_type) continue; - const TagType *tag_type = ClangASTContext::GetQualType(clang_type)->getAs<TagType>(); + const TagType *tag_type = ClangUtil::GetQualType(clang_type)->getAs<TagType>(); if (!tag_type) continue; @@ -317,7 +318,7 @@ ClangASTSource::CompleteType (TagDecl *tag_decl) if (!clang_type) continue; - const TagType *tag_type = ClangASTContext::GetQualType(clang_type)->getAs<TagType>(); + const TagType *tag_type = ClangUtil::GetQualType(clang_type)->getAs<TagType>(); if (!tag_type) continue; @@ -1905,7 +1906,8 @@ ClangASTSource::GuardedCopyType (const CompilerType &src_type) SetImportInProgress(true); - QualType copied_qual_type = m_ast_importer_sp->CopyType (m_ast_context, src_ast->getASTContext(), ClangASTContext::GetQualType(src_type)); + QualType copied_qual_type = + m_ast_importer_sp->CopyType(m_ast_context, src_ast->getASTContext(), ClangUtil::GetQualType(src_type)); SetImportInProgress(false); @@ -1933,14 +1935,8 @@ NameSearchContext::AddVarDecl(const CompilerType &type) clang::ASTContext *ast = lldb_ast->getASTContext(); - clang::NamedDecl *Decl = VarDecl::Create(*ast, - const_cast<DeclContext*>(m_decl_context), - SourceLocation(), - SourceLocation(), - ii, - ClangASTContext::GetQualType(type), - 0, - SC_Static); + clang::NamedDecl *Decl = VarDecl::Create(*ast, const_cast<DeclContext *>(m_decl_context), SourceLocation(), + SourceLocation(), ii, ClangUtil::GetQualType(type), 0, SC_Static); m_decls.push_back(Decl); return Decl; @@ -1963,7 +1959,7 @@ NameSearchContext::AddFunDecl (const CompilerType &type, bool extern_c) m_function_types.insert(type); - QualType qual_type (ClangASTContext::GetQualType(type)); + QualType qual_type(ClangUtil::GetQualType(type)); clang::ASTContext *ast = lldb_ast->getASTContext(); @@ -2059,7 +2055,7 @@ NameSearchContext::AddTypeDecl(const CompilerType &clang_type) { if (clang_type) { - QualType qual_type = ClangASTContext::GetQualType(clang_type); + QualType qual_type = ClangUtil::GetQualType(clang_type); if (const TypedefType *typedef_type = llvm::dyn_cast<TypedefType>(qual_type)) { diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 8b22d461595..62aa5b7fb88 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -25,16 +25,17 @@ #include "clang/AST/ASTContext.h" -#include "lldb/Core/dwarf.h" #include "lldb/Core/ConstString.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/Log.h" #include "lldb/Core/Scalar.h" #include "lldb/Core/StreamString.h" +#include "lldb/Core/dwarf.h" #include "lldb/Expression/IRExecutionUnit.h" #include "lldb/Expression/IRInterpreter.h" #include "lldb/Host/Endian.h" #include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/ClangUtil.h" #include "lldb/Symbol/CompilerType.h" #include <map> @@ -1235,11 +1236,8 @@ IRForTarget::MaybeHandleVariable (Value *llvm_value_ptr) if (log) { log->Printf("Type of \"%s\" is [clang \"%s\", llvm \"%s\"] [size %" PRIu64 ", align %" PRIu64 "]", - name.c_str(), - lldb_private::ClangASTContext::GetQualType(compiler_type).getAsString().c_str(), - PrintType(value_type).c_str(), - value_size, - value_alignment); + name.c_str(), lldb_private::ClangUtil::GetQualType(compiler_type).getAsString().c_str(), + PrintType(value_type).c_str(), value_size, value_alignment); } |

