From abc546afd195bb2b077b063590038737f4ed30fb Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 20 Mar 2015 16:03:39 +0000 Subject: [PATCH] At the beginning of doFinalization set the MachineFunction to nullptr so that users get an earlier dereferencing error and so that we can use it to conditionalize access to MachineFunction specific data. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232820 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 7de5e4f10f1..098e7989e94 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1004,6 +1004,11 @@ void AsmPrinter::emitGlobalGOTEquivs() { } bool AsmPrinter::doFinalization(Module &M) { + // Set the MachineFunction to nullptr so that we can catch attempted + // accesses to MF specific features at the module level and so that + // we can conditionalize accesses based on whether or not it is nullptr. + MF = nullptr; + // Gather all GOT equivalent globals in the module. We really need two // passes over the globals: one to compute and another to avoid its emission // in EmitGlobalVariable, otherwise we would not be able to handle cases -- 2.34.1