File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,15 @@ using namespace lldb_private::repro;
18
18
using namespace llvm ;
19
19
using namespace llvm ::yaml;
20
20
21
+ static llvm::Optional<bool > GetEnv (const char *var) {
22
+ std::string val = llvm::StringRef (getenv (var)).lower ();
23
+ if (val == " 0" || val == " off" )
24
+ return false ;
25
+ if (val == " 1" || val == " on" )
26
+ return true ;
27
+ return {};
28
+ }
29
+
21
30
Reproducer &Reproducer::Instance () { return *InstanceImpl (); }
22
31
23
32
llvm::Error Reproducer::Initialize (ReproducerMode mode,
@@ -27,12 +36,12 @@ llvm::Error Reproducer::Initialize(ReproducerMode mode,
27
36
28
37
// The environment can override the capture mode.
29
38
if (mode != ReproducerMode::Replay) {
30
- std::string env =
31
- llvm::StringRef ( getenv ( " LLDB_CAPTURE_REPRODUCER " )). lower ();
32
- if (env == " 0 " || env == " off " )
33
- mode = ReproducerMode::Off;
34
- else if (env == " 1 " || env == " on " )
35
- mode = ReproducerMode::Capture;
39
+ if (llvm::Optional< bool > override = GetEnv ( " LLDB_CAPTURE_REPRODUCER " )) {
40
+ if (* override )
41
+ mode = ReproducerMode::Capture;
42
+ else
43
+ mode = ReproducerMode::Off;
44
+ }
36
45
}
37
46
38
47
switch (mode) {
You can’t perform that action at this time.
0 commit comments