Add GoASTContext and DWARFASTParserGo to support go.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Just a few cleanups to do mentioned in the inlined comments.
include/lldb/Core/Module.h | ||
---|---|---|
950 ↗ | (On Diff #33899) | We should remove this and just use Module::GetTypeSystemForLanguage(...) to get at this. Then from the type system you can say "type_system->GetAsGoASTContext()". ClangASTContext has been special because we started out thinking this would be the one and only type system we would ever use in the debugger and the "Module::GetClangASTContext()" should be removed. I will do that in a future patch, but for now,remove this function and use "Module::GetTypeSystemForLanguage(eLanguageTypeGo)" when you need it. |
include/lldb/Symbol/ClangASTContext.h | ||
489–493 ↗ | (On Diff #33899) | Add "TypeSystem::AsXXXASTContext()" functions should have a default implementation in the TypeSystem base class which returns nullptr so every other TypeSystem doesn't have to implement the function and return nullptr. |
include/lldb/Symbol/CompilerType.h | ||
21 ↗ | (On Diff #33899) | indent one level |
include/lldb/lldb-forward.h | ||
102 ↗ | (On Diff #33899) | there must be a tab here? We use spaces in LLDB, so please space out to match other indentation. |
source/Core/Module.cpp | ||
27 ↗ | (On Diff #33899) | Remove this duplicate include and use the one below. |
152 ↗ | (On Diff #33899) | Default construct so it is null until a call to Module::GetTypeSystemForLanguage() with eLanguageTypeGo is passed in. We can eventually make the TypeSystem objects into plug-ins, but for now we can hard code this. We are going to remove "GoASTContext &Module::GetGoASTContext()" in favor of using Module::GetTypeSystemForLanguage(eLanguageTypeGo) so we don't need to construct one as we don't need to return an reference. |
258 ↗ | (On Diff #33899) | Default construct so it is null until a call to Module::GetTypeSystemForLanguage() with eLanguageTypeGo is passed in. We can eventually make the TypeSystem objects into plug-ins, but for now we can hard code this. We are going to remove "GoASTContext &Module::GetGoASTContext()" in favor of using Module::GetTypeSystemForLanguage(eLanguageTypeGo) so we don't need to construct one as we don't need to return an reference. |
306 ↗ | (On Diff #33899) | Default construct so it is null until a call to Module::GetTypeSystemForLanguage() with eLanguageTypeGo is passed in. We can eventually make the TypeSystem objects into plug-ins, but for now we can hard code this. We are going to remove "GoASTContext &Module::GetGoASTContext()" in favor of using Module::GetTypeSystemForLanguage(eLanguageTypeGo) so we don't need to construct one as we don't need to return an reference. |
432 ↗ | (On Diff #33899) | This code will now check for m_go_ast and if it is NULL, then it will construct a GoASTContext and place it into m_go_ast. This allows us to create GoASTContext on demand. |
480–495 ↗ | (On Diff #33899) | Remove this and move initialization into Module::GetTypeSystemForLanguage() inside the Go language if clause. We probably don't need the m_did_init_go member variable anymore since you can key off of the m_go_ast being NULL to know that you need to init this. |
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | ||
513–514 ↗ | (On Diff #33899) | These two lines can be moved into the else clause since we only need to manually set the type system if we actually get the type system from the module. So this code should be: SymbolFileDWARFDebugMap * debug_map_symfile = GetDebugMapSymfile (); TypeSystem *type_system; if (debug_map_symfile) type_system = debug_map_symfile->GetTypeSystemForLanguage(language); else { type_system = m_obj_file->GetModule()->GetTypeSystemForLanguage(language); if (type_system) type_system->SetSymbolFile(this); } |
source/Symbol/ClangASTContext.cpp | ||
3042 ↗ | (On Diff #33899) | Feel free to add a function like: bool CompilerType::IsClangType (); So we don't have to have code like above: if (type && type.GetTypeSystem()->AsClangASTContext()) And we can just change all of these to: if (type.IsClangType()) |
Looks good.
include/lldb/Symbol/ClangASTContext.h | ||
---|---|---|
484 ↗ | (On Diff #34042) | remove this space diff |