-//===- llvm/Analysis/FindUnsafePointerTypes.h - Unsafe pointers ---*- C++ -*-=//
+//===- llvm/Analysis/FindUnsafePointerTypes.h - Unsafe pointers -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This file defines a pass that can be used to determine, interprocedurally,
// which pointer types are accessed unsafely in a program. If there is an
#include "llvm/Pass.h"
#include <set>
+namespace llvm {
+
class PointerType;
-struct FindUnsafePointerTypes : public Pass {
+struct FindUnsafePointerTypes : public ModulePass {
// UnsafeTypes - Set of types that are not safe to transform.
std::set<PointerType*> UnsafeTypes;
public:
- static AnalysisID ID; // We are an analysis, we must have an ID
-
- FindUnsafePointerTypes(AnalysisID id) { assert(ID == id); }
-
// Accessor for underlying type set...
inline const std::set<PointerType*> &getUnsafeTypes() const {
return UnsafeTypes;
}
- // run - Inspect the operations that the specified module does on
- // values of various types. If they are deemed to be 'unsafe' note that the
- // type is not safe to transform.
- //
- virtual bool run(Module *M);
+ /// run - Inspect the operations that the specified module does on
+ /// values of various types. If they are deemed to be 'unsafe' note that the
+ /// type is not safe to transform.
+ ///
+ virtual bool runOnModule(Module &M);
- // printResults - Loop over the results of the analysis, printing out unsafe
- // types.
- //
- void printResults(const Module *Mod, std::ostream &o) const;
+ /// print - Loop over the results of the analysis, printing out unsafe types.
+ ///
+ void print(std::ostream &o, const Module *Mod) const;
- // getAnalysisUsage - Of course, we provide ourself...
- //
+ /// getAnalysisUsage - Of course, we provide ourself...
+ ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
- AU.addProvided(ID);
}
};
+} // End llvm namespace
+
#endif