//
//===----------------------------------------------------------------------===//
-#define DEBUG_TYPE "shadowstackgc"
#include "llvm/CodeGen/GCs.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/CodeGen/GCStrategy.h"
using namespace llvm;
+#define DEBUG_TYPE "shadowstackgc"
+
namespace {
class ShadowStackGC : public GCStrategy {
public:
ShadowStackGC();
- bool initializeCustomLowering(Module &M);
- bool performCustomLowering(Function &F);
+ bool initializeCustomLowering(Module &M) override;
+ bool performCustomLowering(Function &F) override;
private:
bool IsNullValue(Value *V);
IRBuilder<> *Next() {
switch (State) {
default:
- return 0;
+ return nullptr;
case 0:
StateBB = F.begin();
Calls.push_back(CI);
if (Calls.empty())
- return 0;
+ return nullptr;
// Create a cleanup block.
LLVMContext &C = F.getContext();
void llvm::linkShadowStackGC() { }
-ShadowStackGC::ShadowStackGC() : Head(0), StackEntryTy(0) {
+ShadowStackGC::ShadowStackGC() : Head(nullptr), StackEntryTy(nullptr) {
InitRoots = true;
CustomRoots = true;
}
BasicBlock::iterator IP = F.getEntryBlock().begin();
IRBuilder<> AtEntry(IP->getParent(), IP);
- Instruction *StackEntry = AtEntry.CreateAlloca(ConcreteStackEntryTy, 0,
- "gc_frame");
+ Instruction *StackEntry = AtEntry.CreateAlloca(ConcreteStackEntryTy, nullptr,
+ "gc_frame");
while (isa<AllocaInst>(IP)) ++IP;
AtEntry.SetInsertPoint(IP->getParent(), IP);