Simplify references to command line flags.
This CL removes all indirect pointer chasing to get the values of
command line flags. Since we are only using 1 copy of ClFlags, this CL
introduces a static field Flags to hold the defined command line flags
(it was previously a static field of GlobalContext).
For those few contexts where one must change CL flags due to context
(such as testsing and running in the browser), use ClFlags::Flags.
In the remainder of the cases, the code uses getFlags() which returns
a constant reference to ClFlags::Flags, allowing access to the get
accessors.
BUG=None
R=stichnot@chromium.org
Review URL: https://codereview.chromium.org/1848303003 .
diff --git a/unittest/BitcodeMunge.cpp b/unittest/BitcodeMunge.cpp
index 91564de..3da21ec 100644
--- a/unittest/BitcodeMunge.cpp
+++ b/unittest/BitcodeMunge.cpp
@@ -20,13 +20,14 @@
namespace IceTest {
void IceTest::SubzeroBitcodeMunger::resetMungeFlags() {
- Flags.setAllowErrorRecovery(true);
- Flags.setGenerateUnitTestMessages(true);
- Flags.setOptLevel(Ice::Opt_m1);
- Flags.setOutFileType(Ice::FT_Iasm);
- Flags.setTargetArch(Ice::Target_X8632);
- Flags.setNumTranslationThreads(0);
- Flags.setParseParallel(false);
+ Ice::ClFlags::Flags.setAllowErrorRecovery(true);
+ Ice::ClFlags::Flags.setDisableTranslation(false);
+ Ice::ClFlags::Flags.setGenerateUnitTestMessages(true);
+ Ice::ClFlags::Flags.setOptLevel(Ice::Opt_m1);
+ Ice::ClFlags::Flags.setOutFileType(Ice::FT_Iasm);
+ Ice::ClFlags::Flags.setTargetArch(Ice::Target_X8632);
+ Ice::ClFlags::Flags.setNumTranslationThreads(0);
+ Ice::ClFlags::Flags.setParseParallel(false);
}
bool IceTest::SubzeroBitcodeMunger::runTest(const uint64_t Munges[],
@@ -38,7 +39,7 @@
Ctx.startWorkerThreads();
Ice::PNaClTranslator Translator(&Ctx);
const char *BufferName = "Test";
- Flags.setDisableTranslation(DisableTranslation);
+ Ice::ClFlags::Flags.setDisableTranslation(DisableTranslation);
Translator.translateBuffer(BufferName, MungedInput.get());
Ctx.waitForWorkerThreads();