Introduce SpecialCaseList::isIn overload for GlobalAliases.
[oota-llvm.git] / include / llvm / Transforms / Utils / SpecialCaseList.h
index 36ee604a1a61693fb3019235347b0581bf6523b2..34c28fc1cafef72f6ac3779b52a53314f87e6450 100644 (file)
@@ -49,6 +49,7 @@
 
 namespace llvm {
 class Function;
+class GlobalAlias;
 class GlobalVariable;
 class MemoryBuffer;
 class Module;
@@ -57,10 +58,6 @@ class StringRef;
 
 class SpecialCaseList {
  public:
-  // FIXME: Switch all users to factories and remove these constructors.
-  SpecialCaseList(const StringRef Path);
-  SpecialCaseList(const MemoryBuffer *MB);
-
   /// Parses the special case list from a file. If Path is empty, returns
   /// an empty special case list. On failure, returns 0 and writes an error
   /// message to string.
@@ -68,6 +65,9 @@ class SpecialCaseList {
   /// Parses the special case list from a memory buffer. On failure, returns
   /// 0 and writes an error message to string.
   static SpecialCaseList *create(const MemoryBuffer *MB, std::string &Error);
+  /// Parses the special case list from a file. On failure, reports a fatal
+  /// error.
+  static SpecialCaseList *createOrDie(const StringRef Path);
 
   ~SpecialCaseList();
 
@@ -80,24 +80,18 @@ class SpecialCaseList {
   bool isIn(const GlobalVariable &G,
             const StringRef Category = StringRef()) const;
 
+  /// Returns whether this global alias is listed in the given category, which
+  /// may be omitted to search the empty category.
+  ///
+  /// If GA aliases a function, the alias's name is matched as a function name
+  /// would be.  Similarly, aliases of globals are matched like globals.
+  bool isIn(const GlobalAlias &GA,
+            const StringRef Category = StringRef()) const;
+
   /// Returns whether this module is listed in the given category, which may be
   /// omitted to search the empty category.
   bool isIn(const Module &M, const StringRef Category = StringRef()) const;
 
-  /// Returns whether either this function or its source file are listed in any
-  /// category.  Category will contain the name of an arbitrary category in
-  /// which this function is listed.
-  bool findCategory(const Function &F, StringRef &Category) const;
-
-  /// Returns whether this global, its type or its source file are listed in any
-  /// category.  Category will contain the name of an arbitrary category in
-  /// which this global is listed.
-  bool findCategory(const GlobalVariable &G, StringRef &Category) const;
-
-  /// Returns whether this module is listed in any category.  Category will
-  /// contain the name of an arbitrary category in which this module is listed.
-  bool findCategory(const Module &M, StringRef &Category) const;
-
  private:
   SpecialCaseList(SpecialCaseList const &) LLVM_DELETED_FUNCTION;
   SpecialCaseList &operator=(SpecialCaseList const &) LLVM_DELETED_FUNCTION;
@@ -109,8 +103,6 @@ class SpecialCaseList {
   /// Parses just-constructed SpecialCaseList entries from a memory buffer.
   bool parse(const MemoryBuffer *MB, std::string &Error);
 
-  bool findCategory(const StringRef Section, const StringRef Query,
-                    StringRef &Category) const;
   bool inSectionCategory(const StringRef Section, const StringRef Query,
                          const StringRef Category) const;
 };