Skip to content

Commit

Permalink
[MCContext] Don't use getenv inside class constructor
Browse files Browse the repository at this point in the history
Differential Revision: http://reviews.llvm.org/D21471



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273005 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
igor-laevsky committed Jun 17, 2016
1 parent 649d92a commit afaddb4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/MC/MCContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/MCSymbolMachO.h"
#include "llvm/Support/COFF.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
Expand All @@ -33,6 +34,13 @@

using namespace llvm;

static cl::opt<char*>
AsSecureLogFileName("as-secure-log-file-name",
cl::desc("As secure log file name (initialized from "
"AS_SECURE_LOG_FILE env variable)"),
cl::init(getenv("AS_SECURE_LOG_FILE")), cl::Hidden);


MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri,
const MCObjectFileInfo *mofi, const SourceMgr *mgr,
bool DoAutoReset)
Expand All @@ -42,7 +50,7 @@ MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri,
GenDwarfForAssembly(false), GenDwarfFileNumber(0), DwarfVersion(4),
AllowTemporaryLabels(true), DwarfCompileUnitID(0),
AutoReset(DoAutoReset), HadError(false) {
SecureLogFile = getenv("AS_SECURE_LOG_FILE");
SecureLogFile = AsSecureLogFileName;
SecureLog = nullptr;
SecureLogUsed = false;

Expand Down

0 comments on commit afaddb4

Please sign in to comment.