From 3b96ebeee473c263a743066861687b320de3e6d6 Mon Sep 17 00:00:00 2001 From: Nathan Lanza Date: Wed, 17 Jul 2019 16:43:36 +0000 Subject: [PATCH] [NativePDB] Add a FromCompilerDecl for going from lldb -> clang Summary: A common transformation in NativePDB is to go from lldb types to clang types and vice versa. This function automates one of those steps. Differential Revision: https://reviews.llvm.org/D64851 llvm-svn: 366345 --- lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp | 4 ++++ lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h | 1 + 2 files changed, 5 insertions(+) diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp index eb8da2a51b6c..4991be8e70ce 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp @@ -1354,6 +1354,10 @@ PdbAstBuilder::ToCompilerDeclContext(clang::DeclContext &context) { return {&m_clang, &context}; } +clang::Decl * PdbAstBuilder::FromCompilerDecl(CompilerDecl decl) { + return static_cast(decl.GetOpaqueDecl()); +} + clang::DeclContext * PdbAstBuilder::FromCompilerDeclContext(CompilerDeclContext context) { return static_cast(context.GetOpaqueDeclContext()); diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h index 8331abeaf47d..67d024741e0d 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h @@ -76,6 +76,7 @@ public: CompilerDecl ToCompilerDecl(clang::Decl &decl); CompilerType ToCompilerType(clang::QualType qt); CompilerDeclContext ToCompilerDeclContext(clang::DeclContext &context); + clang::Decl * FromCompilerDecl(CompilerDecl decl); clang::DeclContext *FromCompilerDeclContext(CompilerDeclContext context); ClangASTContext &clang() { return m_clang; }