summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ExpressionParser
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-04-10 20:48:55 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-04-10 20:48:55 +0000
commit8b3af63b8993e45b1783853a3fcf6f36bfbed81b (patch)
tree41759d08361beda32b90e345d8033aecd2e15088 /lldb/source/Plugins/ExpressionParser
parent66b6bb1766b3e5eea56b26fc91d03f1fccbe15e4 (diff)
downloadbcm5719-llvm-8b3af63b8993e45b1783853a3fcf6f36bfbed81b.tar.gz
bcm5719-llvm-8b3af63b8993e45b1783853a3fcf6f36bfbed81b.zip
[NFC] Remove ASCII lines from comments
A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser')
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h40
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.h28
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h64
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h66
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h8
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h16
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h26
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp4
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h12
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h10
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h4
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h12
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp4
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h8
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h92
18 files changed, 0 insertions, 400 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h
index b5242afcfbd..670ba6dce72 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.h
@@ -15,7 +15,6 @@
namespace lldb_private {
-//----------------------------------------------------------------------
/// \class ASTResultSynthesizer ASTResultSynthesizer.h
/// "lldb/Expression/ASTResultSynthesizer.h" Adds a result variable
/// declaration to the ASTs for an expression.
@@ -28,10 +27,8 @@ namespace lldb_private {
/// ASTResultSynthesizer's job is to add the variable and its initialization
/// to the ASTs for the expression, and it does so by acting as a SemaConsumer
/// for Clang.
-//----------------------------------------------------------------------
class ASTResultSynthesizer : public clang::SemaConsumer {
public:
- //----------------------------------------------------------------------
/// Constructor
///
/// \param[in] passthrough
@@ -47,25 +44,19 @@ public:
/// \param[in] target
/// The target, which contains the persistent variable store and the
/// AST importer.
- //----------------------------------------------------------------------
ASTResultSynthesizer(clang::ASTConsumer *passthrough, bool top_level,
Target &target);
- //----------------------------------------------------------------------
/// Destructor
- //----------------------------------------------------------------------
~ASTResultSynthesizer() override;
- //----------------------------------------------------------------------
/// Link this consumer with a particular AST context
///
/// \param[in] Context
/// This AST context will be used for types and identifiers, and also
/// forwarded to the passthrough consumer, if one exists.
- //----------------------------------------------------------------------
void Initialize(clang::ASTContext &Context) override;
- //----------------------------------------------------------------------
/// Examine a list of Decls to find the function $__lldb_expr and transform
/// its code
///
@@ -73,82 +64,58 @@ public:
/// The list of Decls to search. These may contain LinkageSpecDecls,
/// which need to be searched recursively. That job falls to
/// TransformTopLevelDecl.
- //----------------------------------------------------------------------
bool HandleTopLevelDecl(clang::DeclGroupRef D) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void HandleTranslationUnit(clang::ASTContext &Ctx) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void HandleTagDeclDefinition(clang::TagDecl *D) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void CompleteTentativeDefinition(clang::VarDecl *D) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void HandleVTable(clang::CXXRecordDecl *RD) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void PrintStats() override;
- //----------------------------------------------------------------------
/// Set the Sema object to use when performing transforms, and pass it on
///
/// \param[in] S
/// The Sema to use. Because Sema isn't externally visible, this class
/// casts it to an Action for actual use.
- //----------------------------------------------------------------------
void InitializeSema(clang::Sema &S) override;
- //----------------------------------------------------------------------
/// Reset the Sema to NULL now that transformations are done
- //----------------------------------------------------------------------
void ForgetSema() override;
- //----------------------------------------------------------------------
/// The parse has succeeded, so record its persistent decls
- //----------------------------------------------------------------------
void CommitPersistentDecls();
private:
- //----------------------------------------------------------------------
/// Hunt the given Decl for FunctionDecls named $__lldb_expr, recursing as
/// necessary through LinkageSpecDecls, and calling SynthesizeResult on
/// anything that was found
///
/// \param[in] D
/// The Decl to hunt.
- //----------------------------------------------------------------------
void TransformTopLevelDecl(clang::Decl *D);
- //----------------------------------------------------------------------
/// Process an Objective-C method and produce the result variable and
/// initialization
///
/// \param[in] MethodDecl
/// The method to process.
- //----------------------------------------------------------------------
bool SynthesizeObjCMethodResult(clang::ObjCMethodDecl *MethodDecl);
- //----------------------------------------------------------------------
/// Process a function and produce the result variable and initialization
///
/// \param[in] FunDecl
/// The function to process.
- //----------------------------------------------------------------------
bool SynthesizeFunctionResult(clang::FunctionDecl *FunDecl);
- //----------------------------------------------------------------------
/// Process a function body and produce the result variable and
/// initialization
///
@@ -158,35 +125,28 @@ private:
/// \param[in] DC
/// The DeclContext of the function, into which the result variable
/// is inserted.
- //----------------------------------------------------------------------
bool SynthesizeBodyResult(clang::CompoundStmt *Body, clang::DeclContext *DC);
- //----------------------------------------------------------------------
/// Given a DeclContext for a function or method, find all types declared in
/// the context and record any persistent types found.
///
/// \param[in] FunDeclCtx
/// The context for the function to process.
- //----------------------------------------------------------------------
void RecordPersistentTypes(clang::DeclContext *FunDeclCtx);
- //----------------------------------------------------------------------
/// Given a TypeDecl, if it declares a type whose name starts with a dollar
/// sign, register it as a pointer type in the target's scratch
/// AST context.
///
/// \param[in] Body
/// The body of the function.
- //----------------------------------------------------------------------
void MaybeRecordPersistentType(clang::TypeDecl *D);
- //----------------------------------------------------------------------
/// Given a NamedDecl, register it as a pointer type in the target's scratch
/// AST context.
///
/// \param[in] Body
/// The body of the function.
- //----------------------------------------------------------------------
void RecordPersistentDecl(clang::NamedDecl *D);
clang::ASTContext
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.h b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.h
index 33c06701539..7aef2e254e1 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.h
@@ -17,7 +17,6 @@
namespace lldb_private {
-//----------------------------------------------------------------------
/// \class ASTStructExtractor ASTStructExtractor.h
/// "lldb/Expression/ASTStructExtractor.h" Extracts and describes the argument
/// structure for a wrapped function.
@@ -32,10 +31,8 @@ namespace lldb_private {
/// The definition of this struct is itself in the body of the wrapper
/// function, so Clang does the structure layout itself. ASTStructExtractor
/// reads through the AST for the wrapper function and finds the struct.
-//----------------------------------------------------------------------
class ASTStructExtractor : public clang::SemaConsumer {
public:
- //----------------------------------------------------------------------
/// Constructor
///
/// \param[in] passthrough
@@ -52,25 +49,19 @@ public:
/// about the argument struct. ClangFunctionCaller friends
/// ASTStructExtractor
/// for this purpose.
- //----------------------------------------------------------------------
ASTStructExtractor(clang::ASTConsumer *passthrough, const char *struct_name,
ClangFunctionCaller &function);
- //----------------------------------------------------------------------
/// Destructor
- //----------------------------------------------------------------------
~ASTStructExtractor() override;
- //----------------------------------------------------------------------
/// Link this consumer with a particular AST context
///
/// \param[in] Context
/// This AST context will be used for types and identifiers, and also
/// forwarded to the passthrough consumer, if one exists.
- //----------------------------------------------------------------------
void Initialize(clang::ASTContext &Context) override;
- //----------------------------------------------------------------------
/// Examine a list of Decls to find the function $__lldb_expr and transform
/// its code
///
@@ -78,66 +69,47 @@ public:
/// The list of Decls to search. These may contain LinkageSpecDecls,
/// which need to be searched recursively. That job falls to
/// TransformTopLevelDecl.
- //----------------------------------------------------------------------
bool HandleTopLevelDecl(clang::DeclGroupRef D) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void HandleTranslationUnit(clang::ASTContext &Ctx) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void HandleTagDeclDefinition(clang::TagDecl *D) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void CompleteTentativeDefinition(clang::VarDecl *D) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void HandleVTable(clang::CXXRecordDecl *RD) override;
- //----------------------------------------------------------------------
/// Passthrough stub
- //----------------------------------------------------------------------
void PrintStats() override;
- //----------------------------------------------------------------------
/// Set the Sema object to use when performing transforms, and pass it on
///
/// \param[in] S
/// The Sema to use. Because Sema isn't externally visible, this class
/// casts it to an Action for actual use.
- //----------------------------------------------------------------------
void InitializeSema(clang::Sema &S) override;
- //----------------------------------------------------------------------
/// Reset the Sema to NULL now that transformations are done
- //----------------------------------------------------------------------
void ForgetSema() override;
private:
- //----------------------------------------------------------------------
/// Hunt the given FunctionDecl for the argument struct and place
/// information about it into m_function
///
/// \param[in] F
/// The FunctionDecl to hunt.
- //----------------------------------------------------------------------
void ExtractFromFunctionDecl(clang::FunctionDecl *F);
- //----------------------------------------------------------------------
/// Hunt the given Decl for FunctionDecls named the same as the wrapper
/// function name, recursing as necessary through LinkageSpecDecls, and
/// calling ExtractFromFunctionDecl on anything that was found
///
/// \param[in] D
/// The Decl to hunt.
- //----------------------------------------------------------------------
void ExtractFromTopLevelDecl(clang::Decl *D);
clang::ASTContext
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 1c8e3c7a68c..8d96dbbef93 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -32,10 +32,8 @@
using namespace clang;
using namespace lldb_private;
-//------------------------------------------------------------------
// Scoped class that will remove an active lexical decl from the set when it
// goes out of scope.
-//------------------------------------------------------------------
namespace {
class ScopedLexicalDeclEraser {
public:
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
index e12f1c5c770..09d08d545e2 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
@@ -22,7 +22,6 @@
namespace lldb_private {
-//----------------------------------------------------------------------
/// \class ClangASTSource ClangASTSource.h "lldb/Expression/ClangASTSource.h"
/// Provider for named objects defined in the debug info for Clang
///
@@ -31,28 +30,21 @@ namespace lldb_private {
/// knows the name it is looking for, but nothing else. The ExternalSemaSource
/// class provides Decls (VarDecl, FunDecl, TypeDecl) to Clang for these
/// names, consulting the ClangExpressionDeclMap to do the actual lookups.
-//----------------------------------------------------------------------
class ClangASTSource : public ClangExternalASTSourceCommon,
public ClangASTImporter::MapCompleter {
public:
- //------------------------------------------------------------------
/// Constructor
///
/// Initializes class variables.
///
/// \param[in] target
/// A reference to the target containing debug information to use.
- //------------------------------------------------------------------
ClangASTSource(const lldb::TargetSP &target);
- //------------------------------------------------------------------
/// Destructor
- //------------------------------------------------------------------
~ClangASTSource() override;
- //------------------------------------------------------------------
/// Interface stubs.
- //------------------------------------------------------------------
clang::Decl *GetExternalDecl(uint32_t) override { return NULL; }
clang::Stmt *GetExternalDeclStmt(uint64_t) override { return NULL; }
clang::Selector GetExternalSelector(uint32_t) override {
@@ -73,7 +65,6 @@ public:
// APIs for ExternalASTSource
//
- //------------------------------------------------------------------
/// Look up all Decls that match a particular name. Only handles
/// Identifiers and DeclContexts that are either NamespaceDecls or
/// TranslationUnitDecls. Calls SetExternalVisibleDeclsForName with the
@@ -90,11 +81,9 @@ public:
///
/// \return
/// Whatever SetExternalVisibleDeclsForName returns.
- //------------------------------------------------------------------
bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
clang::DeclarationName Name) override;
- //------------------------------------------------------------------
/// Enumerate all Decls in a given lexical context.
///
/// \param[in] DC
@@ -106,13 +95,11 @@ public:
///
/// \param[in] Decls
/// A vector that is filled in with matching Decls.
- //------------------------------------------------------------------
void FindExternalLexicalDecls(
const clang::DeclContext *DC,
llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
llvm::SmallVectorImpl<clang::Decl *> &Decls) override;
- //------------------------------------------------------------------
/// Specify the layout of the contents of a RecordDecl.
///
/// \param[in] Record
@@ -144,7 +131,6 @@ public:
///
/// \return
/// True <=> the layout is valid.
- //-----------------------------------------------------------------
bool layoutRecordType(
const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
@@ -153,37 +139,30 @@ public:
llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
&VirtualBaseOffsets) override;
- //------------------------------------------------------------------
/// Complete a TagDecl.
///
/// \param[in] Tag
/// The Decl to be completed in place.
- //------------------------------------------------------------------
void CompleteType(clang::TagDecl *Tag) override;
- //------------------------------------------------------------------
/// Complete an ObjCInterfaceDecl.
///
/// \param[in] Class
/// The Decl to be completed in place.
- //------------------------------------------------------------------
void CompleteType(clang::ObjCInterfaceDecl *Class) override;
- //------------------------------------------------------------------
/// Called on entering a translation unit. Tells Clang by calling
/// setHasExternalVisibleStorage() and setHasExternalLexicalStorage() that
/// this object has something to say about undefined names.
///
/// \param[in] ASTConsumer
/// Unused.
- //------------------------------------------------------------------
void StartTranslationUnit(clang::ASTConsumer *Consumer) override;
//
// APIs for NamespaceMapCompleter
//
- //------------------------------------------------------------------
/// Look up the modules containing a given namespace and put the appropriate
/// entries in the namespace map.
///
@@ -196,7 +175,6 @@ public:
/// \param[in] parent_map
/// The map for the namespace's parent namespace, if there is
/// one.
- //------------------------------------------------------------------
void CompleteNamespaceMap(
ClangASTImporter::NamespaceMapSP &namespace_map, ConstString name,
ClangASTImporter::NamespaceMapSP &parent_map) const override;
@@ -209,12 +187,10 @@ public:
AddNamespace(NameSearchContext &context,
ClangASTImporter::NamespaceMapSP &namespace_decls);
- //------------------------------------------------------------------
/// The worker function for FindExternalVisibleDeclsByName.
///
/// \param[in] context
/// The NameSearchContext to use when filing results.
- //------------------------------------------------------------------
virtual void FindExternalVisibleDecls(NameSearchContext &context);
void SetImportInProgress(bool import_in_progress) {
@@ -227,13 +203,11 @@ public:
}
bool GetLookupsEnabled() { return m_lookups_enabled; }
- //----------------------------------------------------------------------
/// \class ClangASTSourceProxy ClangASTSource.h
/// "lldb/Expression/ClangASTSource.h" Proxy for ClangASTSource
///
/// Clang AST contexts like to own their AST sources, so this is a state-
/// free proxy object.
- //----------------------------------------------------------------------
class ClangASTSourceProxy : public ClangExternalASTSourceCommon {
public:
ClangASTSourceProxy(ClangASTSource &original) : m_original(original) {}
@@ -294,7 +268,6 @@ public:
}
protected:
- //------------------------------------------------------------------
/// Look for the complete version of an Objective-C interface, and return it
/// if found.
///
@@ -304,11 +277,9 @@ protected:
/// \return
/// NULL if the complete interface couldn't be found;
/// the complete interface otherwise.
- //------------------------------------------------------------------
clang::ObjCInterfaceDecl *
GetCompleteObjCInterface(const clang::ObjCInterfaceDecl *interface_decl);
- //------------------------------------------------------------------
/// Find all entities matching a given name in a given module, using a
/// NameSearchContext to make Decls for them.
///
@@ -324,33 +295,27 @@ protected:
/// \param[in] current_id
/// The ID for the current FindExternalVisibleDecls invocation,
/// for logging purposes.
- //------------------------------------------------------------------
void FindExternalVisibleDecls(NameSearchContext &context,
lldb::ModuleSP module,
CompilerDeclContext &namespace_decl,
unsigned int current_id);
- //------------------------------------------------------------------
/// Find all Objective-C methods matching a given selector.
///
/// \param[in] context
/// The NameSearchContext that can construct Decls for this name.
/// Its m_decl_name contains the selector and its m_decl_context
/// is the containing object.
- //------------------------------------------------------------------
void FindObjCMethodDecls(NameSearchContext &context);
- //------------------------------------------------------------------
/// Find all Objective-C properties and ivars with a given name.
///
/// \param[in] context
/// The NameSearchContext that can construct Decls for this name.
/// Its m_decl_name contains the name and its m_decl_context
/// is the containing object.
- //------------------------------------------------------------------
void FindObjCPropertyAndIvarDecls(NameSearchContext &context);
- //------------------------------------------------------------------
/// A wrapper for ClangASTContext::CopyType that sets a flag that
/// indicates that we should not respond to queries during import.
///
@@ -366,11 +331,9 @@ protected:
///
/// \return
/// The imported type.
- //------------------------------------------------------------------
CompilerType GuardedCopyType(const CompilerType &src_type);
public:
- //------------------------------------------------------------------
/// Returns true if a name should be ignored by name lookup.
///
/// \param[in] name
@@ -382,11 +345,9 @@ public:
/// \return
/// True if the name is one of a class of names that are ignored by
/// global lookup for performance reasons.
- //------------------------------------------------------------------
bool IgnoreName(const ConstString name, bool ignore_all_dollar_names);
public:
- //------------------------------------------------------------------
/// Copies a single Decl into the parser's AST context.
///
/// \param[in] src_decl
@@ -394,10 +355,8 @@ public:
///
/// \return
/// A copy of the Decl in m_ast_context, or NULL if the copy failed.
- //------------------------------------------------------------------
clang::Decl *CopyDecl(clang::Decl *src_decl);
- //------------------------------------------------------------------
/// Copies a single Type to the target of the given ExternalASTMerger.
///
/// \param[in] src_context
@@ -412,12 +371,10 @@ public:
///
/// \return
/// A copy of the Type in the merger's target context.
- //------------------------------------------------------------------
clang::QualType CopyTypeWithMerger(clang::ASTContext &src_context,
clang::ExternalASTMerger &merger,
clang::QualType type);
- //------------------------------------------------------------------
/// Determined the origin of a single Decl, if it can be found.
///
/// \param[in] decl
@@ -431,20 +388,15 @@ public:
///
/// \return
/// True if lookup succeeded; false otherwise.
- //------------------------------------------------------------------
bool ResolveDeclOrigin(const clang::Decl *decl, clang::Decl **original_decl,
clang::ASTContext **original_ctx);
- //------------------------------------------------------------------
/// Returns m_merger_up. Only call this if the target is configured to use
/// modern lookup,
- //------------------------------------------------------------------
clang::ExternalASTMerger &GetMergerUnchecked();
- //------------------------------------------------------------------
/// Returns true if there is a merger. This only occurs if the target is
/// using modern lookup.
- //------------------------------------------------------------------
bool HasMerger() { return (bool)m_merger_up; }
protected:
@@ -470,7 +422,6 @@ protected:
std::set<const char *> m_active_lookups;
};
-//----------------------------------------------------------------------
/// \class NameSearchContext ClangASTSource.h
/// "lldb/Expression/ClangASTSource.h" Container for all objects relevant to a
/// single name lookup
@@ -478,7 +429,6 @@ protected:
/// LLDB needs to create Decls for entities it finds. This class communicates
/// what name is being searched for and provides helper functions to construct
/// Decls given appropriate type information.
-//----------------------------------------------------------------------
struct NameSearchContext {
ClangASTSource &m_ast_source; ///< The AST source making the request
llvm::SmallVectorImpl<clang::NamedDecl *>
@@ -503,7 +453,6 @@ struct NameSearchContext {
bool type : 1;
} m_found;
- //------------------------------------------------------------------
/// Constructor
///
/// Initializes class variables.
@@ -520,7 +469,6 @@ struct NameSearchContext {
///
/// \param[in] dc
/// The DeclContext to register Decls in.
- //------------------------------------------------------------------
NameSearchContext(ClangASTSource &astSource,
llvm::SmallVectorImpl<clang::NamedDecl *> &decls,
clang::DeclarationName &name, const clang::DeclContext *dc)
@@ -529,16 +477,13 @@ struct NameSearchContext {
memset(&m_found, 0, sizeof(m_found));
}
- //------------------------------------------------------------------
/// Create a VarDecl with the name being searched for and the provided type
/// and register it in the right places.
///
/// \param[in] type
/// The opaque QualType for the VarDecl being registered.
- //------------------------------------------------------------------
clang::NamedDecl *AddVarDecl(const CompilerType &type);
- //------------------------------------------------------------------
/// Create a FunDecl with the name being searched for and the provided type
/// and register it in the right places.
///
@@ -547,41 +492,32 @@ struct NameSearchContext {
///
/// \param[in] extern_c
/// If true, build an extern "C" linkage specification for this.
- //------------------------------------------------------------------
clang::NamedDecl *AddFunDecl(const CompilerType &type, bool extern_c = false);
- //------------------------------------------------------------------
/// Create a FunDecl with the name being searched for and generic type (i.e.
/// intptr_t NAME_GOES_HERE(...)) and register it in the right places.
- //------------------------------------------------------------------
clang::NamedDecl *AddGenericFunDecl();
- //------------------------------------------------------------------
/// Create a TypeDecl with the name being searched for and the provided type
/// and register it in the right places.
///
/// \param[in] compiler_type
/// The opaque QualType for the TypeDecl being registered.
- //------------------------------------------------------------------
clang::NamedDecl *AddTypeDecl(const CompilerType &compiler_type);
- //------------------------------------------------------------------
/// Add Decls from the provided DeclContextLookupResult to the list of
/// results.
///
/// \param[in] result
/// The DeclContextLookupResult, usually returned as the result
/// of querying a DeclContext.
- //------------------------------------------------------------------
void AddLookupResult(clang::DeclContextLookupResult result);
- //------------------------------------------------------------------
/// Add a NamedDecl to the list of results.
///
/// \param[in] decl
/// The NamedDecl, usually returned as the result
/// of querying a DeclContext.
- //------------------------------------------------------------------
void AddNamedDecl(clang::NamedDecl *decl);
};
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index 9d2dd225ae7..a7e2ced2c45 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -29,7 +29,6 @@
namespace lldb_private {
-//----------------------------------------------------------------------
/// \class ClangExpressionDeclMap ClangExpressionDeclMap.h
/// "lldb/Expression/ClangExpressionDeclMap.h" Manages named entities that are
/// defined in LLDB's debug information.
@@ -53,10 +52,8 @@ namespace lldb_private {
///
/// Fourth and finally, it "dematerializes" the struct after the JITted code
/// has has executed, placing the new values back where it found the old ones.
-//----------------------------------------------------------------------
class ClangExpressionDeclMap : public ClangASTSource {
public:
- //------------------------------------------------------------------
/// Constructor
///
/// Initializes class variables.
@@ -76,19 +73,15 @@ public:
/// \param[in] ctx_obj
/// If not empty, then expression is evaluated in context of this object.
/// See the comment to `UserExpression::Evaluate` for details.
- //------------------------------------------------------------------
ClangExpressionDeclMap(
bool keep_result_in_memory,
Materializer::PersistentVariableDelegate *result_delegate,
ExecutionContext &exe_ctx,
ValueObject *ctx_obj);
- //------------------------------------------------------------------
/// Destructor
- //------------------------------------------------------------------
~ClangExpressionDeclMap() override;
- //------------------------------------------------------------------
/// Enable the state needed for parsing and IR transformation.
///
/// \param[in] exe_ctx
@@ -101,26 +94,20 @@ public:
///
/// \return
/// True if parsing is possible; false if it is unsafe to continue.
- //------------------------------------------------------------------
bool WillParse(ExecutionContext &exe_ctx, Materializer *materializer);
void InstallCodeGenerator(clang::ASTConsumer *code_gen);
- //------------------------------------------------------------------
/// [Used by ClangExpressionParser] For each variable that had an unknown
/// type at the beginning of parsing, determine its final type now.
///
/// \return
/// True on success; false otherwise.
- //------------------------------------------------------------------
bool ResolveUnknownTypes();
- //------------------------------------------------------------------
/// Disable the state needed for parsing and IR transformation.
- //------------------------------------------------------------------
void DidParse();
- //------------------------------------------------------------------
/// [Used by IRForTarget] Add a variable to the list of persistent
/// variables for the process.
///
@@ -136,12 +123,10 @@ public:
///
/// \return
/// True on success; false otherwise.
- //------------------------------------------------------------------
bool AddPersistentVariable(const clang::NamedDecl *decl,
ConstString name, TypeFromParser type,
bool is_result, bool is_lvalue);
- //------------------------------------------------------------------
/// [Used by IRForTarget] Add a variable to the struct that needs to
/// be materialized each time the expression runs.
///
@@ -162,21 +147,17 @@ public:
///
/// \return
/// True on success; false otherwise.
- //------------------------------------------------------------------
bool AddValueToStruct(const clang::NamedDecl *decl, ConstString name,
llvm::Value *value, size_t size,
lldb::offset_t alignment);
- //------------------------------------------------------------------
/// [Used by IRForTarget] Finalize the struct, laying out the position of
/// each object in it.
///
/// \return
/// True on success; false otherwise.
- //------------------------------------------------------------------
bool DoStructLayout();
- //------------------------------------------------------------------
/// [Used by IRForTarget] Get general information about the laid-out struct
/// after DoStructLayout() has been called.
///
@@ -191,11 +172,9 @@ public:
///
/// \return
/// True if the information could be retrieved; false otherwise.
- //------------------------------------------------------------------
bool GetStructInfo(uint32_t &num_elements, size_t &size,
lldb::offset_t &alignment);
- //------------------------------------------------------------------
/// [Used by IRForTarget] Get specific information about one field of the
/// laid-out struct after DoStructLayout() has been called.
///
@@ -225,12 +204,10 @@ public:
///
/// \return
/// True if the information could be retrieved; false otherwise.
- //------------------------------------------------------------------
bool GetStructElement(const clang::NamedDecl *&decl, llvm::Value *&value,
lldb::offset_t &offset, ConstString &name,
uint32_t index);
- //------------------------------------------------------------------
/// [Used by IRForTarget] Get information about a function given its Decl.
///
/// \param[in] decl
@@ -242,10 +219,8 @@ public:
///
/// \return
/// True if the information could be retrieved; false otherwise.
- //------------------------------------------------------------------
bool GetFunctionInfo(const clang::NamedDecl *decl, uint64_t &ptr);
- //------------------------------------------------------------------
/// [Used by IRForTarget] Get the address of a symbol given nothing but its
/// name.
///
@@ -266,7 +241,6 @@ public:
///
/// \return
/// Valid load address for the symbol
- //------------------------------------------------------------------
lldb::addr_t GetSymbolAddress(Target &target, Process *process,
ConstString name,
lldb::SymbolType symbol_type,
@@ -275,7 +249,6 @@ public:
lldb::addr_t GetSymbolAddress(ConstString name,
lldb::SymbolType symbol_type);
- //------------------------------------------------------------------
/// [Used by IRInterpreter] Get basic target information.
///
/// \param[out] byte_order
@@ -287,7 +260,6 @@ public:
/// \return
/// True if the information could be determined; false
/// otherwise.
- //------------------------------------------------------------------
struct TargetInfo {
lldb::ByteOrder byte_order;
size_t address_byte_size;
@@ -300,7 +272,6 @@ public:
};
TargetInfo GetTargetInfo();
- //------------------------------------------------------------------
/// [Used by ClangASTSource] Find all entities matching a given name, using
/// a NameSearchContext to make Decls for them.
///
@@ -309,10 +280,8 @@ public:
///
/// \return
/// True on success; false otherwise.
- //------------------------------------------------------------------
void FindExternalVisibleDecls(NameSearchContext &context) override;
- //------------------------------------------------------------------
/// Find all entities matching a given name in a given module/namespace,
/// using a NameSearchContext to make Decls for them.
///
@@ -331,7 +300,6 @@ public:
///
/// \return
/// True on success; false otherwise.
- //------------------------------------------------------------------
void FindExternalVisibleDecls(NameSearchContext &context,
lldb::ModuleSP module,
CompilerDeclContext &namespace_decl,
@@ -353,9 +321,7 @@ private:
///For details see the comment to
///`UserExpression::Evaluate`.
- //----------------------------------------------------------------------
/// The following values should not live beyond parsing
- //----------------------------------------------------------------------
class ParserVars {
public:
ParserVars() {}
@@ -388,23 +354,17 @@ private:
std::unique_ptr<ParserVars> m_parser_vars;
- //----------------------------------------------------------------------
/// Activate parser-specific variables
- //----------------------------------------------------------------------
void EnableParserVars() {
if (!m_parser_vars.get())
m_parser_vars = llvm::make_unique<ParserVars>();
}
- //----------------------------------------------------------------------
/// Deallocate parser-specific variables
- //----------------------------------------------------------------------
void DisableParserVars() { m_parser_vars.reset(); }
- //----------------------------------------------------------------------
/// The following values contain layout information for the materialized
/// struct, but are not specific to a single materialization
- //----------------------------------------------------------------------
struct StructVars {
StructVars()
: m_struct_alignment(0), m_struct_size(0), m_struct_laid_out(false),
@@ -424,26 +384,19 @@ private:
std::unique_ptr<StructVars> m_struct_vars;
- //----------------------------------------------------------------------
/// Activate struct variables
- //----------------------------------------------------------------------
void EnableStructVars() {
if (!m_struct_vars.get())
m_struct_vars.reset(new struct StructVars);
}
- //----------------------------------------------------------------------
/// Deallocate struct variables
- //----------------------------------------------------------------------
void DisableStructVars() { m_struct_vars.reset(); }
- //----------------------------------------------------------------------
/// Get this parser's ID for use in extracting parser- and JIT-specific data
/// from persistent variables.
- //----------------------------------------------------------------------
uint64_t GetParserID() { return (uint64_t) this; }
- //------------------------------------------------------------------
/// Given a target, find a variable that matches the given name and type.
///
/// \param[in] target
@@ -465,13 +418,11 @@ private:
///
/// \return
/// The LLDB Variable found, or NULL if none was found.
- //------------------------------------------------------------------
lldb::VariableSP FindGlobalVariable(Target &target, lldb::ModuleSP &module,
ConstString name,
CompilerDeclContext *namespace_decl,
TypeFromUser *type = NULL);
- //------------------------------------------------------------------
/// Get the value of a variable in a given execution context and return the
/// associated Types if needed.
///
@@ -496,13 +447,11 @@ private:
///
/// \return
/// Return true if the value was successfully filled in.
- //------------------------------------------------------------------
bool GetVariableValue(lldb::VariableSP &var,
lldb_private::Value &var_location,
TypeFromUser *found_type = NULL,
TypeFromParser *parser_type = NULL);
- //------------------------------------------------------------------
/// Use the NameSearchContext to generate a Decl for the given LLDB
/// Variable, and put it in the Tuple list.
///
@@ -514,11 +463,9 @@ private:
///
/// \param[in] valobj
/// The LLDB ValueObject for that variable.
- //------------------------------------------------------------------
void AddOneVariable(NameSearchContext &context, lldb::VariableSP var,
lldb::ValueObjectSP valobj, unsigned int current_id);
- //------------------------------------------------------------------
/// Use the NameSearchContext to generate a Decl for the given persistent
/// variable, and put it in the list of found entities.
///
@@ -531,12 +478,10 @@ private:
/// \param[in] current_id
/// The ID of the current invocation of FindExternalVisibleDecls
/// for logging purposes.
- //------------------------------------------------------------------
void AddOneVariable(NameSearchContext &context,
lldb::ExpressionVariableSP &pvar_sp,
unsigned int current_id);
- //------------------------------------------------------------------
/// Use the NameSearchContext to generate a Decl for the given LLDB symbol
/// (treated as a variable), and put it in the list of found entities.
///
@@ -545,11 +490,9 @@ private:
///
/// \param[in] var
/// The LLDB Variable that needs a Decl.
- //------------------------------------------------------------------
void AddOneGenericVariable(NameSearchContext &context, const Symbol &symbol,
unsigned int current_id);
- //------------------------------------------------------------------
/// Use the NameSearchContext to generate a Decl for the given function.
/// (Functions are not placed in the Tuple list.) Can handle both fully
/// typed functions and generic functions.
@@ -564,11 +507,9 @@ private:
/// \param[in] sym
/// The Symbol that corresponds to a function that needs to be
/// created with generic type (unitptr_t foo(...)).
- //------------------------------------------------------------------
void AddOneFunction(NameSearchContext &context, Function *fun, Symbol *sym,
unsigned int current_id);
- //------------------------------------------------------------------
/// Use the NameSearchContext to generate a Decl for the given register.
///
/// \param[in] context
@@ -576,11 +517,9 @@ private:
///
/// \param[in] reg_info
/// The information corresponding to that register.
- //------------------------------------------------------------------
void AddOneRegister(NameSearchContext &context, const RegisterInfo *reg_info,
unsigned int current_id);
- //------------------------------------------------------------------
/// Use the NameSearchContext to generate a Decl for the given type. (Types
/// are not placed in the Tuple list.)
///
@@ -589,11 +528,9 @@ private:
///
/// \param[in] type
/// The type that needs to be created.
- //------------------------------------------------------------------
void AddOneType(NameSearchContext &context, const TypeFromUser &type,
unsigned int current_id);
- //------------------------------------------------------------------
/// Generate a Decl for "*this" and add a member function declaration to it
/// for the expression, then report it.
///
@@ -602,11 +539,9 @@ private:
///
/// \param[in] type
/// The type for *this.
- //------------------------------------------------------------------
void AddThisType(NameSearchContext &context, const TypeFromUser &type,
unsigned int current_id);
- //------------------------------------------------------------------
/// Move a type out of the current ASTContext into another, but make sure to
/// export all components of the type also.
///
@@ -619,7 +554,6 @@ private:
///
/// \return
/// Returns the moved type, or an empty type if there was a problem.
- //------------------------------------------------------------------
TypeFromUser DeportType(ClangASTContext &target, ClangASTContext &source,
TypeFromParser parser_type);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
index 40e56637cfe..48da5abb912 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
@@ -23,9 +23,7 @@ namespace lldb_private {
class RecordingMemoryManager;
-//----------------------------------------------------------------------
// ClangExpressionHelper
-//----------------------------------------------------------------------
class ClangExpressionHelper : public ExpressionTypeSystemHelper {
public:
static bool classof(const ExpressionTypeSystemHelper *ts) {
@@ -36,25 +34,19 @@ public:
: ExpressionTypeSystemHelper(
ExpressionTypeSystemHelper::LLVMCastKind::eKindClangHelper) {}
- //------------------------------------------------------------------
/// Destructor
- //------------------------------------------------------------------
virtual ~ClangExpressionHelper() {}
- //------------------------------------------------------------------
/// Return the object that the parser should use when resolving external
/// values. May be NULL if everything should be self-contained.
- //------------------------------------------------------------------
virtual ClangExpressionDeclMap *DeclMap() = 0;
- //------------------------------------------------------------------
/// 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.
- //------------------------------------------------------------------
virtual clang::ASTConsumer *
ASTTransformer(clang::ASTConsumer *passthrough) = 0;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index f9ddb75ade9..46b711d2a0d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -613,13 +613,11 @@ ClangExpressionParser::~ClangExpressionParser() {}
namespace {
-//----------------------------------------------------------------------
/// \class CodeComplete
///
/// A code completion consumer for the clang Sema that is responsible for
/// creating the completion suggestions when a user requests completion
/// of an incomplete `expr` invocation.
-//----------------------------------------------------------------------
class CodeComplete : public CodeCompleteConsumer {
CodeCompletionTUInfo m_info;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
index 610008efdd4..a42c2190ffb 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
@@ -27,7 +27,6 @@ namespace lldb_private {
class IRExecutionUnit;
-//----------------------------------------------------------------------
/// \class ClangExpressionParser ClangExpressionParser.h
/// "lldb/Expression/ClangExpressionParser.h" Encapsulates an instance of
/// Clang that can parse expressions.
@@ -37,10 +36,8 @@ class IRExecutionUnit;
/// as a glorified parameter list, performing the required parsing and
/// conversion to formats (DWARF bytecode, or JIT compiled machine code) that
/// can be executed.
-//----------------------------------------------------------------------
class ClangExpressionParser : public ExpressionParser {
public:
- //------------------------------------------------------------------
/// Constructor
///
/// Initializes class variables.
@@ -56,20 +53,16 @@ public:
/// @param[in] include_directories
/// List of include directories that should be used when parsing the
/// expression.
- //------------------------------------------------------------------
ClangExpressionParser(ExecutionContextScope *exe_scope, Expression &expr,
bool generate_debug_info,
std::vector<ConstString> include_directories = {});
- //------------------------------------------------------------------
/// Destructor
- //------------------------------------------------------------------
~ClangExpressionParser() override;
bool Complete(CompletionRequest &request, unsigned line, unsigned pos,
unsigned typed_pos) override;
- //------------------------------------------------------------------
/// Parse a single expression and convert it to IR using Clang. Don't wrap
/// the expression in anything at all.
///
@@ -79,12 +72,10 @@ public:
/// \return
/// The number of errors encountered during parsing. 0 means
/// success.
- //------------------------------------------------------------------
unsigned Parse(DiagnosticManager &diagnostic_manager) override;
bool RewriteExpression(DiagnosticManager &diagnostic_manager) override;
- //------------------------------------------------------------------
/// Ready an already-parsed expression for execution, possibly evaluating it
/// statically.
///
@@ -120,14 +111,12 @@ public:
/// \return
/// An error code indicating the success or failure of the operation.
/// Test with Success().
- //------------------------------------------------------------------
Status
PrepareForExecution(lldb::addr_t &func_addr, lldb::addr_t &func_end,
lldb::IRExecutionUnitSP &execution_unit_sp,
ExecutionContext &exe_ctx, bool &can_interpret,
lldb_private::ExecutionPolicy execution_policy) override;
- //------------------------------------------------------------------
/// Run all static initializers for an execution unit.
///
/// \param[in] execution_unit_sp
@@ -138,11 +127,9 @@ public:
///
/// \return
/// The error code indicating the
- //------------------------------------------------------------------
Status RunStaticInitializers(lldb::IRExecutionUnitSP &execution_unit_sp,
ExecutionContext &exe_ctx);
- //------------------------------------------------------------------
/// Returns a string representing current ABI.
///
/// \param[in] target_arch
@@ -150,11 +137,9 @@ public:
///
/// \return
/// A string representing target ABI for the current architecture.
- //-------------------------------------------------------------------
std::string GetClangTargetABI(const ArchSpec &target_arch);
private:
- //------------------------------------------------------------------
/// Parses the expression.
///
/// \param[in] diagnostic_manager
@@ -175,7 +160,6 @@ private:
///
/// \return
/// The number of parsing errors.
- //-------------------------------------------------------------------
unsigned ParseInternal(DiagnosticManager &diagnostic_manager,
clang::CodeCompleteConsumer *completion = nullptr,
unsigned completion_line = 0,
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
index a81f42dff61..bb5e6e79870 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
@@ -34,7 +34,6 @@ namespace lldb_private {
class ValueObjectConstResult;
-//----------------------------------------------------------------------
/// \class ClangExpressionVariable ClangExpressionVariable.h
/// "lldb/Expression/ClangExpressionVariable.h" Encapsulates one variable for
/// the expression parser.
@@ -55,7 +54,6 @@ class ValueObjectConstResult;
///
/// This class supports all of these use cases using simple type polymorphism,
/// and provides necessary support methods. Its interface is RTTI-neutral.
-//----------------------------------------------------------------------
class ClangExpressionVariable : public ExpressionVariable {
public:
ClangExpressionVariable(ExecutionContextScope *exe_scope,
@@ -71,12 +69,9 @@ public:
const TypeFromUser &user_type,
lldb::ByteOrder byte_order, uint32_t addr_byte_size);
- //----------------------------------------------------------------------
/// Utility functions for dealing with ExpressionVariableLists in Clang-
/// specific ways
- //----------------------------------------------------------------------
- //----------------------------------------------------------------------
/// Finds a variable by NamedDecl in the list.
///
/// \param[in] name
@@ -84,7 +79,6 @@ public:
///
/// \return
/// The variable requested, or NULL if that variable is not in the list.
- //----------------------------------------------------------------------
static ClangExpressionVariable *
FindVariableInList(ExpressionVariableList &list, const clang::NamedDecl *decl,
uint64_t parser_id) {
@@ -104,7 +98,6 @@ public:
return nullptr;
}
- //----------------------------------------------------------------------
/// If the variable contains its own data, make a Value point at it. If \a
/// exe_ctx in not NULL, the value will be resolved in with that execution
/// context.
@@ -118,12 +111,9 @@ public:
/// \return
/// True on success; false otherwise (in particular, if this variable
/// does not contain its own data).
- //----------------------------------------------------------------------
bool PointValueAtData(Value &value, ExecutionContext *exe_ctx);
- //----------------------------------------------------------------------
/// The following values should not live beyond parsing
- //----------------------------------------------------------------------
class ParserVars {
public:
ParserVars()
@@ -148,22 +138,16 @@ private:
ParserVarMap m_parser_vars;
public:
- //----------------------------------------------------------------------
/// Make this variable usable by the parser by allocating space for parser-
/// specific variables
- //----------------------------------------------------------------------
void EnableParserVars(uint64_t parser_id) {
m_parser_vars.insert(std::make_pair(parser_id, ParserVars()));
}
- //----------------------------------------------------------------------
/// Deallocate parser-specific variables
- //----------------------------------------------------------------------
void DisableParserVars(uint64_t parser_id) { m_parser_vars.erase(parser_id); }
- //----------------------------------------------------------------------
/// Access parser-specific variables
- //----------------------------------------------------------------------
ParserVars *GetParserVars(uint64_t parser_id) {
ParserVarMap::iterator i = m_parser_vars.find(parser_id);
@@ -173,9 +157,7 @@ public:
return &i->second;
}
- //----------------------------------------------------------------------
/// The following values are valid if the variable is used by JIT code
- //----------------------------------------------------------------------
struct JITVars {
JITVars() : m_alignment(0), m_size(0), m_offset(0) {}
@@ -191,17 +173,13 @@ private:
JITVarMap m_jit_vars;
public:
- //----------------------------------------------------------------------
/// Make this variable usable for materializing for the JIT by allocating
/// space for JIT-specific variables
- //----------------------------------------------------------------------
void EnableJITVars(uint64_t parser_id) {
m_jit_vars.insert(std::make_pair(parser_id, JITVars()));
}
- //----------------------------------------------------------------------
/// Deallocate JIT-specific variables
- //----------------------------------------------------------------------
void DisableJITVars(uint64_t parser_id) { m_jit_vars.erase(parser_id); }
JITVars *GetJITVars(uint64_t parser_id) {
@@ -215,16 +193,12 @@ public:
TypeFromUser GetTypeFromUser();
- //------------------------------------------------------------------
// llvm casting support
- //------------------------------------------------------------------
static bool classof(const ExpressionVariable *ev) {
return ev->getKind() == ExpressionVariable::eKindClang;
}
- //----------------------------------------------------------------------
/// Members
- //----------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ClangExpressionVariable);
};
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
index 27672078c92..eabc96aa8e5 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
@@ -42,9 +42,7 @@
using namespace lldb_private;
-//----------------------------------------------------------------------
// ClangFunctionCaller constructor
-//----------------------------------------------------------------------
ClangFunctionCaller::ClangFunctionCaller(ExecutionContextScope &exe_scope,
const CompilerType &return_type,
const Address &functionAddress,
@@ -58,9 +56,7 @@ ClangFunctionCaller::ClangFunctionCaller(ExecutionContextScope &exe_scope,
assert(m_jit_process_wp.lock());
}
-//----------------------------------------------------------------------
// Destructor
-//----------------------------------------------------------------------
ClangFunctionCaller::~ClangFunctionCaller() {}
unsigned
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
index 4b0e5869b4e..bdcead230c5 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
@@ -24,7 +24,6 @@ namespace lldb_private {
class ASTStructExtractor;
class ClangExpressionParser;
-//----------------------------------------------------------------------
/// \class ClangFunctionCaller ClangFunctionCaller.h
/// "lldb/Expression/ClangFunctionCaller.h" Encapsulates a function that can
/// be called.
@@ -57,7 +56,6 @@ class ClangExpressionParser;
///
/// 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;
@@ -72,20 +70,16 @@ class ClangFunctionCaller : public FunctionCaller {
~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;
@@ -98,7 +92,6 @@ class ClangFunctionCaller : public FunctionCaller {
};
public:
- //------------------------------------------------------------------
/// Constructor
///
/// \param[in] exe_scope
@@ -118,7 +111,6 @@ public:
/// \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,
@@ -126,7 +118,6 @@ public:
~ClangFunctionCaller() override;
- //------------------------------------------------------------------
/// Compile the wrapper function
///
/// \param[in] thread_to_use_sp
@@ -139,7 +130,6 @@ public:
///
/// \return
/// The number of errors.
- //------------------------------------------------------------------
unsigned CompileFunction(lldb::ThreadSP thread_to_use_sp,
DiagnosticManager &diagnostic_manager) override;
@@ -151,9 +141,7 @@ protected:
const char *GetWrapperStructName() { return m_wrapper_struct_name.c_str(); }
private:
- //------------------------------------------------------------------
// For ClangFunctionCaller only
- //------------------------------------------------------------------
// Note: the parser needs to be destructed before the execution unit, so
// declare the execution unit first.
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
index 18850870eaf..d5c8757bdcd 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
@@ -21,9 +21,7 @@ namespace lldb_private {
class ClangModulesDeclVendor : public DeclVendor {
public:
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
ClangModulesDeclVendor();
~ClangModulesDeclVendor() override;
@@ -34,7 +32,6 @@ public:
typedef uintptr_t ModuleID;
typedef std::vector<ModuleID> ModuleVector;
- //------------------------------------------------------------------
/// Add a module to the list of modules to search.
///
/// \param[in] module
@@ -53,12 +50,10 @@ public:
/// True if the module could be loaded; false if not. If the
/// compiler encountered a fatal error during a previous module
/// load, then this will always return false for this ModuleImporter.
- //------------------------------------------------------------------
virtual bool AddModule(const SourceModule &module,
ModuleVector *exported_modules,
Stream &error_stream) = 0;
- //------------------------------------------------------------------
/// Add all modules referred to in a given compilation unit to the list
/// of modules to search.
///
@@ -78,12 +73,10 @@ public:
/// loaded; false if one could not be loaded. If the compiler
/// encountered a fatal error during a previous module
/// load, then this will always return false for this ModuleImporter.
- //------------------------------------------------------------------
virtual bool AddModulesForCompileUnit(CompileUnit &cu,
ModuleVector &exported_modules,
Stream &error_stream) = 0;
- //------------------------------------------------------------------
/// Enumerate all the macros that are defined by a given set of modules
/// that are already imported.
///
@@ -97,12 +90,10 @@ public:
/// #define directive). #undef directives are not included; we simply
/// elide any corresponding #define. If this function returns true,
/// we stop the iteration immediately.
- //------------------------------------------------------------------
virtual void
ForEachMacro(const ModuleVector &modules,
std::function<bool(const std::string &)> handler) = 0;
- //------------------------------------------------------------------
/// Query whether Clang supports modules for a particular language.
/// LLDB uses this to decide whether to try to find the modules loaded
/// by a given compile unit.
@@ -112,7 +103,6 @@ public:
///
/// \return
/// True if Clang has modules for the given language.
- //------------------------------------------------------------------
static bool LanguageSupportsClangModules(lldb::LanguageType language);
};
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
index 77ecbe71d2e..9a8108d4b37 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
@@ -18,7 +18,6 @@
namespace lldb_private {
-//----------------------------------------------------------------------
/// \class ClangPersistentVariables ClangPersistentVariables.h
/// "lldb/Expression/ClangPersistentVariables.h" Manages persistent values
/// that need to be preserved between expression invocations.
@@ -26,16 +25,13 @@ namespace lldb_private {
/// A list of variables that can be accessed and updated by any expression. See
/// ClangPersistentVariable for more discussion. Also provides an increasing,
/// 0-based counter for naming result variables.
-//----------------------------------------------------------------------
class ClangPersistentVariables : public PersistentExpressionState {
public:
ClangPersistentVariables();
~ClangPersistentVariables() override = default;
- //------------------------------------------------------------------
// llvm casting support
- //------------------------------------------------------------------
static bool classof(const PersistentExpressionState *pv) {
return pv->getKind() == PersistentExpressionState::eKindClang;
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index adad54ad228..42de8c4a5e6 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -686,7 +686,6 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
return true;
}
-//------------------------------------------------------------------
/// Converts an absolute position inside a given code string into
/// a column/line pair.
///
@@ -704,7 +703,6 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager,
/// \param[out] column
/// The column in the line that contains the absolute position.
/// The first character in a line is indexed as 0.
-//------------------------------------------------------------------
static void AbsPosToLineColumnPos(size_t abs_pos, llvm::StringRef code,
unsigned &line, unsigned &column) {
// Reset to code position to beginning of the file.
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
index 3bfb9529b39..7cf15536649 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -28,7 +28,6 @@
namespace lldb_private {
-//----------------------------------------------------------------------
/// \class ClangUserExpression ClangUserExpression.h
/// "lldb/Expression/ClangUserExpression.h" Encapsulates a single expression
/// for use with Clang
@@ -37,7 +36,6 @@ namespace lldb_private {
/// and as a backend for the expr command. ClangUserExpression encapsulates
/// the objects needed to parse and interpret or JIT an expression. It uses
/// the Clang parser to produce LLVM IR from the expression.
-//----------------------------------------------------------------------
class ClangUserExpression : public LLVMUserExpression {
public:
/// LLVM-style RTTI support.
@@ -54,10 +52,8 @@ public:
~ClangUserExpressionHelper() 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 m_expr_decl_map_up.get();
}
@@ -69,14 +65,12 @@ public:
bool keep_result_in_memory,
ValueObject *ctx_obj);
- //------------------------------------------------------------------
/// 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;
@@ -93,7 +87,6 @@ public:
bool m_top_level;
};
- //------------------------------------------------------------------
/// Constructor
///
/// \param[in] expr
@@ -116,7 +109,6 @@ public:
/// The object (if any) in which context the expression
/// must be evaluated. For details see the comment to
/// `UserExpression::Evaluate`.
- //------------------------------------------------------------------
ClangUserExpression(ExecutionContextScope &exe_scope, llvm::StringRef expr,
llvm::StringRef prefix, lldb::LanguageType language,
ResultType desired_type,
@@ -125,7 +117,6 @@ public:
~ClangUserExpression() override;
- //------------------------------------------------------------------
/// Parse the expression
///
/// \param[in] diagnostic_manager
@@ -145,7 +136,6 @@ public:
///
/// \return
/// True on success (no errors); false otherwise.
- //------------------------------------------------------------------
bool Parse(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
bool keep_result_in_memory, bool generate_debug_info) override;
@@ -175,10 +165,8 @@ public:
bool DidImportCxxModules() const { return m_imported_cpp_modules; }
private:
- //------------------------------------------------------------------
/// Populate m_in_cplusplus_method and m_in_objectivec_method based on the
/// environment.
- //------------------------------------------------------------------
void ScanContext(ExecutionContext &exe_ctx,
lldb_private::Status &err) override;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
index 780aefdf95f..684cffd815e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -29,7 +29,6 @@
using namespace lldb_private;
-//------------------------------------------------------------------
/// Constructor
///
/// \param[in] text
@@ -37,7 +36,6 @@ using namespace lldb_private;
///
/// \param[in] name
/// The name of the function, as used in the text.
-//------------------------------------------------------------------
ClangUtilityFunction::ClangUtilityFunction(ExecutionContextScope &exe_scope,
const char *text, const char *name)
: UtilityFunction(exe_scope, text, name, eKindClangUtilityFunction) {
@@ -48,7 +46,6 @@ ClangUtilityFunction::ClangUtilityFunction(ExecutionContextScope &exe_scope,
ClangUtilityFunction::~ClangUtilityFunction() {}
-//------------------------------------------------------------------
/// Install the utility function into a process
///
/// \param[in] diagnostic_manager
@@ -59,7 +56,6 @@ ClangUtilityFunction::~ClangUtilityFunction() {}
///
/// \return
/// True on success (no errors); false otherwise.
-//------------------------------------------------------------------
bool ClangUtilityFunction::Install(DiagnosticManager &diagnostic_manager,
ExecutionContext &exe_ctx) {
if (m_jit_start_addr != LLDB_INVALID_ADDRESS) {
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
index d6769562d7b..70ebb2f3ad8 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
@@ -22,7 +22,6 @@
namespace lldb_private {
-//----------------------------------------------------------------------
/// \class ClangUtilityFunction ClangUtilityFunction.h
/// "lldb/Expression/ClangUtilityFunction.h" Encapsulates a single expression
/// for use with Clang
@@ -33,7 +32,6 @@ namespace lldb_private {
/// functions can perform error-checking for ClangUserExpressions, or can
/// simply provide a way to push a function into the target for the debugger
/// to call later on.
-//----------------------------------------------------------------------
class ClangUtilityFunction : public UtilityFunction {
public:
/// LLVM-style RTTI support.
@@ -47,10 +45,8 @@ public:
~ClangUtilityFunctionHelper() override {}
- //------------------------------------------------------------------
/// 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 m_expr_decl_map_up.get();
}
@@ -59,14 +55,12 @@ public:
void ResetDeclMap(ExecutionContext &exe_ctx, bool keep_result_in_memory);
- //------------------------------------------------------------------
/// 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 {
return nullptr;
@@ -75,7 +69,6 @@ public:
private:
std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map_up;
};
- //------------------------------------------------------------------
/// Constructor
///
/// \param[in] text
@@ -83,7 +76,6 @@ public:
///
/// \param[in] name
/// The name of the function, as used in the text.
- //------------------------------------------------------------------
ClangUtilityFunction(ExecutionContextScope &exe_scope, const char *text,
const char *name);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
index de3e1457703..f87fd8ac32c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h
@@ -43,7 +43,6 @@ class IRExecutionUnit;
class IRMemoryMap;
}
-//----------------------------------------------------------------------
/// \class IRForTarget IRForTarget.h "lldb/Expression/IRForTarget.h"
/// Transforms the IR for a function to run in the target
///
@@ -55,12 +54,10 @@ class IRMemoryMap;
/// transformations to the IR which make it relocatable. These
/// transformations are discussed in more detail next to their relevant
/// functions.
-//----------------------------------------------------------------------
class IRForTarget : public llvm::ModulePass {
public:
enum class LookupResult { Success, Fail, Ignore };
- //------------------------------------------------------------------
/// Constructor
///
/// \param[in] decl_map
@@ -90,18 +87,14 @@ public:
///
/// \param[in] func_name
/// The name of the function to prepare for execution in the target.
- //------------------------------------------------------------------
IRForTarget(lldb_private::ClangExpressionDeclMap *decl_map, bool resolve_vars,
lldb_private::IRExecutionUnit &execution_unit,
lldb_private::Stream &error_stream,
const char *func_name = "$__lldb_expr");
- //------------------------------------------------------------------
/// Destructor
- //------------------------------------------------------------------
~IRForTarget() override;
- //------------------------------------------------------------------
/// Run this IR transformer on a single module
///
/// Implementation of the llvm::ModulePass::runOnModule() function.
@@ -117,28 +110,22 @@ public:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool runOnModule(llvm::Module &llvm_module) override;
- //------------------------------------------------------------------
/// Interface stub
///
/// Implementation of the llvm::ModulePass::assignPassManager() function.
- //------------------------------------------------------------------
void assignPassManager(llvm::PMStack &pass_mgr_stack,
llvm::PassManagerType pass_mgr_type =
llvm::PMT_ModulePassManager) override;
- //------------------------------------------------------------------
/// Returns PMT_ModulePassManager
///
/// Implementation of the llvm::ModulePass::getPotentialPassManagerType()
/// function.
- //------------------------------------------------------------------
llvm::PassManagerType getPotentialPassManagerType() const override;
private:
- //------------------------------------------------------------------
/// Ensures that the current function's linkage is set to external.
/// Otherwise the JIT may not return an address for it.
///
@@ -147,15 +134,11 @@ private:
///
/// \return
/// True on success; false otherwise.
- //------------------------------------------------------------------
bool FixFunctionLinkage(llvm::Function &llvm_function);
- //------------------------------------------------------------------
/// A module-level pass to replace all function pointers with their
/// integer equivalents.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] llvm_module
@@ -166,15 +149,11 @@ private:
///
/// \return
/// True on success; false otherwise.
- //------------------------------------------------------------------
bool HasSideEffects(llvm::Function &llvm_function);
- //------------------------------------------------------------------
/// A function-level pass to check whether the function has side
/// effects.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Get the address of a function, and a location to put the complete Value
/// of the function if one is available.
///
@@ -193,18 +172,14 @@ private:
///
/// \return
/// The pointer.
- //------------------------------------------------------------------
LookupResult GetFunctionAddress(llvm::Function *function, uint64_t &ptr,
lldb_private::ConstString &name,
llvm::Constant **&value_ptr);
- //------------------------------------------------------------------
/// A function-level pass to take the generated global value
/// $__lldb_expr_result and make it into a persistent variable. Also see
/// ASTResultSynthesizer.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Find the NamedDecl corresponding to a Value. This interface is exposed
/// for the IR interpreter.
///
@@ -216,7 +191,6 @@ private:
///
/// \return
/// The corresponding variable declaration
- //------------------------------------------------------------------
public:
static clang::NamedDecl *DeclForGlobal(const llvm::GlobalValue *global_val,
llvm::Module *module);
@@ -224,7 +198,6 @@ public:
private:
clang::NamedDecl *DeclForGlobal(llvm::GlobalValue *global);
- //------------------------------------------------------------------
/// Set the constant result variable m_const_result to the provided
/// constant, assuming it can be evaluated. The result variable will be
/// reset to NULL later if the expression has side effects.
@@ -237,22 +210,18 @@ private:
///
/// \param[in] type
/// The Clang type of the result variable.
- //------------------------------------------------------------------
void MaybeSetConstantResult(llvm::Constant *initializer,
lldb_private::ConstString name,
lldb_private::TypeFromParser type);
- //------------------------------------------------------------------
/// If the IR represents a cast of a variable, set m_const_result to the
/// result of the cast. The result variable will be reset to
/// NULL latger if the expression has side effects.
///
/// \param[in] type
/// The Clang type of the result variable.
- //------------------------------------------------------------------
void MaybeSetCastResult(lldb_private::TypeFromParser type);
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] llvm_function
@@ -260,15 +229,11 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool CreateResultVariable(llvm::Function &llvm_function);
- //------------------------------------------------------------------
/// A module-level pass to find Objective-C constant strings and
/// transform them to calls to CFStringCreateWithBytes.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Rewrite a single Objective-C constant string.
///
/// \param[in] NSStr
@@ -280,19 +245,15 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool RewriteObjCConstString(llvm::GlobalVariable *NSStr,
llvm::GlobalVariable *CStr);
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool RewriteObjCConstStrings();
- //------------------------------------------------------------------
/// A basic block-level pass to find all Objective-C method calls and
/// rewrite them to use sel_registerName instead of statically allocated
/// selectors. The reason is that the selectors are created on the
@@ -300,9 +261,7 @@ private:
/// section and prepare them. This doesn't happen when code is copied into
/// the target, though, and there's no easy way to induce the runtime to
/// scan them. So instead we get our selectors from sel_registerName.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Replace a single selector reference
///
/// \param[in] selector_load
@@ -310,10 +269,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool RewriteObjCSelector(llvm::Instruction *selector_load);
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] basic_block
@@ -321,16 +278,12 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool RewriteObjCSelectors(llvm::BasicBlock &basic_block);
- //------------------------------------------------------------------
/// A basic block-level pass to find all Objective-C class references that
/// use the old-style Objective-C runtime and rewrite them to use
/// class_getClass instead of statically allocated class references.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Replace a single old-style class reference
///
/// \param[in] selector_load
@@ -338,10 +291,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool RewriteObjCClassReference(llvm::Instruction *class_load);
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] basic_block
@@ -349,10 +300,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool RewriteObjCClassReferences(llvm::BasicBlock &basic_block);
- //------------------------------------------------------------------
/// A basic block-level pass to find all newly-declared persistent
/// variables and register them with the ClangExprDeclMap. This allows them
/// to be materialized and dematerialized like normal external variables.
@@ -360,9 +309,7 @@ private:
/// locals, so they have an allocation. This pass excises these allocations
/// and makes references look like external references where they will be
/// resolved -- like all other external references -- by ResolveExternals().
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Handle a single allocation of a persistent variable
///
/// \param[in] persistent_alloc
@@ -370,26 +317,20 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool RewritePersistentAlloc(llvm::Instruction *persistent_alloc);
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] basic_block
/// The basic block currently being processed.
- //------------------------------------------------------------------
bool RewritePersistentAllocs(llvm::BasicBlock &basic_block);
- //------------------------------------------------------------------
/// A function-level pass to find all external variables and functions
/// used in the IR. Each found external variable is added to the struct,
/// and each external function is resolved in place, its call replaced with
/// a call to a function pointer whose value is the address of the function
/// in the target process.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Write an initializer to a memory array of assumed sufficient size.
///
/// \param[in] data
@@ -400,10 +341,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool MaterializeInitializer(uint8_t *data, llvm::Constant *initializer);
- //------------------------------------------------------------------
/// Move an internal variable into the static allocation section.
///
/// \param[in] global_variable
@@ -411,10 +350,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool MaterializeInternalVariable(llvm::GlobalVariable *global_variable);
- //------------------------------------------------------------------
/// Handle a single externally-defined variable
///
/// \param[in] value
@@ -422,10 +359,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool MaybeHandleVariable(llvm::Value *value);
- //------------------------------------------------------------------
/// Handle a single externally-defined symbol
///
/// \param[in] symbol
@@ -433,10 +368,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool HandleSymbol(llvm::Value *symbol);
- //------------------------------------------------------------------
/// Handle a single externally-defined Objective-C class
///
/// \param[in] classlist_reference
@@ -445,10 +378,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool HandleObjCClass(llvm::Value *classlist_reference);
- //------------------------------------------------------------------
/// Handle all the arguments to a function call
///
/// \param[in] C
@@ -456,10 +387,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool MaybeHandleCallArguments(llvm::CallInst *call_inst);
- //------------------------------------------------------------------
/// Resolve variable references in calls to external functions
///
/// \param[in] basic_block
@@ -467,10 +396,8 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool ResolveCalls(llvm::BasicBlock &basic_block);
- //------------------------------------------------------------------
/// Remove calls to __cxa_atexit, which should never be generated by
/// expressions.
///
@@ -480,10 +407,8 @@ private:
/// \return
/// True if the scan was successful; false if some operation
/// failed
- //------------------------------------------------------------------
bool RemoveCXAAtExit(llvm::BasicBlock &basic_block);
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] basic_block
@@ -491,25 +416,19 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool ResolveExternals(llvm::Function &llvm_function);
- //------------------------------------------------------------------
/// A basic block-level pass to excise guard variables from the code.
/// The result for the function is passed through Clang as a static
/// variable. Static variables normally have guard variables to ensure that
/// they are only initialized once.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Rewrite a load to a guard variable to return constant 0.
///
/// \param[in] guard_load
/// The load instruction to zero out.
- //------------------------------------------------------------------
void TurnGuardLoadIntoZero(llvm::Instruction *guard_load);
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] basic_block
@@ -517,17 +436,13 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool RemoveGuards(llvm::BasicBlock &basic_block);
- //------------------------------------------------------------------
/// A function-level pass to make all external variable references
/// point at the correct offsets from the void* passed into the function.
/// ClangExpressionDeclMap::DoStructLayout() must be called beforehand, so
/// that the offsets are valid.
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] llvm_function
@@ -535,7 +450,6 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool ReplaceVariables(llvm::Function &llvm_function);
/// Flags
@@ -585,7 +499,6 @@ private:
///final
/// location of the static allocation.
- //------------------------------------------------------------------
/// UnfoldConstant operates on a constant [Old] which has just been replaced
/// with a value [New]. We assume that new_value has been properly placed
/// early in the function, in front of the first instruction in the entry
@@ -603,7 +516,6 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
class FunctionValueCache {
public:
@@ -627,7 +539,6 @@ private:
FunctionValueCache &entry_instruction_finder,
lldb_private::Stream &error_stream);
- //------------------------------------------------------------------
/// Construct a reference to m_reloc_placeholder with a given type and
/// offset. This typically happens after inserting data into
/// m_data_allocator.
@@ -640,10 +551,8 @@ private:
///
/// \return
/// The Constant for the reference, usually a ConstantExpr.
- //------------------------------------------------------------------
llvm::Constant *BuildRelocation(llvm::Type *type, uint64_t offset);
- //------------------------------------------------------------------
/// Commit the allocation in m_data_allocator and use its final location to
/// replace m_reloc_placeholder.
///
@@ -652,7 +561,6 @@ private:
///
/// \return
/// True on success; false otherwise
- //------------------------------------------------------------------
bool CompleteDataAllocation();
};
OpenPOWER on IntegriCloud