aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp')
-rw-r--r--source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index 4991be8e70ce..986b0b785d87 100644
--- a/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -121,13 +121,6 @@ AnyScopesHaveTemplateParams(llvm::ArrayRef<llvm::ms_demangle::Node *> scopes) {
return false;
}
-static ClangASTContext &GetClangASTContext(ObjectFile &obj) {
- TypeSystem *ts =
- obj.GetModule()->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- lldbassert(ts);
- return static_cast<ClangASTContext &>(*ts);
-}
-
static llvm::Optional<clang::CallingConv>
TranslateCallingConvention(llvm::codeview::CallingConvention conv) {
using CC = llvm::codeview::CallingConvention;
@@ -209,8 +202,8 @@ static bool IsAnonymousNamespaceName(llvm::StringRef name) {
return name == "`anonymous namespace'" || name == "`anonymous-namespace'";
}
-PdbAstBuilder::PdbAstBuilder(ObjectFile &obj, PdbIndex &index)
- : m_index(index), m_clang(GetClangASTContext(obj)) {
+PdbAstBuilder::PdbAstBuilder(ObjectFile &obj, PdbIndex &index, ClangASTContext &clang)
+ : m_index(index), m_clang(clang) {
BuildParentMap();
}
@@ -465,9 +458,9 @@ clang::Decl *PdbAstBuilder::GetOrCreateSymbolForId(PdbCompilandSymId id) {
}
}
-clang::Decl *PdbAstBuilder::GetOrCreateDeclForUid(PdbSymUid uid) {
+llvm::Optional<CompilerDecl> PdbAstBuilder::GetOrCreateDeclForUid(PdbSymUid uid) {
if (clang::Decl *result = TryGetDecl(uid))
- return result;
+ return ToCompilerDecl(*result);
clang::Decl *result = nullptr;
switch (uid.kind()) {
@@ -480,13 +473,13 @@ clang::Decl *PdbAstBuilder::GetOrCreateDeclForUid(PdbSymUid uid) {
result = tag;
break;
}
- return nullptr;
+ return llvm::None;
}
default:
- return nullptr;
+ return llvm::None;
}
m_uid_to_decl[toOpaqueUid(uid)] = result;
- return result;
+ return ToCompilerDecl(*result);
}
clang::DeclContext *PdbAstBuilder::GetOrCreateDeclContextForUid(PdbSymUid uid) {
@@ -494,8 +487,10 @@ clang::DeclContext *PdbAstBuilder::GetOrCreateDeclContextForUid(PdbSymUid uid) {
if (uid.asCompilandSym().offset == 0)
return FromCompilerDeclContext(GetTranslationUnitDecl());
}
-
- clang::Decl *decl = GetOrCreateDeclForUid(uid);
+ auto option = GetOrCreateDeclForUid(uid);
+ if (!option)
+ return nullptr;
+ clang::Decl *decl = FromCompilerDecl(option.getValue());
if (!decl)
return nullptr;
@@ -1089,7 +1084,7 @@ void PdbAstBuilder::CreateFunctionParameters(PdbCompilandSymId func_id,
CompilerType param_type_ct(&m_clang, qt.getAsOpaquePtr());
clang::ParmVarDecl *param = m_clang.CreateParameterDeclaration(
&function_decl, param_name.str().c_str(), param_type_ct,
- clang::SC_None);
+ clang::SC_None, true);
lldbassert(m_uid_to_decl.count(toOpaqueUid(param_uid)) == 0);
m_uid_to_decl[toOpaqueUid(param_uid)] = param;