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/IceConverter.cpp b/src/IceConverter.cpp
index e1900c3..0729b73 100644
--- a/src/IceConverter.cpp
+++ b/src/IceConverter.cpp
@@ -722,7 +722,7 @@
}
if (!GV->hasInitializer()) {
- if (Ctx->getFlags().getAllowUninitializedGlobals())
+ if (Ice::getFlags().getAllowUninitializedGlobals())
continue;
else {
std::string Buffer;
@@ -807,7 +807,7 @@
namespace Ice {
void Converter::nameUnnamedGlobalVariables(Module *Mod) {
- const std::string GlobalPrefix = Ctx->getFlags().getDefaultGlobalPrefix();
+ const std::string GlobalPrefix = getFlags().getDefaultGlobalPrefix();
if (GlobalPrefix.empty())
return;
uint32_t NameIndex = 0;
@@ -822,7 +822,7 @@
}
void Converter::nameUnnamedFunctions(Module *Mod) {
- const std::string FunctionPrefix = Ctx->getFlags().getDefaultFunctionPrefix();
+ const std::string FunctionPrefix = getFlags().getDefaultFunctionPrefix();
if (FunctionPrefix.empty())
return;
uint32_t NameIndex = 0;
@@ -895,7 +895,7 @@
Var->setAlignment(GV->getAlignment());
Var->setIsConstant(GV->isConstant());
Var->setName(Ctx, GV->getName());
- if (!Var->verifyLinkageCorrect(Ctx)) {
+ if (!Var->verifyLinkageCorrect()) {
std::string Buffer;
raw_string_ostream StrBuf(Buffer);
StrBuf << "Global " << Var->getName()