Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h =================================================================== --- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h +++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h @@ -10,10 +10,19 @@ #ifndef liblldb_DisassemblerLLVMC_h_ #define liblldb_DisassemblerLLVMC_h_ +// C Includes +// C++ Includes #include +// Other libraries and framework includes #include "llvm-c/Disassembler.h" +// Project includes +#include "lldb/Core/Address.h" +#include "lldb/Core/Disassembler.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Host/Mutex.h" + // Opaque references to C++ Objects in LLVM's MC. namespace llvm { @@ -25,13 +34,8 @@ class MCInstPrinter; class MCAsmInfo; class MCSubtargetInfo; -} +} // namespace llvm -#include "lldb/Core/Address.h" -#include "lldb/Core/Disassembler.h" -#include "lldb/Core/PluginManager.h" -#include "lldb/Host/Mutex.h" - class InstructionLLVMC; class DisassemblerLLVMC : public lldb_private::Disassembler @@ -43,7 +47,7 @@ public: LLVMCDisassembler (const char *triple, const char *cpu, const char *features_str, unsigned flavor, DisassemblerLLVMC &owner); - ~LLVMCDisassembler(); + ~LLVMCDisassembler() = default; uint64_t GetMCInst (const uint8_t *opcode_data, size_t opcode_data_len, lldb::addr_t pc, llvm::MCInst &mc_inst); uint64_t PrintMCInst (llvm::MCInst &mc_inst, char *output_buffer, size_t out_buffer_len); @@ -67,6 +71,10 @@ }; public: + DisassemblerLLVMC(const lldb_private::ArchSpec &arch, const char *flavor /* = NULL */); + + ~DisassemblerLLVMC() override = default; + //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -82,33 +90,28 @@ static lldb_private::Disassembler * CreateInstance(const lldb_private::ArchSpec &arch, const char *flavor); - DisassemblerLLVMC(const lldb_private::ArchSpec &arch, const char *flavor /* = NULL */); + size_t + DecodeInstructions(const lldb_private::Address &base_addr, + const lldb_private::DataExtractor& data, + lldb::offset_t data_offset, + size_t num_instructions, + bool append, + bool data_from_file) override; - virtual - ~DisassemblerLLVMC(); - - virtual size_t - DecodeInstructions (const lldb_private::Address &base_addr, - const lldb_private::DataExtractor& data, - lldb::offset_t data_offset, - size_t num_instructions, - bool append, - bool data_from_file); - //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); + lldb_private::ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion(); + uint32_t + GetPluginVersion() override; protected: friend class InstructionLLVMC; - virtual bool - FlavorValidForArchSpec (const lldb_private::ArchSpec &arch, const char *flavor); + bool + FlavorValidForArchSpec(const lldb_private::ArchSpec &arch, const char *flavor) override; bool IsValid() @@ -164,4 +167,4 @@ std::unique_ptr m_alternate_disasm_ap; }; -#endif // liblldb_DisassemblerLLVM_h_ +#endif // liblldb_DisassemblerLLVM_h_ Index: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp =================================================================== --- source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -7,8 +7,9 @@ // //===----------------------------------------------------------------------===// -#include "DisassemblerLLVMC.h" - +// C Includes +// C++ Includes +// Project includes #include "llvm-c/Disassembler.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCContext.h" @@ -25,6 +26,8 @@ #include "llvm/Support/TargetSelect.h" #include "llvm/ADT/SmallString.h" +// Other libraries and framework includes +#include "DisassemblerLLVMC.h" #include "lldb/Core/Address.h" #include "lldb/Core/DataExtractor.h" @@ -58,13 +61,10 @@ { } - virtual - ~InstructionLLVMC () - { - } + ~InstructionLLVMC() override = default; - virtual bool - DoesBranch () + bool + DoesBranch() override { if (m_does_branch == eLazyBoolCalculate) { @@ -100,8 +100,8 @@ return m_does_branch == eLazyBoolYes; } - virtual bool - HasDelaySlot () + bool + HasDelaySlot() override { if (m_has_delay_slot == eLazyBoolCalculate) { @@ -155,10 +155,10 @@ return llvm_disasm.m_disasm_ap.get(); } - virtual size_t - Decode (const lldb_private::Disassembler &disassembler, - const lldb_private::DataExtractor &data, - lldb::offset_t data_offset) + size_t + Decode(const lldb_private::Disassembler &disassembler, + const lldb_private::DataExtractor &data, + lldb::offset_t data_offset) override { // All we have to do is read the opcode which can be easy for some // architectures @@ -272,8 +272,8 @@ } } - virtual void - CalculateMnemonicOperandsAndComment (const lldb_private::ExecutionContext *exe_ctx) + void + CalculateMnemonicOperandsAndComment(const lldb_private::ExecutionContext *exe_ctx) override { DataExtractor data; const AddressClass address_class = GetAddressClass (); @@ -452,8 +452,6 @@ bool m_using_file_addr; }; - - DisassemblerLLVMC::LLVMCDisassembler::LLVMCDisassembler (const char *triple, const char *cpu, const char *features_str, unsigned flavor, DisassemblerLLVMC &owner): m_is_valid(true) { @@ -521,10 +519,6 @@ m_is_valid = false; } -DisassemblerLLVMC::LLVMCDisassembler::~LLVMCDisassembler() -{ -} - uint64_t DisassemblerLLVMC::LLVMCDisassembler::GetMCInst (const uint8_t *opcode_data, size_t opcode_data_len, @@ -605,7 +599,6 @@ return false; } - Disassembler * DisassemblerLLVMC::CreateInstance (const ArchSpec &arch, const char *flavor) { @@ -782,10 +775,6 @@ } } -DisassemblerLLVMC::~DisassemblerLLVMC() -{ -} - size_t DisassemblerLLVMC::DecodeInstructions (const Address &base_addr, const DataExtractor& data, Index: source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h =================================================================== --- source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h +++ source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h @@ -12,12 +12,11 @@ // C Includes // C++ Includes -#include #include #include // Other libraries and framework includes - +// Project includes #include "lldb/Target/DynamicLoader.h" #include "lldb/Host/FileSpec.h" #include "lldb/Host/TimeValue.h" @@ -28,6 +27,10 @@ class DynamicLoaderDarwinKernel : public lldb_private::DynamicLoader { public: + DynamicLoaderDarwinKernel(lldb_private::Process *process, lldb::addr_t kernel_addr); + + ~DynamicLoaderDarwinKernel() override; + //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -49,38 +52,33 @@ static void DebuggerInitialize (lldb_private::Debugger &debugger); - DynamicLoaderDarwinKernel (lldb_private::Process *process, lldb::addr_t kernel_addr); - - virtual - ~DynamicLoaderDarwinKernel (); - //------------------------------------------------------------------ /// Called after attaching a process. /// /// Allow DynamicLoader plug-ins to execute some code after /// attaching to a process. //------------------------------------------------------------------ - virtual void - DidAttach (); + void + DidAttach() override; - virtual void - DidLaunch (); + void + DidLaunch() override; - virtual lldb::ThreadPlanSP - GetStepThroughTrampolinePlan (lldb_private::Thread &thread, - bool stop_others); + lldb::ThreadPlanSP + GetStepThroughTrampolinePlan(lldb_private::Thread &thread, + bool stop_others) override; - virtual lldb_private::Error - CanLoadImage (); + lldb_private::Error + CanLoadImage() override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); + lldb_private::ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion(); + uint32_t + GetPluginVersion() override; protected: void @@ -263,7 +261,6 @@ lldb::addr_t m_load_address; uint64_t m_size; bool m_kernel_image; // true if this is the kernel, false if this is a kext - }; struct OSKextLoadedKextSummaryHeader @@ -371,4 +368,4 @@ DISALLOW_COPY_AND_ASSIGN (DynamicLoaderDarwinKernel); }; -#endif // liblldb_DynamicLoaderDarwinKernel_h_ +#endif // liblldb_DynamicLoaderDarwinKernel_h_ Index: source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h =================================================================== --- source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h +++ source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.h @@ -7,12 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_DynamicLoaderHexagon_H_ -#define liblldb_DynamicLoaderHexagon_H_ +#ifndef liblldb_DynamicLoaderHexagonDYLD_h_ +#define liblldb_DynamicLoaderHexagonDYLD_h_ // C Includes // C++ Includes // Other libraries and framework includes +// Project includes #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Target/DynamicLoader.h" @@ -21,7 +22,10 @@ class DynamicLoaderHexagonDYLD : public lldb_private::DynamicLoader { public: + DynamicLoaderHexagonDYLD(lldb_private::Process *process); + ~DynamicLoaderHexagonDYLD() override; + static void Initialize(); @@ -37,38 +41,33 @@ static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force); - DynamicLoaderHexagonDYLD(lldb_private::Process *process); - - virtual - ~DynamicLoaderHexagonDYLD(); - //------------------------------------------------------------------ // DynamicLoader protocol //------------------------------------------------------------------ - virtual void + void DidAttach() override; - virtual void + void DidLaunch() override; lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override; - virtual lldb_private::Error + lldb_private::Error CanLoadImage() override; - virtual lldb::addr_t - GetThreadLocalData (const lldb::ModuleSP module, const lldb::ThreadSP thread) override; + lldb::addr_t + GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread) override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString + lldb_private::ConstString GetPluginName() override; - virtual uint32_t + uint32_t GetPluginVersion() override; protected: @@ -168,10 +167,10 @@ FindRendezvousBreakpointAddress( ); private: - DISALLOW_COPY_AND_ASSIGN(DynamicLoaderHexagonDYLD); - const lldb_private::SectionList * GetSectionListFromModule(const lldb::ModuleSP module) const; + + DISALLOW_COPY_AND_ASSIGN(DynamicLoaderHexagonDYLD); }; -#endif // liblldb_DynamicLoaderHexagonDYLD_H_ +#endif // liblldb_DynamicLoaderHexagonDYLD_h_ Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h =================================================================== --- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h +++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h @@ -12,23 +12,25 @@ // C Includes // C++ Includes -#include #include -#include +// Other libraries and framework includes +// Project includes #include "lldb/Target/DynamicLoader.h" #include "lldb/Host/FileSpec.h" #include "lldb/Core/StructuredData.h" #include "lldb/Core/UUID.h" #include "lldb/Host/Mutex.h" #include "lldb/Target/Process.h" - -// Other libraries and framework includes #include "lldb/Utility/SafeMachO.h" class DynamicLoaderMacOSXDYLD : public lldb_private::DynamicLoader { public: + DynamicLoaderMacOSXDYLD(lldb_private::Process *process); + + ~DynamicLoaderMacOSXDYLD() override; + //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -47,48 +49,44 @@ static lldb_private::DynamicLoader * CreateInstance (lldb_private::Process *process, bool force); - DynamicLoaderMacOSXDYLD (lldb_private::Process *process); - - virtual - ~DynamicLoaderMacOSXDYLD (); //------------------------------------------------------------------ /// Called after attaching a process. /// /// Allow DynamicLoader plug-ins to execute some code after /// attaching to a process. //------------------------------------------------------------------ - virtual void - DidAttach (); + void + DidAttach() override; - virtual void - DidLaunch (); + void + DidLaunch() override; - virtual bool - ProcessDidExec (); + bool + ProcessDidExec() override; - virtual lldb::ThreadPlanSP - GetStepThroughTrampolinePlan (lldb_private::Thread &thread, - bool stop_others); + lldb::ThreadPlanSP + GetStepThroughTrampolinePlan(lldb_private::Thread &thread, + bool stop_others) override; - virtual size_t - FindEquivalentSymbols (lldb_private::Symbol *original_symbol, - lldb_private::ModuleList &module_list, - lldb_private::SymbolContextList &equivalent_symbols); + size_t + FindEquivalentSymbols(lldb_private::Symbol *original_symbol, + lldb_private::ModuleList &module_list, + lldb_private::SymbolContextList &equivalent_symbols) override; - virtual lldb_private::Error - CanLoadImage (); + lldb_private::Error + CanLoadImage() override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); + lldb_private::ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion(); + uint32_t + GetPluginVersion() override; - virtual bool - AlwaysRelyOnEHUnwindInfo (lldb_private::SymbolContext &sym_ctx); + bool + AlwaysRelyOnEHUnwindInfo(lldb_private::SymbolContext &sym_ctx) override; protected: void @@ -97,6 +95,7 @@ void PrivateProcessStateChanged (lldb_private::Process *process, lldb::StateType state); + bool LocateDYLD (); @@ -128,10 +127,10 @@ ReadMachHeader (lldb::addr_t addr, llvm::MachO::mach_header *header, lldb_private::DataExtractor *load_command_data); + class Segment { public: - Segment() : name(), vmaddr(LLDB_INVALID_ADDRESS), @@ -383,4 +382,4 @@ DISALLOW_COPY_AND_ASSIGN (DynamicLoaderMacOSXDYLD); }; -#endif // liblldb_DynamicLoaderMacOSXDYLD_h_ +#endif // liblldb_DynamicLoaderMacOSXDYLD_h_ Index: source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h =================================================================== --- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h +++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h @@ -1,4 +1,4 @@ -//===-- DynamicLoaderPOSIX.h ------------------------------------*- C++ -*-===// +//===-- DynamicLoaderPOSIXDYLD.h --------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,12 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_DynamicLoaderPOSIX_H_ -#define liblldb_DynamicLoaderPOSIX_H_ +#ifndef liblldb_DynamicLoaderPOSIXDYLD_h_ +#define liblldb_DynamicLoaderPOSIXDYLD_h_ // C Includes // C++ Includes // Other libraries and framework includes +// Project includes #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Target/DynamicLoader.h" @@ -23,7 +24,10 @@ class DynamicLoaderPOSIXDYLD : public lldb_private::DynamicLoader { public: + DynamicLoaderPOSIXDYLD(lldb_private::Process *process); + ~DynamicLoaderPOSIXDYLD() override; + static void Initialize(); @@ -39,38 +43,33 @@ static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force); - DynamicLoaderPOSIXDYLD(lldb_private::Process *process); - - virtual - ~DynamicLoaderPOSIXDYLD(); - //------------------------------------------------------------------ // DynamicLoader protocol //------------------------------------------------------------------ - virtual void + void DidAttach() override; - virtual void + void DidLaunch() override; lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override; - virtual lldb_private::Error + lldb_private::Error CanLoadImage() override; - virtual lldb::addr_t - GetThreadLocalData (const lldb::ModuleSP module, const lldb::ThreadSP thread) override; + lldb::addr_t + GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread) override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString + lldb_private::ConstString GetPluginName() override; - virtual uint32_t + uint32_t GetPluginVersion() override; protected: @@ -168,4 +167,4 @@ DISALLOW_COPY_AND_ASSIGN(DynamicLoaderPOSIXDYLD); }; -#endif // liblldb_DynamicLoaderPOSIXDYLD_H_ +#endif // liblldb_DynamicLoaderPOSIXDYLD_h_ Index: source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h =================================================================== --- source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h +++ source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h @@ -12,12 +12,8 @@ // C Includes // C++ Includes -#include -#include -#include - // Other libraries and framework includes - +// Project includes #include "lldb/Target/DynamicLoader.h" #include "lldb/Host/FileSpec.h" #include "lldb/Core/UUID.h" @@ -27,6 +23,10 @@ class DynamicLoaderStatic : public lldb_private::DynamicLoader { public: + DynamicLoaderStatic(lldb_private::Process *process); + + ~DynamicLoaderStatic() override; + //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ @@ -45,37 +45,33 @@ static lldb_private::DynamicLoader * CreateInstance (lldb_private::Process *process, bool force); - DynamicLoaderStatic (lldb_private::Process *process); - - virtual - ~DynamicLoaderStatic (); //------------------------------------------------------------------ /// Called after attaching a process. /// /// Allow DynamicLoader plug-ins to execute some code after /// attaching to a process. //------------------------------------------------------------------ - virtual void - DidAttach (); + void + DidAttach() override; - virtual void - DidLaunch (); + void + DidLaunch() override; - virtual lldb::ThreadPlanSP - GetStepThroughTrampolinePlan (lldb_private::Thread &thread, - bool stop_others); + lldb::ThreadPlanSP + GetStepThroughTrampolinePlan(lldb_private::Thread &thread, + bool stop_others) override; - virtual lldb_private::Error - CanLoadImage (); + lldb_private::Error + CanLoadImage() override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); + lldb_private::ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion(); + uint32_t + GetPluginVersion() override; private: void @@ -84,4 +80,4 @@ DISALLOW_COPY_AND_ASSIGN (DynamicLoaderStatic); }; -#endif // liblldb_DynamicLoaderStatic_h_ +#endif // liblldb_DynamicLoaderStatic_h_ Index: source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h =================================================================== --- source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h +++ source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h @@ -1,4 +1,4 @@ -//===-- DynamicLoaderWindowsDYLDh ----------------------------------*- C++ -*-===// +//===-- DynamicLoaderWindowsDYLD.h ------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,9 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_H_ -#define liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_H_ +#ifndef liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_h_ +#define liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/lldb-forward.h" #include "lldb/Target/DynamicLoader.h" @@ -18,15 +22,16 @@ class DynamicLoaderWindowsDYLD : public DynamicLoader { - public: +public: + DynamicLoaderWindowsDYLD(Process *process); + + ~DynamicLoaderWindowsDYLD() override; + static void Initialize(); static void Terminate(); static ConstString GetPluginNameStatic(); static const char *GetPluginDescriptionStatic(); - DynamicLoaderWindowsDYLD(Process *process); - virtual ~DynamicLoaderWindowsDYLD(); - static DynamicLoader *CreateInstance(Process *process, bool force); void DidAttach() override; @@ -37,6 +42,7 @@ ConstString GetPluginName() override; uint32_t GetPluginVersion() override; }; -} -#endif +} // namespace lldb_private + +#endif // liblldb_Plugins_Process_Windows_DynamicLoaderWindowsDYLD_h_ Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ 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 @@ 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 @@ { } - 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 string_path; Index: source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h +++ 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 -#include // Other libraries and framework includes // Project includes #include "ClangExpressionHelper.h" @@ -78,7 +76,7 @@ { } - ~ClangFunctionCallerHelper() {} + ~ClangFunctionCallerHelper() override = default; //------------------------------------------------------------------ /// Return the object that the parser should use when resolving external @@ -100,6 +98,7 @@ //------------------------------------------------------------------ clang::ASTConsumer * ASTTransformer(clang::ASTConsumer *passthrough) override; + private: ClangFunctionCaller &m_owner; std::unique_ptr m_struct_extractor; ///< The class that generates the argument struct layout. @@ -133,9 +132,6 @@ const ValueList &arg_value_list, const char *name); - //------------------------------------------------------------------ - /// Destructor - //------------------------------------------------------------------ ~ClangFunctionCaller() override; //------------------------------------------------------------------ @@ -155,11 +151,13 @@ { return &m_type_system_helper; } + protected: const char *GetWrapperStructName() { return m_wrapper_struct_name.c_str(); } + private: //------------------------------------------------------------------ // For ClangFunctionCaller only @@ -168,9 +166,8 @@ // 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_ Index: source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -7,8 +7,20 @@ // //===----------------------------------------------------------------------===// -#include // std::once +// C Includes +// C++ Includes +#include +// 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 @@ { 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 IDAndDiagnostic; std::vector m_diagnostics; @@ -61,29 +67,29 @@ llvm::IntrusiveRefCntPtr &compiler_invocation, std::unique_ptr &&compiler_instance, std::unique_ptr &&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 &decls) override; - virtual uint32_t - FindDecls (const ConstString &name, - bool append, - uint32_t max_matches, - std::vector &decls) override; - - virtual void + void ForEachMacro(const ModuleVector &modules, std::function handler) override; - ~ClangModulesDeclVendorImpl(); - private: void ReportModuleExportsHelper (std::set &exports, @@ -110,7 +116,7 @@ ImportedModuleMap m_imported_modules; ImportedModuleSet m_user_imported_modules; }; -} +} // anonymous namespace StoringDiagnosticConsumer::StoringDiagnosticConsumer () { @@ -164,7 +170,6 @@ return g_cached_resource_dir; } - ClangModulesDeclVendor::ClangModulesDeclVendor() { } @@ -318,7 +323,6 @@ return false; } - bool ClangModulesDeclVendor::LanguageSupportsClangModules (lldb::LanguageType language) { @@ -597,10 +601,6 @@ } } -ClangModulesDeclVendorImpl::~ClangModulesDeclVendorImpl() -{ -} - clang::ModuleLoadResult ClangModulesDeclVendorImpl::DoGetModule(clang::ModuleIdPath path, bool make_visible) Index: source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h +++ 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 @@ class ClangPersistentVariables : public PersistentExpressionState { public: - - //---------------------------------------------------------------------- - /// Constructor - //---------------------------------------------------------------------- - ClangPersistentVariables (); - - ~ClangPersistentVariables () { } - + ClangPersistentVariables(); + + ~ClangPersistentVariables() override = default; + //------------------------------------------------------------------ // llvm casting support //------------------------------------------------------------------ @@ -101,6 +101,6 @@ ///< priority source for macros. }; -} +} // namespace lldb_private -#endif +#endif // liblldb_ClangPersistentVariables_h_ Index: source/Plugins/ExpressionParser/Clang/ClangUserExpression.h =================================================================== --- source/Plugins/ExpressionParser/Clang/ClangUserExpression.h +++ source/Plugins/ExpressionParser/Clang/ClangUserExpression.h @@ -12,13 +12,10 @@ // C Includes // C++ Includes -#include -#include #include // Other libraries and framework includes // Project includes - #include "ASTStructExtractor.h" #include "ASTResultSynthesizer.h" #include "ClangExpressionDeclMap.h" @@ -49,10 +46,8 @@ class ClangUserExpression : public UserExpression { public: - enum { kDefaultTimeout = 500000u }; - class ClangUserExpressionHelper : public ClangExpressionHelper { public: @@ -61,7 +56,7 @@ { } - ~ClangUserExpressionHelper() {} + ~ClangUserExpressionHelper() override = default; //------------------------------------------------------------------ /// Return the object that the parser should use when resolving external @@ -92,6 +87,7 @@ //------------------------------------------------------------------ clang::ASTConsumer * ASTTransformer(clang::ASTConsumer *passthrough) override; + private: Target &m_target; std::unique_ptr m_expr_decl_map_up; @@ -124,9 +120,6 @@ lldb::LanguageType language, ResultType desired_type); - //------------------------------------------------------------------ - /// Destructor - //------------------------------------------------------------------ ~ClangUserExpression() override; //------------------------------------------------------------------ @@ -209,6 +202,7 @@ void RegisterPersistentState(PersistentExpressionState *persistent_state); lldb::ExpressionVariableSP &GetVariable(); + private: PersistentExpressionState *m_persistent_state; lldb::ExpressionVariableSP m_variable; Index: source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h =================================================================== --- source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h +++ source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h @@ -1,4 +1,4 @@ -//===-- EmulateInstructionARM64.h ------------------------------------*- C++ -*-===// +//===-- EmulateInstructionARM64.h -------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -10,6 +10,10 @@ #ifndef EmulateInstructionARM64_h_ #define EmulateInstructionARM64_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/Core/EmulateInstruction.h" #include "lldb/Core/Error.h" #include "lldb/Interpreter/OptionValue.h" @@ -18,6 +22,14 @@ class EmulateInstructionARM64 : public lldb_private::EmulateInstruction { public: + EmulateInstructionARM64 (const lldb_private::ArchSpec &arch) : + EmulateInstruction (arch), + m_opcode_pstate (), + m_emulated_pstate (), + m_ignore_conditions (false) + { + } + static void Initialize (); @@ -50,55 +62,46 @@ return false; } - virtual lldb_private::ConstString - GetPluginName(); + lldb_private::ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion() + uint32_t + GetPluginVersion() override { return 1; } bool - SetTargetTriple (const lldb_private::ArchSpec &arch); + SetTargetTriple(const lldb_private::ArchSpec &arch) override; - EmulateInstructionARM64 (const lldb_private::ArchSpec &arch) : - EmulateInstruction (arch), - m_opcode_pstate (), - m_emulated_pstate (), - m_ignore_conditions (false) + bool + SupportsEmulatingInstructionsOfType(lldb_private::InstructionType inst_type) override { - } - - virtual bool - SupportsEmulatingInstructionsOfType (lldb_private::InstructionType inst_type) - { return SupportsEmulatingInstructionsOfTypeStatic (inst_type); } - virtual bool - ReadInstruction (); + bool + ReadInstruction() override; - virtual bool - EvaluateInstruction (uint32_t evaluate_options); + bool + EvaluateInstruction(uint32_t evaluate_options) override; - virtual bool - TestEmulation (lldb_private::Stream *out_stream, - lldb_private::ArchSpec &arch, - lldb_private::OptionValueDictionary *test_data) + bool + TestEmulation(lldb_private::Stream *out_stream, + lldb_private::ArchSpec &arch, + lldb_private::OptionValueDictionary *test_data) override { return false; } - virtual bool - GetRegisterInfo (lldb::RegisterKind reg_kind, - uint32_t reg_num, - lldb_private::RegisterInfo ®_info); + bool + GetRegisterInfo(lldb::RegisterKind reg_kind, + uint32_t reg_num, + lldb_private::RegisterInfo ®_info) override; - virtual bool - CreateFunctionEntryUnwind (lldb_private::UnwindPlan &unwind_plan); + bool + CreateFunctionEntryUnwind(lldb_private::UnwindPlan &unwind_plan) override; - typedef enum { AddrMode_OFF, @@ -135,7 +138,6 @@ BitwiseOp_NOT, BitwiseOp_RBIT } BitwiseOp; - typedef enum { @@ -246,7 +248,6 @@ } ProcState; protected: - typedef struct { uint32_t mask; @@ -297,4 +298,4 @@ bool m_ignore_conditions; }; -#endif // EmulateInstructionARM64_h_ +#endif // EmulateInstructionARM64_h_ Index: source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h =================================================================== --- source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h +++ source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h @@ -1,4 +1,4 @@ -//===-- EmulateInstructionMIPS64.h ------------------------------------*- C++ -*-===// +//===-- EmulateInstructionMIPS64.h ------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -10,6 +10,14 @@ #ifndef EmulateInstructionMIPS64_h_ #define EmulateInstructionMIPS64_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/EmulateInstruction.h" +#include "lldb/Core/Error.h" +#include "lldb/Interpreter/OptionValue.h" + namespace llvm { class MCDisassembler; @@ -19,15 +27,13 @@ class MCContext; class MCInstrInfo; class MCInst; -} +} // namespace llvm -#include "lldb/Core/EmulateInstruction.h" -#include "lldb/Core/Error.h" -#include "lldb/Interpreter/OptionValue.h" - class EmulateInstructionMIPS64 : public lldb_private::EmulateInstruction { public: + EmulateInstructionMIPS64(const lldb_private::ArchSpec &arch); + static void Initialize (); @@ -60,51 +66,47 @@ return false; } - virtual lldb_private::ConstString - GetPluginName(); + lldb_private::ConstString + GetPluginName() override; - virtual uint32_t - GetPluginVersion() + uint32_t + GetPluginVersion() override { return 1; } bool - SetTargetTriple (const lldb_private::ArchSpec &arch); + SetTargetTriple(const lldb_private::ArchSpec &arch) override; - EmulateInstructionMIPS64 (const lldb_private::ArchSpec &arch); - - virtual bool - SupportsEmulatingInstructionsOfType (lldb_private::InstructionType inst_type) + bool + SupportsEmulatingInstructionsOfType(lldb_private::InstructionType inst_type) override { return SupportsEmulatingInstructionsOfTypeStatic (inst_type); } - virtual bool - ReadInstruction (); + bool + ReadInstruction() override; - virtual bool - EvaluateInstruction (uint32_t evaluate_options); + bool + EvaluateInstruction(uint32_t evaluate_options) override; - virtual bool - TestEmulation (lldb_private::Stream *out_stream, - lldb_private::ArchSpec &arch, - lldb_private::OptionValueDictionary *test_data) + bool + TestEmulation(lldb_private::Stream *out_stream, + lldb_private::ArchSpec &arch, + lldb_private::OptionValueDictionary *test_data) override { return false; } - virtual bool - GetRegisterInfo (lldb::RegisterKind reg_kind, - uint32_t reg_num, - lldb_private::RegisterInfo ®_info); + bool + GetRegisterInfo(lldb::RegisterKind reg_kind, + uint32_t reg_num, + lldb_private::RegisterInfo ®_info) override; - virtual bool - CreateFunctionEntryUnwind (lldb_private::UnwindPlan &unwind_plan); + bool + CreateFunctionEntryUnwind(lldb_private::UnwindPlan &unwind_plan) override; - protected: - typedef struct { const char *op_name; @@ -346,4 +348,4 @@ std::unique_ptr m_insn_info; }; -#endif // EmulateInstructionMIPS64_h_ +#endif // EmulateInstructionMIPS64_h_ Index: source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h =================================================================== --- source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h +++ source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.h @@ -10,6 +10,10 @@ #ifndef liblldb_AddressSanitizerRuntime_h_ #define liblldb_AddressSanitizerRuntime_h_ +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/lldb-private.h" #include "lldb/Target/ABI.h" #include "lldb/Target/InstrumentationRuntime.h" @@ -21,7 +25,8 @@ class AddressSanitizerRuntime : public lldb_private::InstrumentationRuntime { public: - + ~AddressSanitizerRuntime() override; + static lldb::InstrumentationRuntimeSP CreateInstance (const lldb::ProcessSP &process_sp); @@ -36,26 +41,30 @@ static lldb::InstrumentationRuntimeType GetTypeStatic(); + + lldb_private::ConstString + GetPluginName() override + { + return GetPluginNameStatic(); + } - virtual - ~AddressSanitizerRuntime(); - - virtual lldb_private::ConstString - GetPluginName() { return GetPluginNameStatic(); } - virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); } - virtual uint32_t - GetPluginVersion() { return 1; } + uint32_t + GetPluginVersion() override + { + return 1; + } - virtual void - ModulesDidLoad(lldb_private::ModuleList &module_list); + void + ModulesDidLoad(lldb_private::ModuleList &module_list) override; - virtual bool - IsActive(); + bool + IsActive() override; private: + AddressSanitizerRuntime(const lldb::ProcessSP &process_sp); lldb::ProcessSP GetProcessSP () @@ -63,8 +72,6 @@ return m_process_wp.lock(); } - AddressSanitizerRuntime(const lldb::ProcessSP &process_sp); - void Activate(); @@ -84,9 +91,8 @@ lldb::ModuleSP m_runtime_module; lldb::ProcessWP m_process_wp; lldb::user_id_t m_breakpoint_id; - }; } // namespace lldb_private -#endif // liblldb_InstrumentationRuntime_h_ +#endif // liblldb_AddressSanitizerRuntime_h_