forked from llvm-mirror/lldb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch makes Clang-independent base classes for all the expressio…
…n types that lldb currently vends. Before we had: ClangFunction ClangUtilityFunction ClangUserExpression and code all over in lldb that explicitly made Clang-based expressions. This patch adds an Expression base class, and three pure virtual implementations for the Expression kinds: FunctionCaller UtilityFunction UserExpression You can request one of these expression types from the Target using the Get<ExpressionType>ForLanguage. The Target will then consult all the registered TypeSystem plugins, and if the type system that matches the language can make an expression of that kind, it will do so and return it. Because all of the real expression types need to communicate with their ExpressionParser in a uniform way, I also added a ExpressionTypeSystemHelper class that expressions generically can vend, and a ClangExpressionHelper that encapsulates the operations that the ClangExpressionParser needs to perform on the ClangExpression types. Then each of the Clang* expression kinds constructs the appropriate helper to do what it needs. The patch also fixes a wart in the UtilityFunction that to use it you had to create a parallel FunctionCaller to actually call the function made by the UtilityFunction. Now the UtilityFunction can be asked to vend a FunctionCaller that will run its function. This cleaned up a lot of boiler plate code using UtilityFunctions. Note, in this patch all the expression types explicitly depend on the LLVM JIT and IR, and all the common JIT running code is in the FunctionCaller etc base classes. At some point we could also abstract that dependency but I don't see us adding another back end in the near term, so I'll leave that exercise till it is actually necessary. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@247720 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
73 changed files
with
3,062 additions
and
1,957 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
//===-- ClangExpression.h ---------------------------------------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef liblldb_ClangExpression_h_ | ||
#define liblldb_ClangExpression_h_ | ||
|
||
// C Includes | ||
// C++ Includes | ||
#include <string> | ||
#include <map> | ||
#include <vector> | ||
|
||
// Other libraries and framework includes | ||
// Project includes | ||
|
||
#include "lldb/lldb-forward.h" | ||
#include "lldb/lldb-private.h" | ||
#include "lldb/Core/ClangForward.h" | ||
#include "lldb/Expression/ExpressionTypeSystemHelper.h" | ||
|
||
namespace lldb_private { | ||
|
||
class RecordingMemoryManager; | ||
|
||
//---------------------------------------------------------------------- | ||
// ClangExpressionHelper | ||
//---------------------------------------------------------------------- | ||
class ClangExpressionHelper : public ExpressionTypeSystemHelper | ||
{ | ||
public: | ||
static bool classof(const ExpressionTypeSystemHelper *ts) | ||
{ | ||
return ts->getKind() == eKindClangHelper; | ||
} | ||
|
||
ClangExpressionHelper () : | ||
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; | ||
|
||
|
||
protected: | ||
|
||
}; | ||
|
||
} // namespace lldb_private | ||
|
||
#endif // liblldb_ClangExpression_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.