diff options
Diffstat (limited to 'include/llvm/Analysis/PtrUseVisitor.h')
| -rw-r--r-- | include/llvm/Analysis/PtrUseVisitor.h | 31 | 
1 files changed, 23 insertions, 8 deletions
| diff --git a/include/llvm/Analysis/PtrUseVisitor.h b/include/llvm/Analysis/PtrUseVisitor.h index 2fe7c6725266..9f156a1a6029 100644 --- a/include/llvm/Analysis/PtrUseVisitor.h +++ b/include/llvm/Analysis/PtrUseVisitor.h @@ -6,6 +6,7 @@  // License. See LICENSE.TXT for details.  //  //===----------------------------------------------------------------------===// +//  /// \file  /// This file provides a collection of visitors which walk the (instruction)  /// uses of a pointer. These visitors all provide the same essential behavior @@ -16,23 +17,36 @@  /// global variable, or function argument.  ///  /// FIXME: Provide a variant which doesn't track offsets and is cheaper. -/// +//  //===----------------------------------------------------------------------===//  #ifndef LLVM_ANALYSIS_PTRUSEVISITOR_H  #define LLVM_ANALYSIS_PTRUSEVISITOR_H  #include "llvm/ADT/APInt.h" +#include "llvm/ADT/PointerIntPair.h"  #include "llvm/ADT/SmallPtrSet.h"  #include "llvm/ADT/SmallVector.h" +#include "llvm/IR/CallSite.h"  #include "llvm/IR/DataLayout.h" +#include "llvm/IR/DerivedTypes.h"  #include "llvm/IR/InstVisitor.h" +#include "llvm/IR/Instruction.h" +#include "llvm/IR/Instructions.h"  #include "llvm/IR/IntrinsicInst.h" -#include "llvm/Support/Compiler.h" +#include "llvm/IR/Intrinsics.h" +#include "llvm/IR/Type.h" +#include "llvm/IR/Use.h" +#include "llvm/IR/User.h" +#include "llvm/Support/Casting.h" +#include <algorithm> +#include <cassert> +#include <type_traits>  namespace llvm {  namespace detail { +  /// \brief Implementation of non-dependent functionality for \c PtrUseVisitor.  ///  /// See \c PtrUseVisitor for the public interface and detailed comments about @@ -115,7 +129,8 @@ protected:    /// This is used to maintain a worklist fo to-visit uses. This is used to    /// make the visit be iterative rather than recursive.    struct UseToVisit { -    typedef PointerIntPair<Use *, 1, bool> UseAndIsOffsetKnownPair; +    using UseAndIsOffsetKnownPair = PointerIntPair<Use *, 1, bool>; +      UseAndIsOffsetKnownPair UseAndIsOffsetKnown;      APInt Offset;    }; @@ -128,7 +143,6 @@ protected:    /// @} -    /// \name Per-visit state    /// This state is reset for each instruction visited.    /// @{ @@ -145,7 +159,6 @@ protected:    /// @} -    /// Note that the constructor is protected because this class must be a base    /// class, we can't create instances directly of this class.    PtrUseVisitorBase(const DataLayout &DL) : DL(DL) {} @@ -162,6 +175,7 @@ protected:    /// offsets and looking through GEPs.    bool adjustOffsetForGEP(GetElementPtrInst &GEPI);  }; +  } // end namespace detail  /// \brief A base class for visitors over the uses of a pointer value. @@ -193,7 +207,8 @@ template <typename DerivedT>  class PtrUseVisitor : protected InstVisitor<DerivedT>,                        public detail::PtrUseVisitorBase {    friend class InstVisitor<DerivedT>; -  typedef InstVisitor<DerivedT> Base; + +  using Base = InstVisitor<DerivedT>;  public:    PtrUseVisitor(const DataLayout &DL) : PtrUseVisitorBase(DL) { @@ -283,6 +298,6 @@ protected:    }  }; -} +} // end namespace llvm -#endif +#endif // LLVM_ANALYSIS_PTRUSEVISITOR_H | 
