diff options
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang')
5 files changed, 91 insertions, 94 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 3f90f12aca6..35ad705fa69 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -7,36 +7,9 @@ // //===----------------------------------------------------------------------===// -#include "ClangExpressionParser.h" - -#include "ClangASTSource.h" -#include "ClangExpressionHelper.h" -#include "ClangExpressionDeclMap.h" -#include "ClangModulesDeclVendor.h" -#include "ClangPersistentVariables.h" -#include "IRForTarget.h" - -#include "lldb/Core/ArchSpec.h" -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/Debugger.h" -#include "lldb/Core/Disassembler.h" -#include "lldb/Core/Log.h" -#include "lldb/Core/Module.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Expression/IRExecutionUnit.h" -#include "lldb/Expression/IRDynamicChecks.h" -#include "lldb/Expression/IRInterpreter.h" -#include "lldb/Host/File.h" -#include "lldb/Host/HostInfo.h" -#include "lldb/Symbol/ClangASTContext.h" -#include "lldb/Symbol/SymbolVendor.h" -#include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ObjCLanguageRuntime.h" -#include "lldb/Target/Process.h" -#include "lldb/Target/Target.h" - +// C Includes +// C++ Includes +// Other libraries and framework includes #include "clang/AST/ASTContext.h" #include "clang/AST/ExternalASTSource.h" #include "clang/Basic/FileManager.h" @@ -73,6 +46,37 @@ #include "llvm/Support/Host.h" #include "llvm/Support/Signals.h" +// Project includes +#include "ClangExpressionParser.h" + +#include "ClangASTSource.h" +#include "ClangExpressionHelper.h" +#include "ClangExpressionDeclMap.h" +#include "ClangModulesDeclVendor.h" +#include "ClangPersistentVariables.h" +#include "IRForTarget.h" + +#include "lldb/Core/ArchSpec.h" +#include "lldb/Core/DataBufferHeap.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Core/Disassembler.h" +#include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/Stream.h" +#include "lldb/Core/StreamFile.h" +#include "lldb/Core/StreamString.h" +#include "lldb/Expression/IRExecutionUnit.h" +#include "lldb/Expression/IRDynamicChecks.h" +#include "lldb/Expression/IRInterpreter.h" +#include "lldb/Host/File.h" +#include "lldb/Host/HostInfo.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/SymbolVendor.h" +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/ObjCLanguageRuntime.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" + using namespace clang; using namespace llvm; using namespace lldb_private; @@ -103,6 +107,7 @@ class ClangExpressionParser::LLDBPreprocessorCallbacks : public PPCallbacks ClangPersistentVariables &m_persistent_vars; StreamString m_error_stream; bool m_has_errors = false; + public: LLDBPreprocessorCallbacks(ClangModulesDeclVendor &decl_vendor, ClangPersistentVariables &persistent_vars) : @@ -111,9 +116,10 @@ public: { } - virtual void moduleImport(SourceLocation import_location, - clang::ModuleIdPath path, - const clang::Module * /*null*/) + void + moduleImport(SourceLocation import_location, + clang::ModuleIdPath path, + const clang::Module * /*null*/) override { std::vector<ConstString> string_path; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h index 40e09287d6f..3e30f818a93 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h @@ -1,4 +1,4 @@ -//===-- ClangFunctionCaller.h -----------------------------------------*- C++ -*-===// +//===-- ClangFunctionCaller.h -----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,8 +12,6 @@ // C Includes // C++ Includes -#include <vector> -#include <list> // Other libraries and framework includes // Project includes #include "ClangExpressionHelper.h" @@ -78,7 +76,7 @@ class ClangFunctionCaller : public FunctionCaller { } - ~ClangFunctionCallerHelper() {} + ~ClangFunctionCallerHelper() override = default; //------------------------------------------------------------------ /// Return the object that the parser should use when resolving external @@ -100,6 +98,7 @@ class ClangFunctionCaller : public FunctionCaller //------------------------------------------------------------------ clang::ASTConsumer * ASTTransformer(clang::ASTConsumer *passthrough) override; + private: ClangFunctionCaller &m_owner; std::unique_ptr<ASTStructExtractor> m_struct_extractor; ///< The class that generates the argument struct layout. @@ -133,9 +132,6 @@ public: const ValueList &arg_value_list, const char *name); - //------------------------------------------------------------------ - /// Destructor - //------------------------------------------------------------------ ~ClangFunctionCaller() override; //------------------------------------------------------------------ @@ -155,11 +151,13 @@ public: { return &m_type_system_helper; } + protected: const char *GetWrapperStructName() { return m_wrapper_struct_name.c_str(); } + private: //------------------------------------------------------------------ // For ClangFunctionCaller only @@ -168,9 +166,8 @@ private: // Note: the parser needs to be destructed before the execution unit, so // declare the execution unit first. ClangFunctionCallerHelper m_type_system_helper; - }; -} // Namespace lldb_private +} // namespace lldb_private #endif // liblldb_ClangFunctionCaller_h_ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index 65ee3e0ff5c..05d8a320a5a 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -7,8 +7,20 @@ // //===----------------------------------------------------------------------===// -#include <mutex> // std::once +// C Includes +// C++ Includes +#include <mutex> +// Other libraries and framework includes +#include "clang/Basic/TargetInfo.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Frontend/FrontendActions.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Parse/Parser.h" +#include "clang/Sema/Lookup.h" +#include "clang/Serialization/ASTReader.h" + +// Project includes #include "ClangModulesDeclVendor.h" #include "lldb/Core/Log.h" @@ -20,15 +32,6 @@ #include "lldb/Target/Target.h" #include "lldb/Utility/LLDBAssert.h" -#include "clang/Basic/TargetInfo.h" -#include "clang/Frontend/CompilerInstance.h" -#include "clang/Frontend/FrontendActions.h" -#include "clang/Lex/Preprocessor.h" -#include "clang/Parse/Parser.h" -#include "clang/Sema/Lookup.h" -#include "clang/Serialization/ASTReader.h" - - using namespace lldb_private; namespace { @@ -38,14 +41,17 @@ namespace { { public: StoringDiagnosticConsumer (); + void - HandleDiagnostic (clang::DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &info); + HandleDiagnostic(clang::DiagnosticsEngine::Level DiagLevel, + const clang::Diagnostic &info) override; void ClearDiagnostics (); void DumpDiagnostics (Stream &error_stream); + private: typedef std::pair<clang::DiagnosticsEngine::Level, std::string> IDAndDiagnostic; std::vector<IDAndDiagnostic> m_diagnostics; @@ -61,29 +67,29 @@ namespace { llvm::IntrusiveRefCntPtr<clang::CompilerInvocation> &compiler_invocation, std::unique_ptr<clang::CompilerInstance> &&compiler_instance, std::unique_ptr<clang::Parser> &&parser); - - virtual bool + + ~ClangModulesDeclVendorImpl() override = default; + + bool AddModule(ModulePath &path, ModuleVector *exported_modules, Stream &error_stream) override; - - virtual bool + + bool AddModulesForCompileUnit(CompileUnit &cu, ModuleVector &exported_modules, Stream &error_stream) override; + + uint32_t + FindDecls(const ConstString &name, + bool append, + uint32_t max_matches, + std::vector <clang::NamedDecl*> &decls) override; - virtual uint32_t - FindDecls (const ConstString &name, - bool append, - uint32_t max_matches, - std::vector <clang::NamedDecl*> &decls) override; - - virtual void + void ForEachMacro(const ModuleVector &modules, std::function<bool (const std::string &)> handler) override; - ~ClangModulesDeclVendorImpl(); - private: void ReportModuleExportsHelper (std::set<ClangModulesDeclVendor::ModuleID> &exports, @@ -110,7 +116,7 @@ namespace { ImportedModuleMap m_imported_modules; ImportedModuleSet m_user_imported_modules; }; -} +} // anonymous namespace StoringDiagnosticConsumer::StoringDiagnosticConsumer () { @@ -164,7 +170,6 @@ GetResourceDir () return g_cached_resource_dir; } - ClangModulesDeclVendor::ClangModulesDeclVendor() { } @@ -318,7 +323,6 @@ ClangModulesDeclVendorImpl::AddModule(ModulePath &path, return false; } - bool ClangModulesDeclVendor::LanguageSupportsClangModules (lldb::LanguageType language) { @@ -597,10 +601,6 @@ ClangModulesDeclVendorImpl::ForEachMacro(const ClangModulesDeclVendor::ModuleVec } } -ClangModulesDeclVendorImpl::~ClangModulesDeclVendorImpl() -{ -} - clang::ModuleLoadResult ClangModulesDeclVendorImpl::DoGetModule(clang::ModuleIdPath path, bool make_visible) diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h index daee1b86c30..0e03d013d04 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h @@ -10,13 +10,17 @@ #ifndef liblldb_ClangPersistentVariables_h_ #define liblldb_ClangPersistentVariables_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +#include "llvm/ADT/DenseMap.h" + +// Project includes #include "ClangExpressionVariable.h" #include "ClangModulesDeclVendor.h" #include "lldb/Expression/ExpressionVariable.h" -#include "llvm/ADT/DenseMap.h" - namespace lldb_private { @@ -31,14 +35,10 @@ namespace lldb_private class ClangPersistentVariables : public PersistentExpressionState { public: - - //---------------------------------------------------------------------- - /// Constructor - //---------------------------------------------------------------------- - ClangPersistentVariables (); - - ~ClangPersistentVariables () { } - + ClangPersistentVariables(); + + ~ClangPersistentVariables() override = default; + //------------------------------------------------------------------ // llvm casting support //------------------------------------------------------------------ @@ -101,6 +101,6 @@ private: ///< priority source for macros. }; -} +} // namespace lldb_private -#endif +#endif // liblldb_ClangPersistentVariables_h_ diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h index 5629876f00f..702968dc2d0 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h @@ -12,13 +12,10 @@ // C Includes // C++ Includes -#include <string> -#include <map> #include <vector> // Other libraries and framework includes // Project includes - #include "ASTStructExtractor.h" #include "ASTResultSynthesizer.h" #include "ClangExpressionDeclMap.h" @@ -49,10 +46,8 @@ namespace lldb_private class ClangUserExpression : public UserExpression { public: - enum { kDefaultTimeout = 500000u }; - class ClangUserExpressionHelper : public ClangExpressionHelper { public: @@ -61,7 +56,7 @@ public: { } - ~ClangUserExpressionHelper() {} + ~ClangUserExpressionHelper() override = default; //------------------------------------------------------------------ /// Return the object that the parser should use when resolving external @@ -92,6 +87,7 @@ public: //------------------------------------------------------------------ clang::ASTConsumer * ASTTransformer(clang::ASTConsumer *passthrough) override; + private: Target &m_target; std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map_up; @@ -124,9 +120,6 @@ public: lldb::LanguageType language, ResultType desired_type); - //------------------------------------------------------------------ - /// Destructor - //------------------------------------------------------------------ ~ClangUserExpression() override; //------------------------------------------------------------------ @@ -209,6 +202,7 @@ private: void RegisterPersistentState(PersistentExpressionState *persistent_state); lldb::ExpressionVariableSP &GetVariable(); + private: PersistentExpressionState *m_persistent_state; lldb::ExpressionVariableSP m_variable; |

