diff options
Diffstat (limited to 'include/llvm/CodeGen/StackProtector.h')
-rw-r--r-- | include/llvm/CodeGen/StackProtector.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/include/llvm/CodeGen/StackProtector.h b/include/llvm/CodeGen/StackProtector.h index 1b3c0eb4a4d0..0655f19a323e 100644 --- a/include/llvm/CodeGen/StackProtector.h +++ b/include/llvm/CodeGen/StackProtector.h @@ -1,4 +1,4 @@ -//===-- StackProtector.h - Stack Protector Insertion ----------------------===// +//===- StackProtector.h - Stack Protector Insertion -------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -23,8 +23,10 @@ #include "llvm/IR/ValueMap.h" #include "llvm/Pass.h" #include "llvm/Target/TargetLowering.h" +#include "llvm/Target/TargetMachine.h" namespace llvm { + class Function; class Module; class PHINode; @@ -48,11 +50,11 @@ public: typedef ValueMap<const AllocaInst *, SSPLayoutKind> SSPLayoutMap; private: - const TargetMachine *TM; + const TargetMachine *TM = nullptr; /// TLI - Keep a pointer of a TargetLowering to consult for determining /// target type sizes. - const TargetLoweringBase *TLI; + const TargetLoweringBase *TLI = nullptr; const Triple Trip; Function *F; @@ -67,7 +69,7 @@ private: /// \brief The minimum size of buffers that will receive stack smashing /// protection when -fstack-protection is used. - unsigned SSPBufferSize; + unsigned SSPBufferSize = 0; /// VisitedPHIs - The set of PHI nodes visited when determining /// if a variable's reference has been taken. This set @@ -111,12 +113,13 @@ private: public: static char ID; // Pass identification, replacement for typeid. - StackProtector() - : FunctionPass(ID), TM(nullptr), TLI(nullptr), SSPBufferSize(0) { + + StackProtector() : FunctionPass(ID) { initializeStackProtectorPass(*PassRegistry::getPassRegistry()); } + StackProtector(const TargetMachine *TM) - : FunctionPass(ID), TM(TM), TLI(nullptr), Trip(TM->getTargetTriple()), + : FunctionPass(ID), TM(TM), Trip(TM->getTargetTriple()), SSPBufferSize(8) { initializeStackProtectorPass(*PassRegistry::getPassRegistry()); } @@ -134,6 +137,7 @@ public: bool runOnFunction(Function &Fn) override; }; + } // end namespace llvm #endif // LLVM_CODEGEN_STACKPROTECTOR_H |