blob: dc7f5688f5c90d4a3e7a6ff1b492f7200c39f890 [file] [log] [blame]
Greg Claytona2721472011-06-25 00:44:06 +00001//===-- ClangASTImporter.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
10#include "clang/AST/Decl.h"
Sean Callanancbbe3ac2012-01-13 22:55:55 +000011#include "clang/AST/DeclCXX.h"
Sean Callanancc427fa2011-07-30 02:42:06 +000012#include "clang/AST/DeclObjC.h"
13#include "lldb/Core/Log.h"
Greg Clayton7c6d7b82011-10-21 23:04:20 +000014#include "lldb/Core/Module.h"
Greg Claytona2721472011-06-25 00:44:06 +000015#include "lldb/Symbol/ClangASTContext.h"
16#include "lldb/Symbol/ClangASTImporter.h"
Sean Callananb2269162011-10-21 22:18:07 +000017#include "lldb/Symbol/ClangNamespaceDecl.h"
Greg Claytona2721472011-06-25 00:44:06 +000018
19using namespace lldb_private;
20using namespace clang;
21
22clang::QualType
Sean Callanan686b2312011-11-16 18:20:47 +000023ClangASTImporter::CopyType (clang::ASTContext *dst_ast,
24 clang::ASTContext *src_ast,
Greg Claytona2721472011-06-25 00:44:06 +000025 clang::QualType type)
26{
Sean Callanan686b2312011-11-16 18:20:47 +000027 MinionSP minion_sp (GetMinion(dst_ast, src_ast));
Sean Callanancc427fa2011-07-30 02:42:06 +000028
Greg Claytondd0649b2011-07-06 18:55:08 +000029 if (minion_sp)
30 return minion_sp->Import(type);
Sean Callanancc427fa2011-07-30 02:42:06 +000031
Greg Claytondd0649b2011-07-06 18:55:08 +000032 return QualType();
Greg Claytona2721472011-06-25 00:44:06 +000033}
34
Sean Callanan80f78672011-11-16 19:07:39 +000035lldb::clang_type_t
36ClangASTImporter::CopyType (clang::ASTContext *dst_ast,
37 clang::ASTContext *src_ast,
38 lldb::clang_type_t type)
39{
40 return CopyType (dst_ast, src_ast, QualType::getFromOpaquePtr(type)).getAsOpaquePtr();
41}
42
Greg Claytona2721472011-06-25 00:44:06 +000043clang::Decl *
Sean Callanan686b2312011-11-16 18:20:47 +000044ClangASTImporter::CopyDecl (clang::ASTContext *dst_ast,
45 clang::ASTContext *src_ast,
Greg Claytona2721472011-06-25 00:44:06 +000046 clang::Decl *decl)
47{
Greg Claytondd0649b2011-07-06 18:55:08 +000048 MinionSP minion_sp;
Greg Claytona2721472011-06-25 00:44:06 +000049
Sean Callanan686b2312011-11-16 18:20:47 +000050 minion_sp = GetMinion(dst_ast, src_ast);
Greg Claytona2721472011-06-25 00:44:06 +000051
Greg Claytondd0649b2011-07-06 18:55:08 +000052 if (minion_sp)
Sean Callananbfb237bc2011-11-04 22:46:46 +000053 {
54 clang::Decl *result = minion_sp->Import(decl);
55
56 if (!result)
57 {
58 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
59
Sean Callanand5145b32011-11-05 00:08:12 +000060 if (log)
61 {
62 if (NamedDecl *named_decl = dyn_cast<NamedDecl>(decl))
63 log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s '%s'", decl->getDeclKindName(), named_decl->getNameAsString().c_str());
64 else
65 log->Printf(" [ClangASTImporter] WARNING: Failed to import a %s", decl->getDeclKindName());
66 }
Sean Callananbfb237bc2011-11-04 22:46:46 +000067 }
68
69 return result;
70 }
Sean Callanancc427fa2011-07-30 02:42:06 +000071
Greg Claytondd0649b2011-07-06 18:55:08 +000072 return NULL;
Greg Claytona2721472011-06-25 00:44:06 +000073}
74
Sean Callananbb120042011-12-16 21:06:35 +000075lldb::clang_type_t
76ClangASTImporter::DeportType (clang::ASTContext *dst_ctx,
77 clang::ASTContext *src_ctx,
78 lldb::clang_type_t type)
79{
80 lldb::clang_type_t result = CopyType(dst_ctx, src_ctx, type);
81
82 if (!result)
83 return NULL;
84
85 QualType qual_type = QualType::getFromOpaquePtr(type);
86
87 if (const TagType *tag_type = qual_type->getAs<TagType>())
88 {
89 TagDecl *tag_decl = tag_type->getDecl();
90 const TagType *result_tag_type = QualType::getFromOpaquePtr(result)->getAs<TagType>();
91 TagDecl *result_tag_decl = result_tag_type->getDecl();
92
93 if (tag_decl)
94 {
95 MinionSP minion_sp (GetMinion (dst_ctx, src_ctx));
96
Sean Callanancbbe3ac2012-01-13 22:55:55 +000097 minion_sp->ImportDefinitionTo(result_tag_decl, tag_decl);
Sean Callananbb120042011-12-16 21:06:35 +000098
99 ASTContextMetadataSP to_context_md = GetContextMetadata(dst_ctx);
100
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000101 OriginMap::iterator oi = to_context_md->m_origins.find(result_tag_decl);
102
103 if (oi != to_context_md->m_origins.end() &&
104 oi->second.ctx == src_ctx)
105 to_context_md->m_origins.erase(oi);
Sean Callananbb120042011-12-16 21:06:35 +0000106 }
107 }
108
109 return result;
110}
111
Sean Callanan0eed0d42011-12-06 03:41:14 +0000112clang::Decl *
113ClangASTImporter::DeportDecl (clang::ASTContext *dst_ctx,
114 clang::ASTContext *src_ctx,
115 clang::Decl *decl)
116{
117 clang::Decl *result = CopyDecl(dst_ctx, src_ctx, decl);
118
119 if (!result)
120 return NULL;
121
122 ClangASTContext::GetCompleteDecl (src_ctx, decl);
123
124 MinionSP minion_sp (GetMinion (dst_ctx, src_ctx));
125
126 if (minion_sp && isa<TagDecl>(decl))
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000127 minion_sp->ImportDefinitionTo(result, decl);
Sean Callanan0eed0d42011-12-06 03:41:14 +0000128
129 ASTContextMetadataSP to_context_md = GetContextMetadata(dst_ctx);
130
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000131 OriginMap::iterator oi = to_context_md->m_origins.find(decl);
132
133 if (oi != to_context_md->m_origins.end() &&
134 oi->second.ctx == src_ctx)
135 to_context_md->m_origins.erase(oi);
Sean Callanan0eed0d42011-12-06 03:41:14 +0000136
137 return result;
138}
139
Sean Callanan12014a02011-12-08 23:45:45 +0000140bool
Sean Callanancc427fa2011-07-30 02:42:06 +0000141ClangASTImporter::CompleteTagDecl (clang::TagDecl *decl)
Sean Callanan12014a02011-12-08 23:45:45 +0000142{
Sean Callanancc427fa2011-07-30 02:42:06 +0000143 DeclOrigin decl_origin = GetDeclOrigin(decl);
Greg Claytona2721472011-06-25 00:44:06 +0000144
Sean Callanancc427fa2011-07-30 02:42:06 +0000145 if (!decl_origin.Valid())
Sean Callanan12014a02011-12-08 23:45:45 +0000146 return false;
Greg Claytona2721472011-06-25 00:44:06 +0000147
Sean Callanancc427fa2011-07-30 02:42:06 +0000148 if (!ClangASTContext::GetCompleteDecl(decl_origin.ctx, decl_origin.decl))
Sean Callanan12014a02011-12-08 23:45:45 +0000149 return false;
Greg Claytona2721472011-06-25 00:44:06 +0000150
Sean Callanan686b2312011-11-16 18:20:47 +0000151 MinionSP minion_sp (GetMinion(&decl->getASTContext(), decl_origin.ctx));
Greg Claytona2721472011-06-25 00:44:06 +0000152
Greg Claytondd0649b2011-07-06 18:55:08 +0000153 if (minion_sp)
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000154 minion_sp->ImportDefinitionTo(decl, decl_origin.decl);
155
Sean Callanan12014a02011-12-08 23:45:45 +0000156 return true;
Greg Claytona2721472011-06-25 00:44:06 +0000157}
Sean Callanancc427fa2011-07-30 02:42:06 +0000158
Sean Callanan12014a02011-12-08 23:45:45 +0000159bool
160ClangASTImporter::CompleteTagDeclWithOrigin(clang::TagDecl *decl, clang::TagDecl *origin_decl)
161{
162 clang::ASTContext *origin_ast_ctx = &origin_decl->getASTContext();
163
164 if (!ClangASTContext::GetCompleteDecl(origin_ast_ctx, origin_decl))
165 return false;
166
167 MinionSP minion_sp (GetMinion(&decl->getASTContext(), origin_ast_ctx));
168
169 if (minion_sp)
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000170 minion_sp->ImportDefinitionTo(decl, origin_decl);
171
Sean Callanan12014a02011-12-08 23:45:45 +0000172 ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
173
174 OriginMap &origins = context_md->m_origins;
175
176 origins[decl] = DeclOrigin(origin_ast_ctx, origin_decl);
177
178 return true;
179}
180
181bool
Sean Callanancc427fa2011-07-30 02:42:06 +0000182ClangASTImporter::CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl)
183{
184 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
185
Sean Callanancc427fa2011-07-30 02:42:06 +0000186 DeclOrigin decl_origin = GetDeclOrigin(interface_decl);
187
188 if (!decl_origin.Valid())
Sean Callanan12014a02011-12-08 23:45:45 +0000189 return false;
Sean Callanancc427fa2011-07-30 02:42:06 +0000190
191 if (!ClangASTContext::GetCompleteDecl(decl_origin.ctx, decl_origin.decl))
Sean Callanan12014a02011-12-08 23:45:45 +0000192 return false;
Sean Callanancc427fa2011-07-30 02:42:06 +0000193
Sean Callanan686b2312011-11-16 18:20:47 +0000194 MinionSP minion_sp (GetMinion(&interface_decl->getASTContext(), decl_origin.ctx));
Sean Callanancc427fa2011-07-30 02:42:06 +0000195
196 if (minion_sp)
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000197 minion_sp->ImportDefinitionTo(interface_decl, decl_origin.decl);
198
Sean Callanan12014a02011-12-08 23:45:45 +0000199 return true;
Sean Callanancc427fa2011-07-30 02:42:06 +0000200}
201
Sean Callananf487bd82011-11-16 21:40:57 +0000202ClangASTImporter::DeclOrigin
203ClangASTImporter::GetDeclOrigin(const clang::Decl *decl)
204{
205 ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
206
207 OriginMap &origins = context_md->m_origins;
208
209 OriginMap::iterator iter = origins.find(decl);
210
211 if (iter != origins.end())
212 return iter->second;
213 else
214 return DeclOrigin();
215}
216
Sean Callanan503aa522011-10-12 00:12:34 +0000217void
218ClangASTImporter::RegisterNamespaceMap(const clang::NamespaceDecl *decl,
219 NamespaceMapSP &namespace_map)
220{
Sean Callananf487bd82011-11-16 21:40:57 +0000221 ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
222
223 context_md->m_namespace_maps[decl] = namespace_map;
Sean Callanan503aa522011-10-12 00:12:34 +0000224}
225
226ClangASTImporter::NamespaceMapSP
227ClangASTImporter::GetNamespaceMap(const clang::NamespaceDecl *decl)
228{
Sean Callananf487bd82011-11-16 21:40:57 +0000229 ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
230
231 NamespaceMetaMap &namespace_maps = context_md->m_namespace_maps;
Sean Callanan503aa522011-10-12 00:12:34 +0000232
Sean Callananf487bd82011-11-16 21:40:57 +0000233 NamespaceMetaMap::iterator iter = namespace_maps.find(decl);
234
235 if (iter != namespace_maps.end())
Sean Callanan503aa522011-10-12 00:12:34 +0000236 return iter->second;
237 else
238 return NamespaceMapSP();
239}
240
Sean Callananb2269162011-10-21 22:18:07 +0000241void
242ClangASTImporter::BuildNamespaceMap(const clang::NamespaceDecl *decl)
243{
Sean Callananf487bd82011-11-16 21:40:57 +0000244 ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
245
Sean Callananb2269162011-10-21 22:18:07 +0000246 const DeclContext *parent_context = decl->getDeclContext();
247 const NamespaceDecl *parent_namespace = dyn_cast<NamespaceDecl>(parent_context);
248 NamespaceMapSP parent_map;
249
250 if (parent_namespace)
251 parent_map = GetNamespaceMap(parent_namespace);
252
253 NamespaceMapSP new_map;
254
255 new_map.reset(new NamespaceMap);
256
Sean Callananf487bd82011-11-16 21:40:57 +0000257 if (context_md->m_map_completer)
Sean Callananb2269162011-10-21 22:18:07 +0000258 {
259 std::string namespace_string = decl->getDeclName().getAsString();
260
Sean Callananf487bd82011-11-16 21:40:57 +0000261 context_md->m_map_completer->CompleteNamespaceMap (new_map, ConstString(namespace_string.c_str()), parent_map);
Sean Callananb2269162011-10-21 22:18:07 +0000262 }
263
Sean Callanan0eed0d42011-12-06 03:41:14 +0000264 context_md->m_namespace_maps[decl] = new_map;
Sean Callananb2269162011-10-21 22:18:07 +0000265}
266
Sean Callanan686b2312011-11-16 18:20:47 +0000267void
Sean Callanan99732312011-11-29 00:42:02 +0000268ClangASTImporter::ForgetDestination (clang::ASTContext *dst_ast)
Sean Callanan686b2312011-11-16 18:20:47 +0000269{
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000270 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
271
272 if (log)
273 log->Printf(" [ClangASTImporter] Forgetting destination (ASTContext*)%p", dst_ast);
274
Sean Callananf487bd82011-11-16 21:40:57 +0000275 m_metadata_map.erase(dst_ast);
Sean Callanan686b2312011-11-16 18:20:47 +0000276}
277
Sean Callanan99732312011-11-29 00:42:02 +0000278void
279ClangASTImporter::ForgetSource (clang::ASTContext *dst_ast, clang::ASTContext *src_ast)
280{
281 ASTContextMetadataSP md = MaybeGetContextMetadata (dst_ast);
282
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000283 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
284
285 if (log)
286 log->Printf(" [ClangASTImporter] Forgetting source->dest (ASTContext*)%p->(ASTContext*)%p", src_ast, dst_ast);
287
Sean Callanan99732312011-11-29 00:42:02 +0000288 if (!md)
289 return;
290
291 md->m_minions.erase(src_ast);
292
293 for (OriginMap::iterator iter = md->m_origins.begin();
294 iter != md->m_origins.end();
295 )
296 {
297 if (iter->second.ctx == src_ast)
298 md->m_origins.erase(iter++);
299 else
300 ++iter;
301 }
302}
303
Sean Callanan0eed0d42011-12-06 03:41:14 +0000304ClangASTImporter::MapCompleter::~MapCompleter ()
Sean Callananb2269162011-10-21 22:18:07 +0000305{
306 return;
307}
308
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000309void
310ClangASTImporter::Minion::ImportDefinitionTo (clang::Decl *to, clang::Decl *from)
311{
312 ASTImporter::Imported(from, to);
313
314 ImportDefinition(from);
Sean Callanan2e93a2a2012-01-19 18:23:06 +0000315
316 // If we're dealing with an Objective-C class, ensure that the inheritance has
317 // been set up correctly. The ASTImporter may not do this correctly if the
318 // class was originally sourced from symbols.
319
320 if (ObjCInterfaceDecl *to_objc_interface = dyn_cast<ObjCInterfaceDecl>(to))
321 {
322 do
323 {
324 ObjCInterfaceDecl *to_superclass = to_objc_interface->getSuperClass();
325
326 if (to_superclass)
327 break; // we're not going to override it if it's set
328
329 ObjCInterfaceDecl *from_objc_interface = dyn_cast<ObjCInterfaceDecl>(from);
330
331 if (!from_objc_interface)
332 break;
333
334 ObjCInterfaceDecl *from_superclass = from_objc_interface->getSuperClass();
335
336 if (!from_superclass)
337 break;
338
339 Decl *imported_from_superclass_decl = Import(from_superclass);
340
341 if (!imported_from_superclass_decl)
342 break;
343
344 ObjCInterfaceDecl *imported_from_superclass = dyn_cast<ObjCInterfaceDecl>(imported_from_superclass_decl);
345
346 if (!imported_from_superclass)
347 break;
348
349 to_objc_interface->setSuperClass(imported_from_superclass);
350 }
351 while (0);
352 }
Sean Callanancbbe3ac2012-01-13 22:55:55 +0000353}
354
Sean Callanancc427fa2011-07-30 02:42:06 +0000355clang::Decl
356*ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to)
357{
358 lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Sean Callanan00f43622011-11-18 03:28:09 +0000359
360 if (log)
361 {
362 if (NamedDecl *from_named_decl = dyn_cast<clang::NamedDecl>(from))
363 {
364 log->Printf(" [ClangASTImporter] Imported (%sDecl*)%p, named %s (from (Decl*)%p)",
365 from->getDeclKindName(),
366 to,
367 from_named_decl->getName().str().c_str(),
368 from);
369 }
370 else
371 {
372 log->Printf(" [ClangASTImporter] Imported (%sDecl*)%p (from (Decl*)%p)",
373 from->getDeclKindName(),
374 to,
375 from);
376 }
377 }
378
Sean Callananb0b87a52011-11-16 22:23:28 +0000379 ASTContextMetadataSP to_context_md = m_master.GetContextMetadata(&to->getASTContext());
380 ASTContextMetadataSP from_context_md = m_master.MaybeGetContextMetadata(m_source_ctx);
Sean Callananf487bd82011-11-16 21:40:57 +0000381
Sean Callananb0b87a52011-11-16 22:23:28 +0000382 if (from_context_md)
383 {
384 OriginMap &origins = from_context_md->m_origins;
385
386 OriginMap::iterator origin_iter = origins.find(from);
387
388 if (origin_iter != origins.end())
Sean Callanan00f43622011-11-18 03:28:09 +0000389 {
Sean Callananb0b87a52011-11-16 22:23:28 +0000390 to_context_md->m_origins[to] = origin_iter->second;
Sean Callanan00f43622011-11-18 03:28:09 +0000391
Sean Callanan5bc5a762011-12-20 23:55:47 +0000392 MinionSP direct_completer = m_master.GetMinion(&to->getASTContext(), origin_iter->second.ctx);
393
394 if (direct_completer.get() != this)
395 direct_completer->ASTImporter::Imported(origin_iter->second.decl, to);
396
Sean Callanan00f43622011-11-18 03:28:09 +0000397 if (log)
398 log->Printf(" [ClangASTImporter] Propagated origin (Decl*)%p/(ASTContext*)%p from (ASTContext*)%p to (ASTContext*)%p",
399 origin_iter->second.decl,
400 origin_iter->second.ctx,
401 &from->getASTContext(),
402 &to->getASTContext());
403 }
404 else
405 {
Sean Callanan0eed0d42011-12-06 03:41:14 +0000406 to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from);
407
Sean Callanan00f43622011-11-18 03:28:09 +0000408 if (log)
409 log->Printf(" [ClangASTImporter] Decl has no origin information in (ASTContext*)%p",
410 &from->getASTContext());
411 }
Sean Callananb0b87a52011-11-16 22:23:28 +0000412
413 if (clang::NamespaceDecl *to_namespace = dyn_cast<clang::NamespaceDecl>(to))
414 {
415 clang::NamespaceDecl *from_namespace = dyn_cast<clang::NamespaceDecl>(from);
416
417 NamespaceMetaMap &namespace_maps = from_context_md->m_namespace_maps;
418
419 NamespaceMetaMap::iterator namespace_map_iter = namespace_maps.find(from_namespace);
420
421 if (namespace_map_iter != namespace_maps.end())
422 to_context_md->m_namespace_maps[to_namespace] = namespace_map_iter->second;
423 }
424 }
425 else
426 {
427 to_context_md->m_origins[to] = DeclOrigin (m_source_ctx, from);
Sean Callanan00f43622011-11-18 03:28:09 +0000428
429 if (log)
430 log->Printf(" [ClangASTImporter] Sourced origin (Decl*)%p/(ASTContext*)%p into (ASTContext*)%p",
431 from,
432 m_source_ctx,
433 &to->getASTContext());
Sean Callananb0b87a52011-11-16 22:23:28 +0000434 }
435
Sean Callanancc427fa2011-07-30 02:42:06 +0000436 if (TagDecl *from_tag_decl = dyn_cast<TagDecl>(from))
437 {
438 TagDecl *to_tag_decl = dyn_cast<TagDecl>(to);
439
440 to_tag_decl->setHasExternalLexicalStorage();
Sean Callanan0730e9c2011-11-09 19:33:21 +0000441
Sean Callanancc427fa2011-07-30 02:42:06 +0000442 if (log)
Sean Callanan00f43622011-11-18 03:28:09 +0000443 log->Printf(" [ClangASTImporter] To is a TagDecl - attributes %s%s [%s->%s]",
Sean Callanancc427fa2011-07-30 02:42:06 +0000444 (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
Sean Callanan0730e9c2011-11-09 19:33:21 +0000445 (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : ""),
446 (from_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"),
447 (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
Sean Callanan00f43622011-11-18 03:28:09 +0000448
449 to_tag_decl = NULL;
Sean Callanancc427fa2011-07-30 02:42:06 +0000450 }
451
Sean Callananb2269162011-10-21 22:18:07 +0000452 if (isa<NamespaceDecl>(from))
453 {
454 NamespaceDecl *to_namespace_decl = dyn_cast<NamespaceDecl>(to);
455
456 m_master.BuildNamespaceMap(to_namespace_decl);
457
458 to_namespace_decl->setHasExternalVisibleStorage();
459 }
460
Sean Callanan00f43622011-11-18 03:28:09 +0000461 if (isa<ObjCInterfaceDecl>(from))
Sean Callanancc427fa2011-07-30 02:42:06 +0000462 {
463 ObjCInterfaceDecl *to_interface_decl = dyn_cast<ObjCInterfaceDecl>(to);
Sean Callanana9bc0652012-01-19 02:17:40 +0000464
Sean Callanand5c17ed2011-11-15 02:11:17 +0000465 to_interface_decl->setHasExternalLexicalStorage();
Sean Callanan0730e9c2011-11-09 19:33:21 +0000466 to_interface_decl->setHasExternalVisibleStorage();
467
Sean Callanand5c17ed2011-11-15 02:11:17 +0000468 if (to_interface_decl->isForwardDecl())
469 to_interface_decl->completedForwardDecl();
Sean Callananbb120042011-12-16 21:06:35 +0000470
Sean Callanand5c17ed2011-11-15 02:11:17 +0000471 to_interface_decl->setExternallyCompleted();
Sean Callanan0eed0d42011-12-06 03:41:14 +0000472
Sean Callanand5c17ed2011-11-15 02:11:17 +0000473 if (log)
Sean Callanan00f43622011-11-18 03:28:09 +0000474 log->Printf(" [ClangASTImporter] To is an ObjCInterfaceDecl - attributes %s%s%s",
Sean Callanand5c17ed2011-11-15 02:11:17 +0000475 (to_interface_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
476 (to_interface_decl->hasExternalVisibleStorage() ? " Visible" : ""),
477 (to_interface_decl->isForwardDecl() ? " Forward" : ""));
Sean Callanancc427fa2011-07-30 02:42:06 +0000478 }
479
480 return clang::ASTImporter::Imported(from, to);
Greg Clayton3418c852011-08-10 02:10:13 +0000481}