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/IceGlobalInits.h b/src/IceGlobalInits.h index 862cc1d..378d5d7 100644 --- a/src/IceGlobalInits.h +++ b/src/IceGlobalInits.h
@@ -109,14 +109,14 @@ /// Returns true if linkage is defined correctly for the global declaration, /// based on default rules. - bool verifyLinkageDefault(const GlobalContext *Ctx) const { + bool verifyLinkageDefault() const { switch (Linkage) { default: return false; case llvm::GlobalValue::InternalLinkage: return true; case llvm::GlobalValue::ExternalLinkage: - return Ctx->getFlags().getAllowExternDefinedSymbols(); + return getFlags().getAllowExternDefinedSymbols(); } } @@ -160,7 +160,7 @@ return Linkage == llvm::GlobalValue::ExternalLinkage; } } - return verifyLinkageDefault(Ctx); + return verifyLinkageDefault(); } /// Validates that the type signature of the function is correct. Returns true @@ -461,13 +461,13 @@ virtual void dump(Ostream &Stream) const override; /// Returns true if linkage is correct for the variable declaration. - bool verifyLinkageCorrect(const GlobalContext *Ctx) const { + bool verifyLinkageCorrect() const { if (getName().hasStdString()) { if (isPNaClABIExternalName(getName().toString())) { return Linkage == llvm::GlobalValue::ExternalLinkage; } } - return verifyLinkageDefault(Ctx); + return verifyLinkageDefault(); } static bool classof(const GlobalDeclaration *Addr) {