[Lldb-commits] [lldb] r263099 - Track expression language from one place in ClangExpressionParser
Ewan Crawford via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 10 02:31:09 PST 2016
Author: ewancrawford
Date: Thu Mar 10 04:31:08 2016
New Revision: 263099
URL: http://llvm.org/viewvc/llvm-project?rev=263099&view=rev
Log:
Track expression language from one place in ClangExpressionParser
The current expression language is currently tracked in a few places within the ClangExpressionParser constructor.
This patch adds a private lldb::LanguageType attribute to the ClangExpressionParser class and tracks the expression language from that one place.
Author: Luke Drummond <luke.drummond at codeplay.com>
Differential Revision: http://reviews.llvm.org/D17719
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=263099&r1=263098&r2=263099&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Thu Mar 10 04:31:08 2016
@@ -157,7 +157,7 @@ ClangExpressionParser::ClangExpressionPa
// 1. Create a new compiler instance.
m_compiler.reset(new CompilerInstance());
- lldb::LanguageType frame_lang = expr.Language(); // defaults to lldb::eLanguageTypeUnknown
+ m_language = expr.Language(); // defaults to lldb::eLanguageTypeUnknown
bool overridden_target_opts = false;
lldb_private::LanguageRuntime *lang_rt = nullptr;
lldb::TargetSP target_sp;
@@ -176,14 +176,14 @@ ClangExpressionParser::ClangExpressionPa
// Make sure the user hasn't provided a preferred execution language
// with `expression --language X -- ...`
- if (frame && frame_lang == lldb::eLanguageTypeUnknown)
- frame_lang = frame->GetLanguage();
+ if (frame && m_language == lldb::eLanguageTypeUnknown)
+ m_language = frame->GetLanguage();
- if (frame_lang != lldb::eLanguageTypeUnknown)
+ if (m_language != lldb::eLanguageTypeUnknown)
{
- lang_rt = exe_scope->CalculateProcess()->GetLanguageRuntime(frame_lang);
+ lang_rt = exe_scope->CalculateProcess()->GetLanguageRuntime(m_language);
if (log)
- log->Printf("Frame has language of type %s", Language::GetNameForLanguageType(frame_lang));
+ log->Printf("Frame has language of type %s", Language::GetNameForLanguageType(m_language));
}
// 2. Configure the compiler with a set of default options that are appropriate
@@ -263,9 +263,7 @@ ClangExpressionParser::ClangExpressionPa
assert (m_compiler->hasTarget());
// 5. Set language options.
- lldb::LanguageType language = expr.Language();
-
- switch (language)
+ switch (m_language)
{
case lldb::eLanguageTypeC:
case lldb::eLanguageTypeC89:
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h?rev=263099&r1=263098&r2=263099&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h Thu Mar 10 04:31:08 2016
@@ -129,6 +129,8 @@ private:
class LLDBPreprocessorCallbacks;
LLDBPreprocessorCallbacks *m_pp_callbacks; ///< Called when the preprocessor encounters module imports
std::unique_ptr<ClangASTContext> m_ast_context;
+ lldb::LanguageType m_language; ///< The the source language of the expression
+ /// which may be explicitly set or inferred.
};
}
More information about the lldb-commits
mailing list