diff options
author | Igor Laevsky <igmyrj@gmail.com> | 2016-06-17 15:19:41 +0000 |
---|---|---|
committer | Igor Laevsky <igmyrj@gmail.com> | 2016-06-17 15:19:41 +0000 |
commit | afaddb4d867c3843e090eec8635168be94f88730 (patch) | |
tree | aac49a0d353c72b859a53b0129c59214fd807b9a | |
parent | 649d92ad2ffe6e6638047cc1a0cfbd5983de50f2 (diff) | |
download | llvm-afaddb4d867c3843e090eec8635168be94f88730.tar.gz |
[MCContext] Don't use getenv inside class constructor
Differential Revision: http://reviews.llvm.org/D21471
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273005 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/MC/MCContext.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 67463e583d73..f48ab2f8e349 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -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" @@ -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) @@ -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; |