At the beginning of doFinalization set the MachineFunction to
authorEric Christopher <echristo@gmail.com>
Fri, 20 Mar 2015 16:03:39 +0000 (16:03 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 20 Mar 2015 16:03:39 +0000 (16:03 +0000)
nullptr so that users get an earlier dereferencing error and
so that we can use it to conditionalize access to MachineFunction
specific data.

llvm-svn: 232820

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

index 7de5e4f..098e798 100644 (file)
@@ -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