diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2 |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h')
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h | 195 |
1 files changed, 91 insertions, 104 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h index 468b9c1..56d1d84 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h @@ -16,23 +16,23 @@ // Project includes #include "ClangExpressionHelper.h" -#include "lldb/Core/ClangForward.h" #include "lldb/Core/Address.h" #include "lldb/Core/ArchSpec.h" +#include "lldb/Core/ClangForward.h" #include "lldb/Core/Value.h" #include "lldb/Core/ValueObjectList.h" #include "lldb/Expression/FunctionCaller.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Process.h" -namespace lldb_private -{ - +namespace lldb_private { + class ASTStructExtractor; class ClangExpressionParser; //---------------------------------------------------------------------- -/// @class ClangFunctionCaller ClangFunctionCaller.h "lldb/Expression/ClangFunctionCaller.h" +/// @class ClangFunctionCaller ClangFunctionCaller.h +/// "lldb/Expression/ClangFunctionCaller.h" /// @brief Encapsulates a function that can be called. /// /// A given ClangFunctionCaller object can handle a single function signature. @@ -42,7 +42,7 @@ class ClangExpressionParser; /// It performs the call by synthesizing a structure that contains the pointer /// to the function and the arguments that should be passed to that function, /// and producing a special-purpose JIT-compiled function that accepts a void* -/// pointing to this struct as its only argument and calls the function in the +/// pointing to this struct as its only argument and calls the function in the /// struct with the written arguments. This method lets Clang handle the /// vagaries of function calling conventions. /// @@ -54,124 +54,111 @@ class ClangExpressionParser; /// InsertFunction() followed by WriteFunctionArguments(), which will return /// the location of the args struct for the wrapper function in args_addr_ref. /// -/// If you need to call the function on the thread plan stack, you can also +/// If you need to call the function on the thread plan stack, you can also /// call InsertFunction() followed by GetThreadPlanToCallFunction(). /// /// Any of the methods that take arg_addr_ptr or arg_addr_ref can be passed /// a pointer set to LLDB_INVALID_ADDRESS and new structure will be allocated /// and its address returned in that variable. -/// +/// /// Any of the methods that take arg_addr_ptr can be passed NULL, and the /// argument space will be managed for you. -//---------------------------------------------------------------------- -class ClangFunctionCaller : public FunctionCaller -{ - friend class ASTStructExtractor; - - class ClangFunctionCallerHelper : public ClangExpressionHelper - { - public: - ClangFunctionCallerHelper (ClangFunctionCaller &owner) : - m_owner(owner) - { - } - - ~ClangFunctionCallerHelper() override = default; - - //------------------------------------------------------------------ - /// Return the object that the parser should use when resolving external - /// values. May be NULL if everything should be self-contained. - //------------------------------------------------------------------ - ClangExpressionDeclMap * - DeclMap() override - { - return NULL; - } - - //------------------------------------------------------------------ - /// Return the object that the parser should allow to access ASTs. - /// May be NULL if the ASTs do not need to be transformed. - /// - /// @param[in] passthrough - /// The ASTConsumer that the returned transformer should send - /// the ASTs to after transformation. - //------------------------------------------------------------------ - 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. - }; +//---------------------------------------------------------------------- +class ClangFunctionCaller : public FunctionCaller { + friend class ASTStructExtractor; + + class ClangFunctionCallerHelper : public ClangExpressionHelper { + public: + ClangFunctionCallerHelper(ClangFunctionCaller &owner) : m_owner(owner) {} + + ~ClangFunctionCallerHelper() override = default; -public: //------------------------------------------------------------------ - /// Constructor - /// - /// @param[in] exe_scope - /// An execution context scope that gets us at least a target and - /// process. - /// - /// @param[in] ast_context - /// The AST context to evaluate argument types in. - /// - /// @param[in] return_qualtype - /// An opaque Clang QualType for the function result. Should be - /// defined in ast_context. - /// - /// @param[in] function_address - /// The address of the function to call. - /// - /// @param[in] arg_value_list - /// The default values to use when calling this function. Can - /// be overridden using WriteFunctionArguments(). + /// Return the object that the parser should use when resolving external + /// values. May be NULL if everything should be self-contained. //------------------------------------------------------------------ - ClangFunctionCaller (ExecutionContextScope &exe_scope, - const CompilerType &return_type, - const Address& function_address, - const ValueList &arg_value_list, - const char *name); - - ~ClangFunctionCaller() override; + ClangExpressionDeclMap *DeclMap() override { return NULL; } //------------------------------------------------------------------ - /// Compile the wrapper function - /// - /// @param[in] thread_to_use_sp - /// Compilation might end up calling functions. Pass in the thread you - /// want the compilation to use. If you pass in an empty ThreadSP it will - /// use the currently selected thread. + /// Return the object that the parser should allow to access ASTs. + /// May be NULL if the ASTs do not need to be transformed. /// - /// @param[in] diagnostic_manager - /// The diagnostic manager to report parser errors to. - /// - /// @return - /// The number of errors. + /// @param[in] passthrough + /// The ASTConsumer that the returned transformer should send + /// the ASTs to after transformation. //------------------------------------------------------------------ - unsigned - CompileFunction (lldb::ThreadSP thread_to_use_sp, - DiagnosticManager &diagnostic_manager) override; + 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. + }; - ExpressionTypeSystemHelper * - GetTypeSystemHelper() override - { - return &m_type_system_helper; - } +public: + //------------------------------------------------------------------ + /// Constructor + /// + /// @param[in] exe_scope + /// An execution context scope that gets us at least a target and + /// process. + /// + /// @param[in] ast_context + /// The AST context to evaluate argument types in. + /// + /// @param[in] return_qualtype + /// An opaque Clang QualType for the function result. Should be + /// defined in ast_context. + /// + /// @param[in] function_address + /// The address of the function to call. + /// + /// @param[in] arg_value_list + /// The default values to use when calling this function. Can + /// be overridden using WriteFunctionArguments(). + //------------------------------------------------------------------ + ClangFunctionCaller(ExecutionContextScope &exe_scope, + const CompilerType &return_type, + const Address &function_address, + const ValueList &arg_value_list, const char *name); + + ~ClangFunctionCaller() override; + + //------------------------------------------------------------------ + /// Compile the wrapper function + /// + /// @param[in] thread_to_use_sp + /// Compilation might end up calling functions. Pass in the thread you + /// want the compilation to use. If you pass in an empty ThreadSP it will + /// use the currently selected thread. + /// + /// @param[in] diagnostic_manager + /// The diagnostic manager to report parser errors to. + /// + /// @return + /// The number of errors. + //------------------------------------------------------------------ + unsigned CompileFunction(lldb::ThreadSP thread_to_use_sp, + DiagnosticManager &diagnostic_manager) override; + + ExpressionTypeSystemHelper *GetTypeSystemHelper() override { + return &m_type_system_helper; + } protected: - const char *GetWrapperStructName() - { - return m_wrapper_struct_name.c_str(); - } + const char *GetWrapperStructName() { return m_wrapper_struct_name.c_str(); } private: - //------------------------------------------------------------------ - // For ClangFunctionCaller only - //------------------------------------------------------------------ + //------------------------------------------------------------------ + // For ClangFunctionCaller only + //------------------------------------------------------------------ - // Note: the parser needs to be destructed before the execution unit, so - // declare the execution unit first. - ClangFunctionCallerHelper m_type_system_helper; + // 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 |