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/src/IceMangling.cpp b/src/IceMangling.cpp
index 28275c1..fe46bb1 100644
--- a/src/IceMangling.cpp
+++ b/src/IceMangling.cpp
@@ -126,10 +126,10 @@
// _Z3barxyz ==> ZN6Prefix3barExyz
// An unmangled, extern "C" style name, gets a simple prefix:
// bar ==> Prefixbar
- if (!BuildDefs::dump() || GlobalContext::getFlags().getTestPrefix().empty())
+ if (!BuildDefs::dump() || getFlags().getTestPrefix().empty())
return Name;
- const std::string TestPrefix = GlobalContext::getFlags().getTestPrefix();
+ const std::string TestPrefix = getFlags().getTestPrefix();
unsigned PrefixLength = TestPrefix.length();
ManglerVector NameBase(1 + Name.length());
const size_t BufLen = 30 + Name.length() + PrefixLength;