@@ -196,9 +196,12 @@ namespace {
196
196
// / the type.
197
197
class Completer : public clang ::RecursiveASTVisitor<Completer> {
198
198
private:
199
- clang::ASTImporter &m_exporter; // / Used to import Decl contents
200
- clang::FileID m_file; // / The file that's going away
201
- llvm::DenseSet<clang::Decl *> m_completed; // / Visited Decls, to avoid cycles
199
+ // / Used to import Decl contents
200
+ clang::ASTImporter &m_exporter;
201
+ // / The file that's going away
202
+ clang::FileID m_file;
203
+ // / Visited Decls, to avoid cycles
204
+ llvm::DenseSet<clang::Decl *> m_completed;
202
205
203
206
bool ImportAndCheckCompletable (clang::Decl *decl) {
204
207
(void )m_exporter.Import (decl);
@@ -237,7 +240,7 @@ class Completer : public clang::RecursiveASTVisitor<Completer> {
237
240
public:
238
241
Completer (clang::ASTImporter &exporter, clang::FileID file)
239
242
: m_exporter(exporter), m_file(file) {}
240
-
243
+
241
244
// Implements the RecursiveASTVisitor's core API. It is called on each Decl
242
245
// that the RecursiveASTVisitor encounters, and returns true if the traversal
243
246
// should continue.
@@ -246,11 +249,10 @@ class Completer : public clang::RecursiveASTVisitor<Completer> {
246
249
return true ;
247
250
}
248
251
};
249
- }
252
+ } // namespace
250
253
251
254
static void CompleteAllDeclContexts (clang::ASTImporter &exporter,
252
- clang::FileID file,
253
- clang::QualType root) {
255
+ clang::FileID file, clang::QualType root) {
254
256
clang::QualType canonical_type = root.getCanonicalType ();
255
257
if (clang::TagDecl *tag_decl = canonical_type->getAsTagDecl ()) {
256
258
Completer (exporter, file).TraverseDecl (tag_decl);
@@ -263,12 +265,12 @@ static void CompleteAllDeclContexts(clang::ASTImporter &exporter,
263
265
}
264
266
265
267
static clang::QualType ExportAllDeclaredTypes (
266
- clang::ExternalASTMerger &merger,
267
- clang::ASTContext &source, clang:: FileManager &source_file_manager,
268
+ clang::ExternalASTMerger &merger, clang::ASTContext &source,
269
+ clang::FileManager &source_file_manager,
268
270
const clang::ExternalASTMerger::OriginMap &source_origin_map,
269
271
clang::FileID file, clang::QualType root) {
270
- clang::ExternalASTMerger::ImporterSource importer_source =
271
- { source, source_file_manager, source_origin_map };
272
+ clang::ExternalASTMerger::ImporterSource importer_source = {
273
+ source, source_file_manager, source_origin_map};
272
274
merger.AddSources (importer_source);
273
275
clang::ASTImporter &exporter = merger.ImporterForOrigin (source);
274
276
CompleteAllDeclContexts (exporter, file, root);
@@ -286,10 +288,10 @@ static clang::QualType ExportAllDeclaredTypes(
286
288
TypeFromUser ClangExpressionDeclMap::DeportType (ClangASTContext &target,
287
289
ClangASTContext &source,
288
290
TypeFromParser parser_type) {
289
- assert (&target == m_target->GetScratchClangASTContext ());
290
- assert ((TypeSystem*)&source == parser_type.GetTypeSystem ());
291
- assert (source.getASTContext () == m_ast_context);
292
-
291
+ assert (&target == m_target->GetScratchClangASTContext ());
292
+ assert ((TypeSystem *)&source == parser_type.GetTypeSystem ());
293
+ assert (source.getASTContext () == m_ast_context);
294
+
293
295
if (m_ast_importer_sp) {
294
296
return TypeFromUser (m_ast_importer_sp->DeportType (
295
297
target.getASTContext (), source.getASTContext (),
@@ -299,13 +301,11 @@ TypeFromUser ClangExpressionDeclMap::DeportType(ClangASTContext &target,
299
301
clang::FileID source_file =
300
302
source.getASTContext ()->getSourceManager ().getFileID (
301
303
source.getASTContext ()->getTranslationUnitDecl ()->getLocation ());
302
- auto scratch_ast_context = static_cast <ClangASTContextForExpressions*>(
304
+ auto scratch_ast_context = static_cast <ClangASTContextForExpressions *>(
303
305
m_target->GetScratchClangASTContext ());
304
306
clang::QualType exported_type = ExportAllDeclaredTypes (
305
- scratch_ast_context->GetMergerUnchecked (),
306
- *source.getASTContext (), *source.getFileManager (),
307
- m_merger_up->GetOrigins (),
308
- source_file,
307
+ scratch_ast_context->GetMergerUnchecked (), *source.getASTContext (),
308
+ *source.getFileManager (), m_merger_up->GetOrigins (), source_file,
309
309
clang::QualType::getFromOpaquePtr (parser_type.GetOpaqueQualType ()));
310
310
return TypeFromUser (exported_type.getAsOpaquePtr (), &target);
311
311
} else {
@@ -828,7 +828,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
828
828
log->Printf (" CEDM::FEVD[%u] Inspecting (NamespaceMap*)%p (%d entries)" ,
829
829
current_id, static_cast <void *>(namespace_map.get ()),
830
830
(int )namespace_map->size ());
831
-
831
+
832
832
for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin (),
833
833
e = namespace_map->end ();
834
834
i != e; ++i) {
@@ -848,7 +848,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
848
848
FindExternalVisibleDecls (context, lldb::ModuleSP (), namespace_decl,
849
849
current_id);
850
850
}
851
-
851
+
852
852
ClangASTSource::FindExternalVisibleDecls (context);
853
853
}
854
854
@@ -1048,7 +1048,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
1048
1048
return ;
1049
1049
1050
1050
AddOneType (context, TypeFromUser (m_ctx_obj->GetCompilerType ()),
1051
- current_id);
1051
+ current_id);
1052
1052
1053
1053
m_struct_vars->m_object_pointer_type =
1054
1054
TypeFromUser (ctx_obj_ptr->GetCompilerType ());
@@ -1858,7 +1858,7 @@ bool ClangExpressionDeclMap::ResolveUnknownTypes() {
1858
1858
Target *target = m_parser_vars->m_exe_ctx .GetTargetPtr ();
1859
1859
1860
1860
ClangASTContextForExpressions *scratch_ast_context =
1861
- static_cast <ClangASTContextForExpressions*>(
1861
+ static_cast <ClangASTContextForExpressions *>(
1862
1862
target->GetScratchClangASTContext ());
1863
1863
1864
1864
for (size_t index = 0 , num_entities = m_found_entities.GetSize ();
@@ -1897,9 +1897,9 @@ bool ClangExpressionDeclMap::ResolveUnknownTypes() {
1897
1897
var_type.getAsOpaquePtr ());
1898
1898
} else if (HasMerger ()) {
1899
1899
copied_type = CopyTypeWithMerger (
1900
- var_decl->getASTContext (),
1901
- scratch_ast_context->GetMergerUnchecked (),
1902
- var_type) .getAsOpaquePtr ();
1900
+ var_decl->getASTContext (),
1901
+ scratch_ast_context->GetMergerUnchecked (), var_type)
1902
+ .getAsOpaquePtr ();
1903
1903
} else {
1904
1904
lldbassert (0 && " No mechanism to copy a resolved unknown type!" );
1905
1905
return false ;
@@ -2016,24 +2016,24 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
2016
2016
if (copied_function_template) {
2017
2017
if (log) {
2018
2018
ASTDumper ast_dumper ((clang::Decl *)copied_function_template);
2019
-
2019
+
2020
2020
StreamString ss;
2021
-
2021
+
2022
2022
function->DumpSymbolContext (&ss);
2023
-
2023
+
2024
2024
log->Printf (" CEDM::FEVD[%u] Imported decl for function template"
2025
2025
" %s (description %s), returned %s" ,
2026
2026
current_id,
2027
2027
copied_function_template->getNameAsString ().c_str (),
2028
2028
ss.GetData (), ast_dumper.GetCString ());
2029
2029
}
2030
-
2030
+
2031
2031
context.AddNamedDecl (copied_function_template);
2032
2032
}
2033
2033
} else if (src_function_decl) {
2034
2034
if (clang::FunctionDecl *copied_function_decl =
2035
2035
llvm::dyn_cast_or_null<clang::FunctionDecl>(
2036
- CopyDecl (src_function_decl))) {
2036
+ CopyDecl (src_function_decl))) {
2037
2037
if (log) {
2038
2038
ASTDumper ast_dumper ((clang::Decl *)copied_function_decl);
2039
2039
0 commit comments