blob: 1f9bf6b29362371f77407fa0619e8a0188ad15c4 [file] [log] [blame]
Greg Clayton1e591ce2010-07-16 18:28:27 +00001//===-- ClangASTSource.cpp ---------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Chris Lattner24943d22010-06-08 16:52:24 +000010
Chris Lattner24943d22010-06-08 16:52:24 +000011#include "clang/AST/ASTContext.h"
Greg Claytonf4c7ae02010-10-15 03:36:13 +000012#include "lldb/Core/Log.h"
Greg Clayton6e0101c2011-09-17 06:21:20 +000013#include "lldb/Core/Module.h"
Sean Callanan73b520f2011-10-29 01:58:46 +000014#include "lldb/Core/ModuleList.h"
Sean Callananbb715f92011-10-29 02:28:18 +000015#include "lldb/Expression/ASTDumper.h"
Chris Lattner24943d22010-06-08 16:52:24 +000016#include "lldb/Expression/ClangASTSource.h"
17#include "lldb/Expression/ClangExpression.h"
Sean Callanan73b520f2011-10-29 01:58:46 +000018#include "lldb/Symbol/ClangNamespaceDecl.h"
19#include "lldb/Symbol/SymbolVendor.h"
20#include "lldb/Target/Target.h"
Chris Lattner24943d22010-06-08 16:52:24 +000021
22using namespace clang;
23using namespace lldb_private;
24
Greg Claytonb01000f2011-01-17 03:46:26 +000025ClangASTSource::~ClangASTSource()
26{
27}
Chris Lattner24943d22010-06-08 16:52:24 +000028
Greg Claytonb01000f2011-01-17 03:46:26 +000029void
30ClangASTSource::StartTranslationUnit(ASTConsumer *Consumer)
31{
Sean Callananf76afff2011-10-28 23:38:38 +000032 if (!m_ast_context)
33 return;
34
35 m_ast_context->getTranslationUnitDecl()->setHasExternalVisibleStorage();
36 m_ast_context->getTranslationUnitDecl()->setHasExternalLexicalStorage();
Chris Lattner24943d22010-06-08 16:52:24 +000037}
38
Chris Lattner24943d22010-06-08 16:52:24 +000039// The core lookup interface.
Greg Claytonb01000f2011-01-17 03:46:26 +000040DeclContext::lookup_result
41ClangASTSource::FindExternalVisibleDeclsByName
Greg Claytonf4c7ae02010-10-15 03:36:13 +000042(
43 const DeclContext *decl_ctx,
Greg Clayton8de27c72010-10-15 22:48:33 +000044 DeclarationName clang_decl_name
Greg Claytonf4c7ae02010-10-15 03:36:13 +000045)
46{
Sean Callananf76afff2011-10-28 23:38:38 +000047 if (!m_ast_context)
48 return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
49
50 if (GetImportInProgress())
Greg Claytonb01000f2011-01-17 03:46:26 +000051 return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
52
53 std::string decl_name (clang_decl_name.getAsString());
54
55// if (m_decl_map.DoingASTImport ())
56// return DeclContext::lookup_result();
57//
Greg Clayton8de27c72010-10-15 22:48:33 +000058 switch (clang_decl_name.getNameKind()) {
Chris Lattner24943d22010-06-08 16:52:24 +000059 // Normal identifiers.
60 case DeclarationName::Identifier:
Greg Clayton8de27c72010-10-15 22:48:33 +000061 if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0)
62 return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
63 break;
Chris Lattner24943d22010-06-08 16:52:24 +000064
65 // Operator names. Not important for now.
66 case DeclarationName::CXXOperatorName:
67 case DeclarationName::CXXLiteralOperatorName:
68 return DeclContext::lookup_result();
69
70 // Using directives found in this context.
71 // Tell Sema we didn't find any or we'll end up getting asked a *lot*.
72 case DeclarationName::CXXUsingDirective:
Greg Clayton8de27c72010-10-15 22:48:33 +000073 return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
Chris Lattner24943d22010-06-08 16:52:24 +000074
75 // These aren't looked up like this.
76 case DeclarationName::ObjCZeroArgSelector:
77 case DeclarationName::ObjCOneArgSelector:
78 case DeclarationName::ObjCMultiArgSelector:
79 return DeclContext::lookup_result();
80
81 // These aren't possible in the global context.
82 case DeclarationName::CXXConstructorName:
83 case DeclarationName::CXXDestructorName:
84 case DeclarationName::CXXConversionFunctionName:
85 return DeclContext::lookup_result();
86 }
Greg Claytonf4c7ae02010-10-15 03:36:13 +000087
Greg Claytonf4c7ae02010-10-15 03:36:13 +000088
Sean Callananf76afff2011-10-28 23:38:38 +000089 if (!GetLookupsEnabled())
Greg Clayton8de27c72010-10-15 22:48:33 +000090 {
91 // Wait until we see a '$' at the start of a name before we start doing
92 // any lookups so we can avoid lookup up all of the builtin types.
93 if (!decl_name.empty() && decl_name[0] == '$')
94 {
Sean Callananf76afff2011-10-28 23:38:38 +000095 SetLookupsEnabled (true);
Greg Clayton8de27c72010-10-15 22:48:33 +000096 }
97 else
98 {
99 return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
100 }
Greg Claytonf4c7ae02010-10-15 03:36:13 +0000101 }
Greg Clayton8de27c72010-10-15 22:48:33 +0000102
Greg Clayton8de27c72010-10-15 22:48:33 +0000103 ConstString const_decl_name(decl_name.c_str());
Greg Clayton9ceed1e2010-11-13 04:18:24 +0000104
105 const char *uniqued_const_decl_name = const_decl_name.GetCString();
106 if (m_active_lookups.find (uniqued_const_decl_name) != m_active_lookups.end())
107 {
108 // We are currently looking up this name...
109 return DeclContext::lookup_result();
110 }
111 m_active_lookups.insert(uniqued_const_decl_name);
Greg Claytona8b278a2010-11-15 01:34:18 +0000112// static uint32_t g_depth = 0;
113// ++g_depth;
114// printf("[%5u] FindExternalVisibleDeclsByName() \"%s\"\n", g_depth, uniqued_const_decl_name);
Greg Clayton9ceed1e2010-11-13 04:18:24 +0000115 llvm::SmallVector<NamedDecl*, 4> name_decls;
116 NameSearchContext name_search_context(*this, name_decls, clang_decl_name, decl_ctx);
Sean Callananf76afff2011-10-28 23:38:38 +0000117 FindExternalVisibleDecls(name_search_context);
Greg Clayton9ceed1e2010-11-13 04:18:24 +0000118 DeclContext::lookup_result result (SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls));
Greg Claytona8b278a2010-11-15 01:34:18 +0000119// --g_depth;
Greg Clayton9ceed1e2010-11-13 04:18:24 +0000120 m_active_lookups.erase (uniqued_const_decl_name);
121 return result;
Chris Lattner24943d22010-06-08 16:52:24 +0000122}
123
Greg Claytonb01000f2011-01-17 03:46:26 +0000124void
Sean Callananf76afff2011-10-28 23:38:38 +0000125ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context)
126{
127}
128
129void
Greg Claytonb01000f2011-01-17 03:46:26 +0000130ClangASTSource::CompleteType (TagDecl *tag_decl)
Sean Callananbb715f92011-10-29 02:28:18 +0000131{
132 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
133
134 if (log)
135 {
136 log->Printf(" [CompleteTagDecl] Completing a TagDecl named %s", tag_decl->getName().str().c_str());
137 log->Printf(" [CTD] Before:");
138 ASTDumper dumper((Decl*)tag_decl);
139 dumper.ToLog(log, " [CTD] ");
140 }
141
142 m_ast_importer->CompleteTagDecl (tag_decl);
143
144 if (log)
145 {
146 log->Printf(" [CTD] After:");
147 ASTDumper dumper((Decl*)tag_decl);
148 dumper.ToLog(log, " [CTD] ");
149 }
Greg Claytonb01000f2011-01-17 03:46:26 +0000150}
151
152void
Sean Callananbb715f92011-10-29 02:28:18 +0000153ClangASTSource::CompleteType (clang::ObjCInterfaceDecl *interface_decl)
154{
155 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
156
157 if (log)
158 {
159 log->Printf(" [CompleteObjCInterfaceDecl] Completing an ObjCInterfaceDecl named %s", interface_decl->getName().str().c_str());
160 log->Printf(" [COID] Before:");
161 ASTDumper dumper((Decl*)interface_decl);
162 dumper.ToLog(log, " [COID] ");
163 }
164
165 m_ast_importer->CompleteObjCInterfaceDecl (interface_decl);
166
167 if (log)
168 {
169 log->Printf(" [COID] After:");
170 ASTDumper dumper((Decl*)interface_decl);
171 dumper.ToLog(log, " [COID] ");
172 }
Greg Claytonb01000f2011-01-17 03:46:26 +0000173}
174
Sean Callanan9b6898f2011-07-30 02:42:06 +0000175clang::ExternalLoadResult
Sean Callananbb715f92011-10-29 02:28:18 +0000176ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
177 bool (*predicate)(Decl::Kind),
178 llvm::SmallVectorImpl<Decl*> &decls)
179{
180 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
181
182 const Decl *context_decl = dyn_cast<Decl>(decl_context);
183
184 if (!context_decl)
185 return ELR_Failure;
186
187 static unsigned int invocation_id = 0;
188 unsigned int current_id = invocation_id++;
189
190 if (log)
191 {
192 if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
193 log->Printf("FindExternalLexicalDecls[%u] in '%s' (a %s) with %s predicate",
194 current_id,
195 context_named_decl->getNameAsString().c_str(),
196 context_decl->getDeclKindName(),
197 (predicate ? "non-null" : "null"));
198 else if(context_decl)
199 log->Printf("FindExternalLexicalDecls[%u] in a %s with %s predicate",
200 current_id,
201 context_decl->getDeclKindName(),
202 (predicate ? "non-null" : "null"));
203 else
204 log->Printf("FindExternalLexicalDecls[%u] in a NULL context with %s predicate",
205 current_id,
206 (predicate ? "non-null" : "null"));
207 }
208
209 Decl *original_decl = NULL;
210 ASTContext *original_ctx = NULL;
211
212 if (!m_ast_importer->ResolveDeclOrigin(context_decl, &original_decl, &original_ctx))
213 return ELR_Failure;
214
215 if (log)
216 {
217 log->Printf(" FELD[%u] Original decl:", current_id);
218 ASTDumper(original_decl).ToLog(log, " ");
219 }
220
221 if (TagDecl *original_tag_decl = dyn_cast<TagDecl>(original_decl))
222 {
223 ExternalASTSource *external_source = original_ctx->getExternalSource();
224
225 if (external_source)
226 external_source->CompleteType (original_tag_decl);
227 }
228
229 DeclContext *original_decl_context = dyn_cast<DeclContext>(original_decl);
230
231 if (!original_decl_context)
232 return ELR_Failure;
233
234 for (TagDecl::decl_iterator iter = original_decl_context->decls_begin();
235 iter != original_decl_context->decls_end();
236 ++iter)
237 {
238 Decl *decl = *iter;
239
240 if (!predicate || predicate(decl->getKind()))
241 {
242 if (log)
243 {
244 ASTDumper ast_dumper(decl);
245 if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
246 log->Printf(" FELD[%d] Adding [to %s] lexical decl %s", current_id, context_named_decl->getNameAsString().c_str(), ast_dumper.GetCString());
247 else
248 log->Printf(" FELD[%d] Adding lexical decl %s", current_id, ast_dumper.GetCString());
249 }
250
251 Decl *copied_decl = m_ast_importer->CopyDecl(original_ctx, decl);
252
253 decls.push_back(copied_decl);
254 }
255 }
256
257 return ELR_AlreadyLoaded;
Chris Lattner24943d22010-06-08 16:52:24 +0000258}
259
Sean Callanan73b520f2011-10-29 01:58:46 +0000260void
261ClangASTSource::CompleteNamespaceMap (ClangASTImporter::NamespaceMapSP &namespace_map,
262 const ConstString &name,
263 ClangASTImporter::NamespaceMapSP &parent_map) const
264{
265 static unsigned int invocation_id = 0;
266 unsigned int current_id = invocation_id++;
267
268 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
269
270 if (log)
271 {
272 if (parent_map && parent_map->size())
273 log->Printf("CompleteNamespaceMap[%u] Searching for namespace %s in namespace %s",
274 current_id,
275 name.GetCString(),
276 parent_map->begin()->second.GetNamespaceDecl()->getDeclName().getAsString().c_str());
277 else
278 log->Printf("CompleteNamespaceMap[%u] Searching for namespace %s",
279 current_id,
280 name.GetCString());
281 }
282
283
284 if (parent_map)
285 {
286 for (ClangASTImporter::NamespaceMap::iterator i = parent_map->begin(), e = parent_map->end();
287 i != e;
288 ++i)
289 {
290 ClangNamespaceDecl found_namespace_decl;
291
292 lldb::ModuleSP module_sp = i->first;
293 ClangNamespaceDecl module_parent_namespace_decl = i->second;
294
295 SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor();
296
297 if (!symbol_vendor)
298 continue;
299
300 SymbolContext null_sc;
301
302 found_namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &module_parent_namespace_decl);
303
304 if (!found_namespace_decl)
305 continue;
306
307 namespace_map->push_back(std::pair<lldb::ModuleSP, ClangNamespaceDecl>(module_sp, found_namespace_decl));
308
309 if (log)
310 log->Printf(" CMN[%u] Found namespace %s in module %s",
311 current_id,
312 name.GetCString(),
313 module_sp->GetFileSpec().GetFilename().GetCString());
314 }
315 }
316 else
317 {
318 ModuleList &images = m_target->GetImages();
319 ClangNamespaceDecl null_namespace_decl;
320
321 for (uint32_t i = 0, e = images.GetSize();
322 i != e;
323 ++i)
324 {
325 lldb::ModuleSP image = images.GetModuleAtIndex(i);
326
327 if (!image)
328 continue;
329
330 ClangNamespaceDecl found_namespace_decl;
331
332 SymbolVendor *symbol_vendor = image->GetSymbolVendor();
333
334 if (!symbol_vendor)
335 continue;
336
337 SymbolContext null_sc;
338
339 found_namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &null_namespace_decl);
340
341 if (!found_namespace_decl)
342 continue;
343
344 namespace_map->push_back(std::pair<lldb::ModuleSP, ClangNamespaceDecl>(image, found_namespace_decl));
345
346 if (log)
347 log->Printf(" CMN[%u] Found namespace %s in module %s",
348 current_id,
349 name.GetCString(),
350 image->GetFileSpec().GetFilename().GetCString());
351 }
352 }
353}
354
Sean Callananbb715f92011-10-29 02:28:18 +0000355NamespaceDecl *
356ClangASTSource::AddNamespace (NameSearchContext &context, ClangASTImporter::NamespaceMapSP &namespace_decls)
357{
358 if (namespace_decls.empty())
359 return NULL;
360
361 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
362
363 const ClangNamespaceDecl &namespace_decl = namespace_decls->begin()->second;
364
365 Decl *copied_decl = m_ast_importer->CopyDecl(namespace_decl.GetASTContext(), namespace_decl.GetNamespaceDecl());
366
367 NamespaceDecl *copied_namespace_decl = dyn_cast<NamespaceDecl>(copied_decl);
368
369 m_ast_importer->RegisterNamespaceMap(copied_namespace_decl, namespace_decls);
370
371 return dyn_cast<NamespaceDecl>(copied_decl);
372}
373
Greg Claytonb01000f2011-01-17 03:46:26 +0000374clang::NamedDecl *
375NameSearchContext::AddVarDecl(void *type)
376{
Greg Clayton8de27c72010-10-15 22:48:33 +0000377 IdentifierInfo *ii = m_decl_name.getAsIdentifierInfo();
Sean Callanan1ddd9fe2010-11-30 00:27:43 +0000378
379 assert (type && "Type for variable must be non-NULL!");
Sean Callanancc074622010-09-14 21:59:34 +0000380
Sean Callananf76afff2011-10-28 23:38:38 +0000381 clang::NamedDecl *Decl = VarDecl::Create(*m_ast_source.m_ast_context,
Greg Clayton8de27c72010-10-15 22:48:33 +0000382 const_cast<DeclContext*>(m_decl_context),
Chris Lattner24943d22010-06-08 16:52:24 +0000383 SourceLocation(),
Sean Callanan279584c2011-03-15 00:17:19 +0000384 SourceLocation(),
Sean Callanancc074622010-09-14 21:59:34 +0000385 ii,
Chris Lattner24943d22010-06-08 16:52:24 +0000386 QualType::getFromOpaquePtr(type),
387 0,
Sean Callanan47a5c4c2010-09-23 03:01:22 +0000388 SC_Static,
389 SC_Static);
Greg Clayton8de27c72010-10-15 22:48:33 +0000390 m_decls.push_back(Decl);
Chris Lattner24943d22010-06-08 16:52:24 +0000391
392 return Decl;
393}
Sean Callanan8f0dc342010-06-22 23:46:24 +0000394
Greg Claytonb01000f2011-01-17 03:46:26 +0000395clang::NamedDecl *
396NameSearchContext::AddFunDecl (void *type)
397{
Sean Callananf76afff2011-10-28 23:38:38 +0000398 clang::FunctionDecl *func_decl = FunctionDecl::Create (*m_ast_source.m_ast_context,
Greg Clayton8de27c72010-10-15 22:48:33 +0000399 const_cast<DeclContext*>(m_decl_context),
400 SourceLocation(),
Sean Callanan279584c2011-03-15 00:17:19 +0000401 SourceLocation(),
Greg Clayton8de27c72010-10-15 22:48:33 +0000402 m_decl_name.getAsIdentifierInfo(),
403 QualType::getFromOpaquePtr(type),
404 NULL,
405 SC_Static,
406 SC_Static,
407 false,
408 true);
Sean Callanan8f0dc342010-06-22 23:46:24 +0000409
Sean Callananb291abe2010-08-12 23:45:38 +0000410 // We have to do more than just synthesize the FunctionDecl. We have to
411 // synthesize ParmVarDecls for all of the FunctionDecl's arguments. To do
412 // this, we raid the function's FunctionProtoType for types.
413
Greg Clayton8de27c72010-10-15 22:48:33 +0000414 QualType qual_type (QualType::getFromOpaquePtr(type));
415 const FunctionProtoType *func_proto_type = qual_type->getAs<FunctionProtoType>();
Sean Callanan8f0dc342010-06-22 23:46:24 +0000416
Greg Clayton8de27c72010-10-15 22:48:33 +0000417 if (func_proto_type)
Sean Callanan3c821cc2010-06-23 18:58:10 +0000418 {
Greg Clayton8de27c72010-10-15 22:48:33 +0000419 unsigned NumArgs = func_proto_type->getNumArgs();
Sean Callanan8f0dc342010-06-22 23:46:24 +0000420 unsigned ArgIndex;
421
Sean Callananc1535182011-10-07 23:18:13 +0000422 SmallVector<ParmVarDecl *, 5> parm_var_decls;
423
Sean Callanan8f0dc342010-06-22 23:46:24 +0000424 for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex)
425 {
Greg Clayton8de27c72010-10-15 22:48:33 +0000426 QualType arg_qual_type (func_proto_type->getArgType(ArgIndex));
Sean Callanan8f0dc342010-06-22 23:46:24 +0000427
Sean Callananf76afff2011-10-28 23:38:38 +0000428 parm_var_decls.push_back(ParmVarDecl::Create (*m_ast_source.m_ast_context,
Sean Callananc1535182011-10-07 23:18:13 +0000429 const_cast<DeclContext*>(m_decl_context),
430 SourceLocation(),
431 SourceLocation(),
432 NULL,
433 arg_qual_type,
434 NULL,
435 SC_Static,
436 SC_Static,
437 NULL));
Sean Callanan8f0dc342010-06-22 23:46:24 +0000438 }
439
Sean Callananc1535182011-10-07 23:18:13 +0000440 func_decl->setParams(ArrayRef<ParmVarDecl*>(parm_var_decls));
Sean Callanan8f0dc342010-06-22 23:46:24 +0000441 }
442
Greg Clayton8de27c72010-10-15 22:48:33 +0000443 m_decls.push_back(func_decl);
Sean Callanan8f0dc342010-06-22 23:46:24 +0000444
Greg Clayton8de27c72010-10-15 22:48:33 +0000445 return func_decl;
Sean Callanan8f0dc342010-06-22 23:46:24 +0000446}
Sean Callanan0fc73582010-07-27 00:55:47 +0000447
Greg Claytonb01000f2011-01-17 03:46:26 +0000448clang::NamedDecl *
449NameSearchContext::AddGenericFunDecl()
Sean Callanan0fc73582010-07-27 00:55:47 +0000450{
Sean Callananad293092011-01-18 23:32:05 +0000451 FunctionProtoType::ExtProtoInfo proto_info;
452
453 proto_info.Variadic = true;
454
Sean Callananf76afff2011-10-28 23:38:38 +0000455 QualType generic_function_type(m_ast_source.m_ast_context->getFunctionType (m_ast_source.m_ast_context->UnknownAnyTy, // result
456 NULL, // argument types
457 0, // number of arguments
458 proto_info));
Greg Clayton8de27c72010-10-15 22:48:33 +0000459
Sean Callanan0fc73582010-07-27 00:55:47 +0000460 return AddFunDecl(generic_function_type.getAsOpaquePtr());
461}
Sean Callanan93a4b1a2010-08-04 01:02:13 +0000462
Greg Claytonb01000f2011-01-17 03:46:26 +0000463clang::NamedDecl *
464NameSearchContext::AddTypeDecl(void *type)
Sean Callanan93a4b1a2010-08-04 01:02:13 +0000465{
Greg Claytona1aaaff2011-01-23 00:34:52 +0000466 if (type)
467 {
468 QualType qual_type = QualType::getFromOpaquePtr(type);
Sean Callanan93a4b1a2010-08-04 01:02:13 +0000469
Sean Callanand5b3c352011-01-27 04:42:51 +0000470 if (const TagType *tag_type = dyn_cast<clang::TagType>(qual_type))
Greg Claytona1aaaff2011-01-23 00:34:52 +0000471 {
472 TagDecl *tag_decl = tag_type->getDecl();
473
474 m_decls.push_back(tag_decl);
475
476 return tag_decl;
477 }
Sean Callanand5b3c352011-01-27 04:42:51 +0000478 else if (const ObjCObjectType *objc_object_type = dyn_cast<clang::ObjCObjectType>(qual_type))
Greg Claytona1aaaff2011-01-23 00:34:52 +0000479 {
480 ObjCInterfaceDecl *interface_decl = objc_object_type->getInterface();
481
482 m_decls.push_back((NamedDecl*)interface_decl);
483
484 return (NamedDecl*)interface_decl;
485 }
Sean Callanan93a4b1a2010-08-04 01:02:13 +0000486 }
Greg Claytona1aaaff2011-01-23 00:34:52 +0000487 return NULL;
Sean Callanan93a4b1a2010-08-04 01:02:13 +0000488}
Greg Claytone6d72ca2011-06-25 00:44:06 +0000489
490void
491NameSearchContext::AddLookupResult (clang::DeclContextLookupConstResult result)
492{
493 for (clang::NamedDecl * const *decl_iterator = result.first;
494 decl_iterator != result.second;
495 ++decl_iterator)
496 m_decls.push_back (*decl_iterator);
497}
498
499void
500NameSearchContext::AddNamedDecl (clang::NamedDecl *decl)
501{
502 m_decls.push_back (decl);
503}