[Lldb-commits] [lldb] r143253 - in /lldb/trunk: include/lldb/Expression/ClangASTSource.h include/lldb/Expression/ClangExpressionDeclMap.h source/Expression/ClangASTSource.cpp source/Expression/ClangExpressionDeclMap.cpp source/Expression/ClangExpressionParser.cpp
Sean Callanan
scallanan at apple.com
Fri Oct 28 16:38:38 PDT 2011
Author: spyffe
Date: Fri Oct 28 18:38:38 2011
New Revision: 143253
URL: http://llvm.org/viewvc/llvm-project?rev=143253&view=rev
Log:
As part of a general refactoring of ClangASTSource to
allow it to complete types on behalf of any AST context
(including the "scratch" AST context associated with
the target), I scrapped its role as intermediary between
the Clang parser and ClangExpressionDeclMap, and instead
made ClangExpressionDeclMap inherit from ClangASTSource.
After this, I will migrate the functions that complete
types and perform namespace lookups from
ClangExpressionDeclMap to ClangASTSource. Ultimately
ClangExpressionDeclMap's only responsiblity will be to
look up variables and ensure that they are materialized
and dematerialized correctly.
Modified:
lldb/trunk/include/lldb/Expression/ClangASTSource.h
lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Expression/ClangExpressionParser.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=143253&r1=143252&r2=143253&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Fri Oct 28 18:38:38 2011
@@ -39,17 +39,14 @@
///
/// Initializes class variabes.
///
- /// @param[in] context
- /// A reference to the AST context provided by the parser.
- ///
/// @param[in] declMap
/// A reference to the LLDB object that handles entity lookup.
//------------------------------------------------------------------
- ClangASTSource (clang::ASTContext &context,
- ClangExpressionDeclMap &decl_map) :
- m_ast_context (context),
- m_decl_map (decl_map),
- m_active_lookups ()
+ ClangASTSource () :
+ m_ast_context (NULL),
+ m_active_lookups (),
+ m_import_in_progress (false),
+ m_lookups_enabled (false)
{
}
@@ -59,66 +56,34 @@
~ClangASTSource();
//------------------------------------------------------------------
- /// Interface stub that returns NULL.
- //------------------------------------------------------------------
- virtual clang::Decl *
- GetExternalDecl(uint32_t)
- {
- // These are only required for AST source that want to lazily load
- // the declarations (or parts thereof) that they return.
- return NULL;
- }
-
- //------------------------------------------------------------------
- /// Interface stub that returns NULL.
+ /// Interface stubs.
//------------------------------------------------------------------
- virtual clang::Stmt *
- GetExternalDeclStmt(uint64_t)
- {
- // These are only required for AST source that want to lazily load
- // the declarations (or parts thereof) that they return.
- return NULL;
- }
+ clang::Decl *GetExternalDecl (uint32_t) { return NULL; }
+ clang::Stmt *GetExternalDeclStmt (uint64_t) { return NULL; }
+ clang::Selector GetExternalSelector (uint32_t) { return clang::Selector(); }
+ uint32_t GetNumExternalSelectors () { return 0; }
+ clang::CXXBaseSpecifier *GetExternalCXXBaseSpecifiers (uint64_t Offset)
+ { return NULL; }
+ void MaterializeVisibleDecls (const clang::DeclContext *DC)
+ { return; }
- //------------------------------------------------------------------
- /// Interface stub that returns an undifferentiated Selector.
- //------------------------------------------------------------------
- virtual clang::Selector
- GetExternalSelector(uint32_t)
- {
- // These are also optional, although it might help with ObjC
- // debugging if we have respectable signatures. But a more
- // efficient interface (that didn't require scanning all files
- // for method signatures!) might help.
- return clang::Selector();
- }
-
- //------------------------------------------------------------------
- /// Interface stub that returns 0.
- //------------------------------------------------------------------
- virtual uint32_t
- GetNumExternalSelectors()
+ void InstallASTContext (clang::ASTContext *ast_context)
{
- // These are also optional, although it might help with ObjC
- // debugging if we have respectable signatures. But a more
- // efficient interface (that didn't require scanning all files
- // for method signatures!) might help.
- return 0;
+ m_ast_context = ast_context;
}
- //------------------------------------------------------------------
- /// Interface stub that returns NULL.
- //------------------------------------------------------------------
- virtual clang::CXXBaseSpecifier *
- GetExternalCXXBaseSpecifiers(uint64_t Offset)
- {
- return NULL;
- }
-
+ //
+ // APIs for ExternalASTSource
+ //
+
//------------------------------------------------------------------
/// Look up all Decls that match a particular name. Only handles
- /// Identifiers. Passes the request on to DeclMap, and calls
- /// SetExternalVisibleDeclsForName with the result.
+ /// Identifiers and DeclContexts that are either NamespaceDecls or
+ /// TranslationUnitDecls. Calls SetExternalVisibleDeclsForName with
+ /// the result.
+ ///
+ /// The work for this function is done by
+ /// void FindExternalVisibleDecls (NameSearchContext &);
///
/// @param[in] DC
/// The DeclContext to register the found Decls in.
@@ -129,31 +94,46 @@
/// @return
/// Whatever SetExternalVisibleDeclsForName returns.
//------------------------------------------------------------------
- virtual clang::DeclContextLookupResult
+ clang::DeclContextLookupResult
FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
clang::DeclarationName Name);
//------------------------------------------------------------------
- /// Interface stub.
- //------------------------------------------------------------------
- virtual void
- MaterializeVisibleDecls (const clang::DeclContext *DC);
-
- //------------------------------------------------------------------
- /// Interface stub that returns true.
+ /// Enumerate all Decls in a given lexical context.
+ ///
+ /// @param[in] DC
+ /// The DeclContext being searched.
+ ///
+ /// @param[in] isKindWeWant
+ /// If non-NULL, a callback function that returns true given the
+ /// DeclKinds of desired Decls, and false otherwise.
+ ///
+ /// @param[in] Decls
+ /// A vector that is filled in with matching Decls.
//------------------------------------------------------------------
- virtual clang::ExternalLoadResult
+ virtual clang::ExternalLoadResult
FindExternalLexicalDecls (const clang::DeclContext *DC,
bool (*isKindWeWant)(clang::Decl::Kind),
llvm::SmallVectorImpl<clang::Decl*> &Decls);
-
+ //------------------------------------------------------------------
+ /// Complete a TagDecl.
+ ///
+ /// @param[in] Tag
+ /// The Decl to be completed in place.
+ //------------------------------------------------------------------
virtual void
CompleteType (clang::TagDecl *Tag);
+ //------------------------------------------------------------------
+ /// Complete an ObjCInterfaceDecl.
+ ///
+ /// @param[in] Class
+ /// The Decl to be completed in place.
+ //------------------------------------------------------------------
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
-
+
//------------------------------------------------------------------
/// Called on entering a translation unit. Tells Clang by calling
/// setHasExternalVisibleStorage() and setHasExternalLexicalStorage()
@@ -163,13 +143,88 @@
/// Unused.
//------------------------------------------------------------------
void StartTranslationUnit (clang::ASTConsumer *Consumer);
+
+ //
+ // Helper APIs
+ //
+
+ //------------------------------------------------------------------
+ /// The worker function for FindExternalVisibleDeclsByName.
+ ///
+ /// @param[in] context
+ /// The NameSearchContext to use when filing results.
+ //------------------------------------------------------------------
+ virtual void FindExternalVisibleDecls (NameSearchContext &context);
+
+ void SetImportInProgress (bool import_in_progress) { m_import_in_progress = import_in_progress; }
+ bool GetImportInProgress () { return m_import_in_progress; }
+
+ void SetLookupsEnabled (bool lookups_enabled) { m_lookups_enabled = lookups_enabled; }
+ bool GetLookupsEnabled () { return m_lookups_enabled; }
+
+ //----------------------------------------------------------------------
+ /// @class ClangASTSourceProxy ClangASTSource.h "lldb/Expression/ClangASTSource.h"
+ /// @brief Proxy for ClangASTSource
+ ///
+ /// Clang AST contexts like to own their AST sources, so this is a
+ /// state-free proxy object.
+ //----------------------------------------------------------------------
+ class ClangASTSourceProxy : public clang::ExternalASTSource
+ {
+ public:
+ ClangASTSourceProxy (ClangASTSource &original) :
+ m_original(original)
+ {
+ }
+
+ clang::DeclContextLookupResult
+ FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
+ clang::DeclarationName Name)
+ {
+ return m_original.FindExternalVisibleDeclsByName(DC, Name);
+ }
+
+ virtual clang::ExternalLoadResult
+ FindExternalLexicalDecls (const clang::DeclContext *DC,
+ bool (*isKindWeWant)(clang::Decl::Kind),
+ llvm::SmallVectorImpl<clang::Decl*> &Decls)
+ {
+ return m_original.FindExternalLexicalDecls(DC, isKindWeWant, Decls);
+ }
+
+ virtual void
+ CompleteType (clang::TagDecl *Tag)
+ {
+ return m_original.CompleteType(Tag);
+ }
+
+ virtual void
+ CompleteType (clang::ObjCInterfaceDecl *Class)
+ {
+ return m_original.CompleteType(Class);
+ }
+ void StartTranslationUnit (clang::ASTConsumer *Consumer)
+ {
+ return m_original.StartTranslationUnit(Consumer);
+ }
+ private:
+ ClangASTSource &m_original;
+ };
+
+ clang::ExternalASTSource *CreateProxy()
+ {
+ return new ClangASTSourceProxy(*this);
+ }
+
protected:
friend struct NameSearchContext;
+
+ bool m_import_in_progress;
+ bool m_lookups_enabled;
- clang::ASTContext &m_ast_context; ///< The parser's AST context, for copying types into
- ClangExpressionDeclMap &m_decl_map; ///< The object that looks up named entities in LLDB
- std::set<const char *> m_active_lookups;
+ clang::ASTContext *m_ast_context; ///< The parser's AST context, for copying types into
+ std::set<const char *> m_active_lookups;
};
//----------------------------------------------------------------------
@@ -221,12 +276,6 @@
m_decl_context(dc) {}
//------------------------------------------------------------------
- /// Return the AST context for the current search. Useful when copying
- /// types.
- //------------------------------------------------------------------
- clang::ASTContext *GetASTContext();
-
- //------------------------------------------------------------------
/// Create a VarDecl with the name being searched for and the provided
/// type and register it in the right places.
///
Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=143253&r1=143252&r2=143253&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Fri Oct 28 18:38:38 2011
@@ -25,6 +25,7 @@
#include "lldb/lldb-public.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/Value.h"
+#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangExpressionVariable.h"
#include "lldb/Symbol/ClangASTImporter.h"
#include "lldb/Symbol/TaggedASTType.h"
@@ -56,7 +57,9 @@
/// Fourth and finally, it "dematerializes" the struct after the JITted code has
/// has executed, placing the new values back where it found the old ones.
//----------------------------------------------------------------------
-class ClangExpressionDeclMap : public ClangASTImporter::NamespaceMapCompleter
+class ClangExpressionDeclMap :
+ public ClangASTSource,
+ public ClangASTImporter::NamespaceMapCompleter
{
public:
//------------------------------------------------------------------
@@ -617,18 +620,11 @@
/// @param[in] context
/// The NameSearchContext that can construct Decls for this name.
///
- /// @param[in] name
- /// The name as a plain C string. The NameSearchContext contains
- /// a DeclarationName for the name so at first the name may seem
- /// redundant, but ClangExpressionDeclMap operates in RTTI land so
- /// it can't access DeclarationName.
- ///
/// @return
/// True on success; false otherwise.
//------------------------------------------------------------------
void
- FindExternalVisibleDecls (NameSearchContext &context,
- const ConstString &name);
+ FindExternalVisibleDecls (NameSearchContext &context);
//------------------------------------------------------------------
/// [Used by ClangASTSource] Find all Decls in a context that match
@@ -656,7 +652,7 @@
/// The TagDecl to be completed.
//------------------------------------------------------------------
void
- CompleteTagDecl (clang::TagDecl *tag_decl);
+ CompleteType (clang::TagDecl *tag_decl);
//------------------------------------------------------------------
/// [Used by ClangASTSource] Complete the definition of an
@@ -666,43 +662,7 @@
/// The ObjCInterfaceDecl to be completed.
//------------------------------------------------------------------
void
- CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl);
-
- //------------------------------------------------------------------
- /// [Used by ClangASTSource] Report whether a $__lldb variable has
- /// been searched for yet. This is the trigger for beginning to
- /// actually look for externally-defined names. (Names that come
- /// before this are typically the names of built-ins that don't need
- /// to be looked up.)
- ///
- /// @return
- /// True if a $__lldb variable has been found.
- //------------------------------------------------------------------
- bool
- GetLookupsEnabled () const
- {
- assert(m_parser_vars.get());
- return m_parser_vars->m_enable_lookups;
- }
-
- bool
- GetImportInProgress () const
- {
- if (m_parser_vars.get())
- return m_parser_vars->m_ignore_lookups;
- return false;
- }
-
- //------------------------------------------------------------------
- /// [Used by ClangASTSource] Indicate that a $__lldb variable has
- /// been found.
- //------------------------------------------------------------------
- void
- SetLookupsEnabled ()
- {
- assert(m_parser_vars.get());
- m_parser_vars->m_enable_lookups = true;
- }
+ CompleteType (clang::ObjCInterfaceDecl *interface_decl);
//------------------------------------------------------------------
/// [Used by ClangASTImporter] Look up the modules containing a
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=143253&r1=143252&r2=143253&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Fri Oct 28 18:38:38 2011
@@ -25,9 +25,11 @@
void
ClangASTSource::StartTranslationUnit(ASTConsumer *Consumer)
{
- // Tell Sema to ask us when looking into the translation unit's decl.
- m_ast_context.getTranslationUnitDecl()->setHasExternalVisibleStorage();
- m_ast_context.getTranslationUnitDecl()->setHasExternalLexicalStorage();
+ if (!m_ast_context)
+ return;
+
+ m_ast_context->getTranslationUnitDecl()->setHasExternalVisibleStorage();
+ m_ast_context->getTranslationUnitDecl()->setHasExternalLexicalStorage();
}
// The core lookup interface.
@@ -38,7 +40,10 @@
DeclarationName clang_decl_name
)
{
- if (m_decl_map.GetImportInProgress())
+ if (!m_ast_context)
+ return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+
+ if (GetImportInProgress())
return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
std::string decl_name (clang_decl_name.getAsString());
@@ -77,13 +82,13 @@
}
- if (!m_decl_map.GetLookupsEnabled())
+ if (!GetLookupsEnabled())
{
// Wait until we see a '$' at the start of a name before we start doing
// any lookups so we can avoid lookup up all of the builtin types.
if (!decl_name.empty() && decl_name[0] == '$')
{
- m_decl_map.SetLookupsEnabled ();
+ SetLookupsEnabled (true);
}
else
{
@@ -105,7 +110,7 @@
// printf("[%5u] FindExternalVisibleDeclsByName() \"%s\"\n", g_depth, uniqued_const_decl_name);
llvm::SmallVector<NamedDecl*, 4> name_decls;
NameSearchContext name_search_context(*this, name_decls, clang_decl_name, decl_ctx);
- m_decl_map.FindExternalVisibleDecls(name_search_context, const_decl_name);
+ FindExternalVisibleDecls(name_search_context);
DeclContext::lookup_result result (SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls));
// --g_depth;
m_active_lookups.erase (uniqued_const_decl_name);
@@ -113,25 +118,20 @@
}
void
-ClangASTSource::CompleteType (TagDecl *tag_decl)
+ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context)
{
- m_decl_map.CompleteTagDecl (tag_decl);
}
void
-ClangASTSource::CompleteType (ObjCInterfaceDecl *objc_decl)
+ClangASTSource::CompleteType (TagDecl *tag_decl)
{
- m_decl_map.CompleteObjCInterfaceDecl (objc_decl);
}
-void
-ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
+void
+ClangASTSource::CompleteType (ObjCInterfaceDecl *objc_decl)
{
- return;
}
-// This is used to support iterating through an entire lexical context,
-// which isn't something the debugger should ever need to do.
clang::ExternalLoadResult
ClangASTSource::FindExternalLexicalDecls
(
@@ -140,13 +140,7 @@
llvm::SmallVectorImpl<Decl*> &Decls
)
{
- return m_decl_map.FindExternalLexicalDecls (DC, isKindWeWant, Decls);
-}
-
-clang::ASTContext *
-NameSearchContext::GetASTContext()
-{
- return &m_ast_source.m_ast_context;
+ return ELR_Success;
}
clang::NamedDecl *
@@ -156,7 +150,7 @@
assert (type && "Type for variable must be non-NULL!");
- clang::NamedDecl *Decl = VarDecl::Create(m_ast_source.m_ast_context,
+ clang::NamedDecl *Decl = VarDecl::Create(*m_ast_source.m_ast_context,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
SourceLocation(),
@@ -173,7 +167,7 @@
clang::NamedDecl *
NameSearchContext::AddFunDecl (void *type)
{
- clang::FunctionDecl *func_decl = FunctionDecl::Create (m_ast_source.m_ast_context,
+ clang::FunctionDecl *func_decl = FunctionDecl::Create (*m_ast_source.m_ast_context,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
SourceLocation(),
@@ -203,7 +197,7 @@
{
QualType arg_qual_type (func_proto_type->getArgType(ArgIndex));
- parm_var_decls.push_back(ParmVarDecl::Create (m_ast_source.m_ast_context,
+ parm_var_decls.push_back(ParmVarDecl::Create (*m_ast_source.m_ast_context,
const_cast<DeclContext*>(m_decl_context),
SourceLocation(),
SourceLocation(),
@@ -230,10 +224,10 @@
proto_info.Variadic = true;
- QualType generic_function_type(m_ast_source.m_ast_context.getFunctionType (m_ast_source.m_ast_context.UnknownAnyTy, // result
- NULL, // argument types
- 0, // number of arguments
- proto_info));
+ QualType generic_function_type(m_ast_source.m_ast_context->getFunctionType (m_ast_source.m_ast_context->UnknownAnyTy, // result
+ NULL, // argument types
+ 0, // number of arguments
+ proto_info));
return AddFunDecl(generic_function_type.getAsOpaquePtr());
}
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=143253&r1=143252&r2=143253&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Oct 28 18:38:38 2011
@@ -2228,8 +2228,12 @@
// Interface for ClangASTSource
void
-ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, const ConstString &name)
+ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context)
{
+ assert (m_ast_context);
+
+ const ConstString name(context.m_decl_name.getAsString().c_str());
+
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (m_parser_vars->m_ignore_lookups)
@@ -2256,7 +2260,7 @@
if (const NamespaceDecl *namespace_context = dyn_cast<NamespaceDecl>(context.m_decl_context))
{
- ClangASTImporter::NamespaceMapSP namespace_map = m_parser_vars->GetASTImporter(context.GetASTContext())->GetNamespaceMap(namespace_context);
+ ClangASTImporter::NamespaceMapSP namespace_map = m_parser_vars->GetASTImporter(m_ast_context)->GetNamespaceMap(namespace_context);
if (log && log->GetVerbose())
log->Printf(" FEVD[%u] Inspecting namespace map %p (%d entries)",
@@ -2327,6 +2331,7 @@
{
assert (m_struct_vars.get());
assert (m_parser_vars.get());
+ assert (m_ast_context);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -2482,7 +2487,7 @@
if (!ptype_type_decl)
break;
- Decl *parser_ptype_decl = ClangASTContext::CopyDecl(context.GetASTContext(), scratch_ast_context, ptype_type_decl);
+ Decl *parser_ptype_decl = ClangASTContext::CopyDecl(m_ast_context, scratch_ast_context, ptype_type_decl);
if (!parser_ptype_decl)
break;
@@ -2834,7 +2839,7 @@
}
void
-ClangExpressionDeclMap::CompleteTagDecl (TagDecl *tag_decl)
+ClangExpressionDeclMap::CompleteType (TagDecl *tag_decl)
{
assert (m_parser_vars.get());
@@ -2859,7 +2864,7 @@
}
void
-ClangExpressionDeclMap::CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl)
+ClangExpressionDeclMap::CompleteType (clang::ObjCInterfaceDecl *interface_decl)
{
assert (m_parser_vars.get());
@@ -2877,7 +2882,6 @@
if (log)
{
- log->Printf(" [CompleteObjCInterfaceDecl] Completing an ObjCInterfaceDecl named %s", interface_decl->getName().str().c_str());
log->Printf(" [COID] After:");
ASTDumper dumper((Decl*)interface_decl);
dumper.ToLog(log, " [COID] ");
@@ -3011,7 +3015,7 @@
Value *var_location = GetVariableValue (*m_parser_vars->m_exe_ctx,
var,
- context.GetASTContext(),
+ m_ast_context,
&ut,
&pt);
@@ -3061,10 +3065,10 @@
TypeFromUser user_type (pvar_sp->GetTypeFromUser());
- TypeFromParser parser_type (GuardedCopyType(context.GetASTContext(),
+ TypeFromParser parser_type (GuardedCopyType(m_ast_context,
user_type.GetASTContext(),
user_type.GetOpaqueQualType()),
- context.GetASTContext());
+ m_ast_context);
NamedDecl *var_decl = context.AddVarDecl(ClangASTContext::CreateLValueReferenceType(parser_type.GetASTContext(), parser_type.GetOpaqueQualType()));
@@ -3100,8 +3104,8 @@
TypeFromUser user_type (ClangASTContext::CreateLValueReferenceType(scratch_ast_context, ClangASTContext::GetVoidPtrType(scratch_ast_context, true)),
scratch_ast_context);
- TypeFromParser parser_type (ClangASTContext::CreateLValueReferenceType(scratch_ast_context, ClangASTContext::GetVoidPtrType(context.GetASTContext(), true)),
- context.GetASTContext());
+ TypeFromParser parser_type (ClangASTContext::CreateLValueReferenceType(scratch_ast_context, ClangASTContext::GetVoidPtrType(m_ast_context, true)),
+ m_ast_context);
NamedDecl *var_decl = context.AddVarDecl(parser_type.GetOpaqueQualType());
@@ -3199,7 +3203,7 @@
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
- void *ast_type = ClangASTContext::GetBuiltinTypeForEncodingAndBitSize(context.GetASTContext(),
+ void *ast_type = ClangASTContext::GetBuiltinTypeForEncodingAndBitSize(m_ast_context,
reg_info->encoding,
reg_info->byte_size * 8);
@@ -3211,7 +3215,7 @@
}
TypeFromParser parser_type (ast_type,
- context.GetASTContext());
+ m_ast_context);
NamedDecl *var_decl = context.AddVarDecl(parser_type.GetOpaqueQualType());
@@ -3247,12 +3251,12 @@
const ClangNamespaceDecl &namespace_decl = namespace_decls->begin()->second;
- Decl *copied_decl = m_parser_vars->GetASTImporter(context.GetASTContext())->CopyDecl(namespace_decl.GetASTContext(),
- namespace_decl.GetNamespaceDecl());
+ Decl *copied_decl = m_parser_vars->GetASTImporter(m_ast_context)->CopyDecl(namespace_decl.GetASTContext(),
+ namespace_decl.GetNamespaceDecl());
NamespaceDecl *copied_namespace_decl = dyn_cast<NamespaceDecl>(copied_decl);
- m_parser_vars->GetASTImporter(context.GetASTContext())->RegisterNamespaceMap(copied_namespace_decl, namespace_decls);
+ m_parser_vars->GetASTImporter(m_ast_context)->RegisterNamespaceMap(copied_namespace_decl, namespace_decls);
return dyn_cast<NamespaceDecl>(copied_decl);
}
@@ -3298,7 +3302,7 @@
fun_address = &fun->GetAddressRange().GetBaseAddress();
fun_ast_context = fun_type->GetClangASTContext().getASTContext();
- void *copied_type = GuardedCopyType(context.GetASTContext(), fun_ast_context, fun_opaque_type);
+ void *copied_type = GuardedCopyType(m_ast_context, fun_ast_context, fun_opaque_type);
if (copied_type)
{
fun_decl = context.AddFunDecl(copied_type);
@@ -3365,7 +3369,7 @@
unsigned int current_id,
bool add_method)
{
- ASTContext *parser_ast_context = context.GetASTContext();
+ ASTContext *parser_ast_context = m_ast_context;
ASTContext *user_ast_context = ut.GetASTContext();
void *copied_type = GuardedCopyType(parser_ast_context, user_ast_context, ut.GetOpaqueQualType());
Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=143253&r1=143252&r2=143253&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Fri Oct 28 18:38:38 2011
@@ -320,7 +320,8 @@
if (decl_map)
{
- OwningPtr<clang::ExternalASTSource> ast_source(new ClangASTSource(*ast_context, *decl_map));
+ llvm::OwningPtr<clang::ExternalASTSource> ast_source(decl_map->CreateProxy());
+ decl_map->InstallASTContext(ast_context.get());
ast_context->setExternalSource(ast_source);
}
More information about the lldb-commits
mailing list