[Lldb-commits] [lldb] 27d52cd - Revert "[lldb/API] Overwrite variables with SBLaunchInfo::SetEnvironment(append=true)"
Davide Italiano via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 8 13:09:32 PDT 2020
Author: Davide Italiano
Date: 2020-07-08T13:09:24-07:00
New Revision: 27d52cd86a2cf82214b71519dffd450c54cf87ae
URL: https://github.com/llvm/llvm-project/commit/27d52cd86a2cf82214b71519dffd450c54cf87ae
DIFF: https://github.com/llvm/llvm-project/commit/27d52cd86a2cf82214b71519dffd450c54cf87ae.diff
LOG: Revert "[lldb/API] Overwrite variables with SBLaunchInfo::SetEnvironment(append=true)"
This reverts commit 695b33a56919af8873eecb47cb83fa17a271e99f beacuse
it broke the macOS bot.
Added:
Modified:
lldb/source/API/SBLaunchInfo.cpp
lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py
Removed:
################################################################################
diff --git a/lldb/source/API/SBLaunchInfo.cpp b/lldb/source/API/SBLaunchInfo.cpp
index cda8134c9853..ba13072e8f9b 100644
--- a/lldb/source/API/SBLaunchInfo.cpp
+++ b/lldb/source/API/SBLaunchInfo.cpp
@@ -190,10 +190,9 @@ void SBLaunchInfo::SetEnvironment(const SBEnvironment &env, bool append) {
LLDB_RECORD_METHOD(void, SBLaunchInfo, SetEnvironment,
(const lldb::SBEnvironment &, bool), env, append);
Environment &refEnv = env.ref();
- if (append) {
- for (auto &KV : refEnv)
- m_opaque_sp->GetEnvironment().insert_or_assign(KV.first(), KV.second);
- } else
+ if (append)
+ m_opaque_sp->GetEnvironment().insert(refEnv.begin(), refEnv.end());
+ else
m_opaque_sp->GetEnvironment() = refEnv;
m_opaque_sp->RegenerateEnvp();
}
diff --git a/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py b/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py
index 6389854ce58f..c1937f985e28 100644
--- a/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py
+++ b/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py
@@ -53,11 +53,6 @@ def test_launch_info(self):
launch_info.SetEnvironment(env, append=True)
self.assertEqual(launch_info.GetEnvironment().GetNumValues(), env_count + 1)
- env.Set("FOO", "baz", overwrite=True)
- launch_info.SetEnvironment(env, append=True)
- self.assertEqual(launch_info.GetEnvironment().GetNumValues(), env_count + 1)
- self.assertEqual(launch_info.GetEnvironment().Get("FOO"), "baz")
-
# Make sure we can replace the launchInfo's environment
env.Clear()
env.Set("BAR", "foo", overwrite=True)
@@ -125,11 +120,6 @@ def test_creating_and_modifying_environment(self):
env.SetEntries(entries, append=False)
self.assertEqualEntries(env, ["X=x", "Y=y"])
- entries.Clear()
- entries.AppendList(["X=y", "Y=x"], 2)
- env.SetEntries(entries, append=True)
- self.assertEqualEntries(env, ["X=y", "Y=x"])
-
# Test clear
env.Clear()
self.assertEqualEntries(env, [])
More information about the lldb-commits
mailing list