summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r--lldb/source/Expression/ASTResultSynthesizer.cpp31
-rw-r--r--lldb/source/Expression/ASTStructExtractor.cpp5
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp17
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp13
-rw-r--r--lldb/source/Expression/ClangExpressionParser.cpp21
-rw-r--r--lldb/source/Expression/IRDynamicChecks.cpp2
-rw-r--r--lldb/source/Expression/IRForTarget.cpp18
-rw-r--r--lldb/source/Expression/IRToDWARF.cpp2
8 files changed, 58 insertions, 51 deletions
diff --git a/lldb/source/Expression/ASTResultSynthesizer.cpp b/lldb/source/Expression/ASTResultSynthesizer.cpp
index f03430bc491..0cdcf2a110d 100644
--- a/lldb/source/Expression/ASTResultSynthesizer.cpp
+++ b/lldb/source/Expression/ASTResultSynthesizer.cpp
@@ -14,9 +14,7 @@
#include "clang/AST/DeclGroup.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Stmt.h"
-#include "clang/Parse/Action.h"
#include "clang/Parse/Parser.h"
-#include "clang/Parse/Scope.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include "lldb/Core/Log.h"
@@ -30,8 +28,7 @@ ASTResultSynthesizer::ASTResultSynthesizer(ASTConsumer *passthrough) :
m_ast_context (NULL),
m_passthrough (passthrough),
m_passthrough_sema (NULL),
- m_sema (NULL),
- m_action (NULL)
+ m_sema (NULL)
{
if (!m_passthrough)
return;
@@ -73,8 +70,7 @@ ASTResultSynthesizer::TransformTopLevelDecl(Decl* D)
if (m_ast_context &&
function_decl &&
- !strcmp(function_decl->getNameAsCString(),
- "___clang_expr"))
+ !function_decl->getNameInfo().getAsString().compare("___clang_expr"))
{
SynthesizeResult(function_decl);
}
@@ -176,8 +172,8 @@ ASTResultSynthesizer::SynthesizeResult (FunctionDecl *FunDecl)
&result_id,
expr_qual_type,
NULL,
- VarDecl::Static,
- VarDecl::Static);
+ SC_Static,
+ SC_Static);
if (!result_decl)
return false;
@@ -187,27 +183,24 @@ ASTResultSynthesizer::SynthesizeResult (FunctionDecl *FunDecl)
///////////////////////////////
// call AddInitializerToDecl
//
-
- Parser::DeclPtrTy result_decl_ptr;
- result_decl_ptr.set(result_decl);
-
- m_action->AddInitializerToDecl(result_decl_ptr, Parser::ExprArg(*m_action, last_expr));
+
+ m_sema->AddInitializerToDecl(result_decl, last_expr);
/////////////////////////////////
// call ConvertDeclToDeclGroup
//
- Parser::DeclGroupPtrTy result_decl_group_ptr;
+ Sema::DeclGroupPtrTy result_decl_group_ptr;
- result_decl_group_ptr = m_action->ConvertDeclToDeclGroup(result_decl_ptr);
+ result_decl_group_ptr = m_sema->ConvertDeclToDeclGroup(result_decl);
////////////////////////
// call ActOnDeclStmt
//
- Parser::OwningStmtResult result_initialization_stmt_result(m_action->ActOnDeclStmt(result_decl_group_ptr,
- SourceLocation(),
- SourceLocation()));
+ StmtResult result_initialization_stmt_result(m_sema->ActOnDeclStmt(result_decl_group_ptr,
+ SourceLocation(),
+ SourceLocation()));
////////////////////////////////////////////////
// replace the old statement with the new one
@@ -269,7 +262,6 @@ void
ASTResultSynthesizer::InitializeSema(Sema &S)
{
m_sema = &S;
- m_action = reinterpret_cast<Action*>(m_sema);
if (m_passthrough_sema)
m_passthrough_sema->InitializeSema(S);
@@ -279,7 +271,6 @@ void
ASTResultSynthesizer::ForgetSema()
{
m_sema = NULL;
- m_action = NULL;
if (m_passthrough_sema)
m_passthrough_sema->ForgetSema();
diff --git a/lldb/source/Expression/ASTStructExtractor.cpp b/lldb/source/Expression/ASTStructExtractor.cpp
index 84a97c8e5df..8635ffe6ce2 100644
--- a/lldb/source/Expression/ASTStructExtractor.cpp
+++ b/lldb/source/Expression/ASTStructExtractor.cpp
@@ -15,9 +15,8 @@
#include "clang/AST/Expr.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/Stmt.h"
-#include "clang/Parse/Action.h"
#include "clang/Parse/Parser.h"
-#include "clang/Parse/Scope.h"
+#include "clang/Sema/Sema.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include "lldb/Core/Log.h"
@@ -111,7 +110,7 @@ ASTStructExtractor::ExtractFromTopLevelDecl(Decl* D)
if (m_ast_context &&
function_decl &&
- !m_function.m_wrapper_function_name.compare(function_decl->getNameAsCString()))
+ !m_function.m_wrapper_function_name.compare(function_decl->getNameAsString().c_str()))
{
ExtractFromFunctionDecl(function_decl);
}
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 423f759be40..3d71da5341f 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -74,6 +74,11 @@ DeclContext::lookup_result ClangASTSource::FindExternalVisibleDeclsByName(const
return SetExternalVisibleDeclsForName(DC, Name, Decls);
}
+void ClangASTSource::MaterializeVisibleDecls(const DeclContext *DC)
+{
+ return;
+}
+
// This is used to support iterating through an entire lexical context,
// which isn't something the debugger should ever need to do.
bool ClangASTSource::FindExternalLexicalDecls(const DeclContext *DC, llvm::SmallVectorImpl<Decl*> &Decls) {
@@ -94,8 +99,8 @@ clang::NamedDecl *NameSearchContext::AddVarDecl(void *type) {
ii,
QualType::getFromOpaquePtr(type),
0,
- VarDecl::Static,
- VarDecl::Static);
+ SC_Static,
+ SC_Static);
Decls.push_back(Decl);
return Decl;
@@ -108,8 +113,8 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(void *type) {
Name.getAsIdentifierInfo(),
QualType::getFromOpaquePtr(type),
NULL,
- FunctionDecl::Static,
- FunctionDecl::Static,
+ SC_Static,
+ SC_Static,
false,
true);
@@ -138,8 +143,8 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(void *type) {
NULL,
ArgQT,
NULL,
- ParmVarDecl::Static,
- ParmVarDecl::Static,
+ SC_Static,
+ SC_Static,
NULL);
}
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index bed235241ee..189249f5680 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -13,6 +13,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "clang/AST/DeclarationName.h"
#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Error.h"
@@ -1205,12 +1206,12 @@ ClangExpressionDeclMap::AddOneType(NameSearchContext &context,
false,
ClangASTContext::GetTypeQualifiers(copied_type));
- ClangASTContext::AddMethodToCXXRecordType (parser_ast_context,
- copied_type,
- "___clang_expr",
- method_type,
- lldb::eAccessPublic,
- false);
+ ClangASTContext::AddMethodToCXXRecordType(parser_ast_context,
+ copied_type,
+ "___clang_expr",
+ method_type,
+ lldb::eAccessPublic,
+ false);
}
context.AddTypeDecl(copied_type);
diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp
index 90598063add..ec385a4cd04 100644
--- a/lldb/source/Expression/ClangExpressionParser.cpp
+++ b/lldb/source/Expression/ClangExpressionParser.cpp
@@ -43,8 +43,8 @@
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Frontend/VerifyDiagnosticsClient.h"
#include "clang/Lex/Preprocessor.h"
+#include "clang/Parse/ParseAST.h"
#include "clang/Rewrite/FrontendActions.h"
-#include "clang/Sema/ParseAST.h"
#include "clang/Sema/SemaConsumer.h"
#include "llvm/ADT/StringRef.h"
@@ -239,8 +239,7 @@ ClangExpressionParser::ClangExpressionParser(const char *target_triple,
// 4. Set up the diagnostic buffer for reporting errors
- m_diagnostic_buffer.reset(new clang::TextDiagnosticBuffer);
- m_compiler->getDiagnostics().setClient(m_diagnostic_buffer.get());
+ m_compiler->getDiagnostics().setClient(new clang::TextDiagnosticBuffer);
// 5. Set up the source management objects inside the compiler
@@ -288,12 +287,14 @@ ClangExpressionParser::~ClangExpressionParser()
unsigned
ClangExpressionParser::Parse (Stream &stream)
{
- m_diagnostic_buffer->FlushDiagnostics (m_compiler->getDiagnostics());
+ TextDiagnosticBuffer *diag_buf = static_cast<TextDiagnosticBuffer*>(m_compiler->getDiagnostics().getClient());
+
+ diag_buf->FlushDiagnostics (m_compiler->getDiagnostics());
MemoryBuffer *memory_buffer = MemoryBuffer::getMemBufferCopy(m_expr.Text(), __FUNCTION__);
FileID memory_buffer_file_id = m_compiler->getSourceManager().createMainFileIDForMemBuffer (memory_buffer);
- m_diagnostic_buffer->BeginSourceFile(m_compiler->getLangOpts(), &m_compiler->getPreprocessor());
+ diag_buf->BeginSourceFile(m_compiler->getLangOpts(), &m_compiler->getPreprocessor());
ASTConsumer *ast_transformer = m_expr.ASTTransformer(m_code_generator.get());
@@ -302,21 +303,21 @@ ClangExpressionParser::Parse (Stream &stream)
else
ParseAST(m_compiler->getPreprocessor(), m_code_generator.get(), m_compiler->getASTContext());
- m_diagnostic_buffer->EndSourceFile();
+ diag_buf->EndSourceFile();
TextDiagnosticBuffer::const_iterator diag_iterator;
int num_errors = 0;
- for (diag_iterator = m_diagnostic_buffer->warn_begin();
- diag_iterator != m_diagnostic_buffer->warn_end();
+ for (diag_iterator = diag_buf->warn_begin();
+ diag_iterator != diag_buf->warn_end();
++diag_iterator)
stream.Printf("warning: %s\n", (*diag_iterator).second.c_str());
num_errors = 0;
- for (diag_iterator = m_diagnostic_buffer->err_begin();
- diag_iterator != m_diagnostic_buffer->err_end();
+ for (diag_iterator = diag_buf->err_begin();
+ diag_iterator != diag_buf->err_end();
++diag_iterator)
{
num_errors++;
diff --git a/lldb/source/Expression/IRDynamicChecks.cpp b/lldb/source/Expression/IRDynamicChecks.cpp
index b5a706d67ec..53cabcb11fa 100644
--- a/lldb/source/Expression/IRDynamicChecks.cpp
+++ b/lldb/source/Expression/IRDynamicChecks.cpp
@@ -478,7 +478,7 @@ private:
IRDynamicChecks::IRDynamicChecks(DynamicCheckerFunctions &checker_functions,
const char *func_name) :
- ModulePass(&ID),
+ ModulePass(ID),
m_checker_functions(checker_functions),
m_func_name(func_name)
{
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp
index cec358381d5..626cd547bfe 100644
--- a/lldb/source/Expression/IRForTarget.cpp
+++ b/lldb/source/Expression/IRForTarget.cpp
@@ -34,7 +34,7 @@ IRForTarget::IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map,
const TargetData *target_data,
bool resolve_vars,
const char *func_name) :
- ModulePass(&ID),
+ ModulePass(ID),
m_decl_map(decl_map),
m_target_data(target_data),
m_sel_registerName(NULL),
@@ -728,12 +728,22 @@ IRForTarget::resolveExternals(Module &M, BasicBlock &BB)
static bool isGuardVariableRef(Value *V)
{
- ConstantExpr *C = dyn_cast<ConstantExpr>(V);
+ Constant *C;
- if (!C || C->getOpcode() != Instruction::BitCast)
+ if (!(C = dyn_cast<Constant>(V)))
return false;
- GlobalVariable *GV = dyn_cast<GlobalVariable>(C->getOperand(0));
+ ConstantExpr *CE;
+
+ if ((CE = dyn_cast<ConstantExpr>(V)))
+ {
+ if (CE->getOpcode() != Instruction::BitCast)
+ return false;
+
+ C = CE->getOperand(0);
+ }
+
+ GlobalVariable *GV = dyn_cast<GlobalVariable>(C);
if (!GV || !GV->hasName() || !GV->getName().startswith("_ZGV"))
return false;
diff --git a/lldb/source/Expression/IRToDWARF.cpp b/lldb/source/Expression/IRToDWARF.cpp
index b158da6c1f5..d4a4a3fbc24 100644
--- a/lldb/source/Expression/IRToDWARF.cpp
+++ b/lldb/source/Expression/IRToDWARF.cpp
@@ -30,7 +30,7 @@ IRToDWARF::IRToDWARF(lldb_private::ClangExpressionVariableStore &local_vars,
lldb_private::ClangExpressionDeclMap *decl_map,
lldb_private::StreamString &strm,
const char *func_name) :
- ModulePass(&ID),
+ ModulePass(ID),
m_local_vars(local_vars),
m_decl_map(decl_map),
m_strm(strm),
OpenPOWER on IntegriCloud