diff options
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r-- | lldb/source/Expression/ClangExpressionDeclMap.cpp | 74 | ||||
-rw-r--r-- | lldb/source/Expression/ClangExpressionParser.cpp | 81 | ||||
-rw-r--r-- | lldb/source/Expression/ClangUserExpression.cpp | 28 | ||||
-rw-r--r-- | lldb/source/Expression/IRForTarget.cpp | 21 |
4 files changed, 51 insertions, 153 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 198fde93386..4a76871128b 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -1440,43 +1440,43 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, } } -static clang_type_t -MaybePromoteToBlockPointerType -( - ASTContext *ast_context, - clang_type_t candidate_type -) -{ - if (!candidate_type) - return candidate_type; - - QualType candidate_qual_type = QualType::getFromOpaquePtr(candidate_type); - - const PointerType *candidate_pointer_type = dyn_cast<PointerType>(candidate_qual_type); - - if (!candidate_pointer_type) - return candidate_type; - - QualType pointee_qual_type = candidate_pointer_type->getPointeeType(); - - const RecordType *pointee_record_type = dyn_cast<RecordType>(pointee_qual_type); - - if (!pointee_record_type) - return candidate_type; - - RecordDecl *pointee_record_decl = pointee_record_type->getDecl(); - - if (!pointee_record_decl->isRecord()) - return candidate_type; - - if (!pointee_record_decl->getName().startswith(llvm::StringRef("__block_literal_"))) - return candidate_type; - - QualType generic_function_type = ast_context->getFunctionNoProtoType(ast_context->UnknownAnyTy); - QualType block_pointer_type = ast_context->getBlockPointerType(generic_function_type); - - return block_pointer_type.getAsOpaquePtr(); -} +//static clang_type_t +//MaybePromoteToBlockPointerType +//( +// ASTContext *ast_context, +// clang_type_t candidate_type +//) +//{ +// if (!candidate_type) +// return candidate_type; +// +// QualType candidate_qual_type = QualType::getFromOpaquePtr(candidate_type); +// +// const PointerType *candidate_pointer_type = dyn_cast<PointerType>(candidate_qual_type); +// +// if (!candidate_pointer_type) +// return candidate_type; +// +// QualType pointee_qual_type = candidate_pointer_type->getPointeeType(); +// +// const RecordType *pointee_record_type = dyn_cast<RecordType>(pointee_qual_type); +// +// if (!pointee_record_type) +// return candidate_type; +// +// RecordDecl *pointee_record_decl = pointee_record_type->getDecl(); +// +// if (!pointee_record_decl->isRecord()) +// return candidate_type; +// +// if (!pointee_record_decl->getName().startswith(llvm::StringRef("__block_literal_"))) +// return candidate_type; +// +// QualType generic_function_type = ast_context->getFunctionNoProtoType(ast_context->UnknownAnyTy); +// QualType block_pointer_type = ast_context->getBlockPointerType(generic_function_type); +// +// return block_pointer_type.getAsOpaquePtr(); +//} bool ClangExpressionDeclMap::GetVariableValue (VariableSP &var, diff --git a/lldb/source/Expression/ClangExpressionParser.cpp b/lldb/source/Expression/ClangExpressionParser.cpp index 46623c01a5b..ea3ff95f578 100644 --- a/lldb/source/Expression/ClangExpressionParser.cpp +++ b/lldb/source/Expression/ClangExpressionParser.cpp @@ -88,87 +88,6 @@ std::string GetBuiltinIncludePath(const char *Argv0) { return P.str(); } - -//===----------------------------------------------------------------------===// -// Main driver for Clang -//===----------------------------------------------------------------------===// - -static void LLVMErrorHandler(void *UserData, const std::string &Message) { - DiagnosticsEngine &Diags = *static_cast<DiagnosticsEngine*>(UserData); - - Diags.Report(diag::err_fe_error_backend) << Message; - - // We cannot recover from llvm errors. - assert(0); -} - -static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) { - using namespace clang::frontend; - - switch (CI.getFrontendOpts().ProgramAction) { - default: - llvm_unreachable("Invalid program action!"); - - case ASTDump: return new ASTDumpAction(); - case ASTPrint: return new ASTPrintAction(); - case ASTView: return new ASTViewAction(); - case DumpRawTokens: return new DumpRawTokensAction(); - case DumpTokens: return new DumpTokensAction(); - case EmitAssembly: return new EmitAssemblyAction(); - case EmitBC: return new EmitBCAction(); - case EmitHTML: return new HTMLPrintAction(); - case EmitLLVM: return new EmitLLVMAction(); - case EmitLLVMOnly: return new EmitLLVMOnlyAction(); - case EmitCodeGenOnly: return new EmitCodeGenOnlyAction(); - case EmitObj: return new EmitObjAction(); - case FixIt: return new FixItAction(); - case GeneratePCH: return new GeneratePCHAction(); - case GeneratePTH: return new GeneratePTHAction(); - case InitOnly: return new InitOnlyAction(); - case ParseSyntaxOnly: return new SyntaxOnlyAction(); - - case PluginAction: { - for (FrontendPluginRegistry::iterator it = - FrontendPluginRegistry::begin(), ie = FrontendPluginRegistry::end(); - it != ie; ++it) { - if (it->getName() == CI.getFrontendOpts().ActionName) { - std::unique_ptr<PluginASTAction> P(it->instantiate()); - if (!P->ParseArgs(CI, CI.getFrontendOpts().PluginArgs)) - return 0; - return P.release(); - } - } - - CI.getDiagnostics().Report(diag::err_fe_invalid_plugin_name) - << CI.getFrontendOpts().ActionName; - return 0; - } - - case PrintDeclContext: return new DeclContextPrintAction(); - case PrintPreamble: return new PrintPreambleAction(); - case PrintPreprocessedInput: return new PrintPreprocessedAction(); - case RewriteMacros: return new RewriteMacrosAction(); - case RewriteObjC: return new RewriteObjCAction(); - case RewriteTest: return new RewriteTestAction(); - //case RunAnalysis: return new AnalysisAction(); - case RunPreprocessorOnly: return new PreprocessOnlyAction(); - } -} - -static FrontendAction *CreateFrontendAction(CompilerInstance &CI) { - // Create the underlying action. - FrontendAction *Act = CreateFrontendBaseAction(CI); - if (!Act) - return 0; - - // If there are any AST files to merge, create a frontend action - // adaptor to perform the merge. - if (!CI.getFrontendOpts().ASTMergeFiles.empty()) - Act = new ASTMergeAction(Act, CI.getFrontendOpts().ASTMergeFiles); - - return Act; -} - //===----------------------------------------------------------------------===// // Implementation of ClangExpressionParser //===----------------------------------------------------------------------===// diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index 887a9d3fbbd..2b9bd2cef50 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -396,20 +396,20 @@ ApplyObjcCastHack(std::string &expr) // hopefully we'll figure out a way to #include the same environment as is // present in the original source file rather than try to hack specific type // definitions in as needed. -static void -ApplyUnicharHack(std::string &expr) -{ -#define UNICHAR_HACK_FROM "unichar" -#define UNICHAR_HACK_TO "unsigned short" - - size_t from_offset; - - while ((from_offset = expr.find(UNICHAR_HACK_FROM)) != expr.npos) - expr.replace(from_offset, sizeof(UNICHAR_HACK_FROM) - 1, UNICHAR_HACK_TO); - -#undef UNICHAR_HACK_TO -#undef UNICHAR_HACK_FROM -} +//static void +//ApplyUnicharHack(std::string &expr) +//{ +//#define UNICHAR_HACK_FROM "unichar" +//#define UNICHAR_HACK_TO "unsigned short" +// +// size_t from_offset; +// +// while ((from_offset = expr.find(UNICHAR_HACK_FROM)) != expr.npos) +// expr.replace(from_offset, sizeof(UNICHAR_HACK_FROM) - 1, UNICHAR_HACK_TO); +// +//#undef UNICHAR_HACK_TO +//#undef UNICHAR_HACK_FROM +//} bool ClangUserExpression::Parse (Stream &error_stream, diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index 14cb237f5a6..5e117268622 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -687,27 +687,6 @@ IRForTarget::CreateResultVariable (llvm::Function &llvm_function) return true; } -static void DebugUsers(lldb_private::Log *log, Value *value, uint8_t depth) -{ - if (!depth) - return; - - depth--; - - if (log) - log->Printf(" <Begin %d users>", value->getNumUses()); - - for (llvm::User *u : value->users()) - { - if (log) - log->Printf(" <Use %p> %s", u, PrintValue(u).c_str()); - DebugUsers(log, u, depth); - } - - if (log) - log->Printf(" <End uses>"); -} - bool IRForTarget::RewriteObjCConstString (llvm::GlobalVariable *ns_str, llvm::GlobalVariable *cstr) |