[PATCH] D21471: [MCContext] Don't use getenv inside class constructor

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 08:26:33 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL273005: [MCContext] Don't use getenv inside class constructor (authored by igor.laevsky).

Changed prior to commit:
  http://reviews.llvm.org/D21471?vs=61094&id=61098#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21471

Files:
  llvm/trunk/lib/MC/MCContext.cpp

Index: llvm/trunk/lib/MC/MCContext.cpp
===================================================================
--- llvm/trunk/lib/MC/MCContext.cpp
+++ llvm/trunk/lib/MC/MCContext.cpp
@@ -25,14 +25,22 @@
 #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"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/SourceMgr.h"
 
 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 @@
       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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21471.61098.patch
Type: text/x-patch
Size: 1332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160617/8a8ea206/attachment.bin>


More information about the llvm-commits mailing list