[Lldb-commits] [PATCH] D15527: Add ability to override JIT expr compiler options.

Luke Drummond via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 24 13:10:21 PST 2015


ldrumm updated this revision to Diff 43617.
ldrumm marked 2 inline comments as done.

http://reviews.llvm.org/D15527

Files:
  source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===================================================================
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -64,6 +64,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
+#include "lldb/Core/StringList.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Expression/IRDynamicChecks.h"
@@ -82,21 +83,6 @@
 using namespace llvm;
 using namespace lldb_private;
 
-namespace {
-    void debugStringVector(Log *log, const std::vector<std::string>& vec, const char *name)
-    {
-        if(!log)
-            return;
-
-        log->Debug("Begin %s:", name);
-        for (const auto& s : vec)
-            log->Debug("%s", s.c_str());
-
-        log->Debug("End %s.", name);
-    }
-}
-
-
 //===----------------------------------------------------------------------===//
 // Utility Methods for Clang
 //===----------------------------------------------------------------------===//
@@ -186,7 +172,7 @@
 
     // 1. Create a new compiler instance.
     m_compiler.reset(new CompilerInstance());
-    lldb::LanguageType frame_lang = lldb::eLanguageTypeUnknown;
+    lldb::LanguageType frame_lang = expr.Language(); // defaults to lldb::eLanguageTypeUnknown
     lldb_private::LanguageRuntime::OverrideExprOptions *target_opts_override = nullptr;
     lldb_private::LanguageRuntime *lang_rt = nullptr;
     lldb::TargetSP target_sp;
@@ -196,7 +182,10 @@
     // If the expression is being evaluated in the context of an existing
     // stack frame, we introspect to see if the language runtime is available.
     auto frame = exe_scope->CalculateStackFrame();
-    if (frame)
+
+    // 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_lang != lldb::eLanguageTypeUnknown)
@@ -262,7 +251,7 @@
         }
         // Supported subsets of x86
         if (target_sp->GetArchitecture().GetMachine() == llvm::Triple::x86 ||
-        target_sp->GetArchitecture().GetMachine() == llvm::Triple::x86_64)
+            target_sp->GetArchitecture().GetMachine() == llvm::Triple::x86_64)
         {
             m_compiler->getTargetOpts().Features.push_back("+sse");
             m_compiler->getTargetOpts().Features.push_back("+sse2");
@@ -277,9 +266,9 @@
         log->Debug("FPMath: '%s'", opts.FPMath.c_str());
         log->Debug("ABI: '%s'", opts.ABI.c_str());
         log->Debug("LinkerVersion: '%s'", opts.LinkerVersion.c_str());
-        debugStringVector(log, opts.FeaturesAsWritten, "FeaturesAsWritten");
-        debugStringVector(log, opts.Features, "Features");
-        debugStringVector(log, opts.Reciprocals, "Reciprocals");
+        StringList::LogDump(log, opts.FeaturesAsWritten, "FeaturesAsWritten");
+        StringList::LogDump(log, opts.Features, "Features");
+        StringList::LogDump(log, opts.Reciprocals, "Reciprocals");
     }
 
     // 3. Create and install the target on the compiler.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15527.43617.patch
Type: text/x-patch
Size: 3255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151224/aa21b4f0/attachment.bin>


More information about the lldb-commits mailing list