[Lldb-commits] [PATCH] D17719: Track expression language from one place in ClangExpressionParser
Luke Drummond via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 1 12:07:31 PST 2016
ldrumm updated this revision to Diff 49531.
ldrumm added a comment.
Updated diff to show full context
http://reviews.llvm.org/D17719
Files:
source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
@@ -129,6 +129,8 @@
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.
};
}
Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -157,7 +157,7 @@
// 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 @@
// 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 @@
assert (m_compiler->hasTarget());
// 5. Set language options.
- lldb::LanguageType language = expr.Language();
-
- switch (language)
+ switch (m_language)
{
case lldb::eLanguageTypeC:
case lldb::eLanguageTypeC89:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17719.49531.patch
Type: text/x-patch
Size: 2667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160301/20b5558e/attachment.bin>
More information about the lldb-commits
mailing list