[PATCH] D78815: [Pass] Ensure we don't include PassSupport.h/PassAnalysisSupport.h directly
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 24 09:43:46 PDT 2020
RKSimon created this revision.
RKSimon added reviewers: ddunbar, Eugene.Zelenko, thegameg, echristo.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
Both PassSupport.h and PassAnalysisSupport.h are only supposed to be included via Pass.h.
This patch fixes the case where PassRegistry.cpp was including PassSupport.h and adds #ifndef error checks to help ensure it doesn't happen again.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78815
Files:
llvm/include/llvm/PassAnalysisSupport.h
llvm/include/llvm/PassSupport.h
llvm/lib/IR/PassRegistry.cpp
Index: llvm/lib/IR/PassRegistry.cpp
===================================================================
--- llvm/lib/IR/PassRegistry.cpp
+++ llvm/lib/IR/PassRegistry.cpp
@@ -14,7 +14,7 @@
#include "llvm/PassRegistry.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/PassInfo.h"
-#include "llvm/PassSupport.h"
+#include "llvm/Pass.h"
#include "llvm/Support/ManagedStatic.h"
#include <cassert>
#include <memory>
Index: llvm/include/llvm/PassSupport.h
===================================================================
--- llvm/include/llvm/PassSupport.h
+++ llvm/include/llvm/PassSupport.h
@@ -17,6 +17,10 @@
//
//===----------------------------------------------------------------------===//
+#ifndef LLVM_PASS_H
+#error "Do not include <PassSupport.h>; include <Pass.h> instead"
+#endif
+
#ifndef LLVM_PASSSUPPORT_H
#define LLVM_PASSSUPPORT_H
Index: llvm/include/llvm/PassAnalysisSupport.h
===================================================================
--- llvm/include/llvm/PassAnalysisSupport.h
+++ llvm/include/llvm/PassAnalysisSupport.h
@@ -15,10 +15,13 @@
//
//===----------------------------------------------------------------------===//
+#ifndef LLVM_PASS_H
+#error "Do not include <PassAnalysisSupport.h>; include <Pass.h> instead"
+#endif
+
#ifndef LLVM_PASSANALYSISSUPPORT_H
#define LLVM_PASSANALYSISSUPPORT_H
-#include "Pass.h"
#include "llvm/ADT/SmallVector.h"
#include <cassert>
#include <utility>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78815.259911.patch
Type: text/x-patch
Size: 1444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200424/a907c2cc/attachment.bin>
More information about the llvm-commits
mailing list