diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /include/clang/AST/BaseSubobject.h | |
parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) |
Notes
Diffstat (limited to 'include/clang/AST/BaseSubobject.h')
-rw-r--r-- | include/clang/AST/BaseSubobject.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/include/clang/AST/BaseSubobject.h b/include/clang/AST/BaseSubobject.h index 66af023c828e4..fdb7e718fe9e4 100644 --- a/include/clang/AST/BaseSubobject.h +++ b/include/clang/AST/BaseSubobject.h @@ -1,4 +1,4 @@ -//===--- BaseSubobject.h - BaseSubobject class ----------------------------===// +//===- BaseSubobject.h - BaseSubobject class --------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -15,12 +15,15 @@ #define LLVM_CLANG_AST_BASESUBOBJECT_H #include "clang/AST/CharUnits.h" -#include "clang/AST/DeclCXX.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/Support/DataTypes.h" +#include "llvm/ADT/DenseMapInfo.h" #include "llvm/Support/type_traits.h" +#include <cstdint> +#include <utility> namespace clang { + +class CXXRecordDecl; + // BaseSubobject - Uniquely identifies a direct or indirect base class. // Stores both the base class decl and the offset from the most derived class to // the base class. Used for vtable and VTT generation. @@ -32,9 +35,9 @@ class BaseSubobject { CharUnits BaseOffset; public: - BaseSubobject() { } + BaseSubobject() = default; BaseSubobject(const CXXRecordDecl *Base, CharUnits BaseOffset) - : Base(Base), BaseOffset(BaseOffset) { } + : Base(Base), BaseOffset(BaseOffset) {} /// getBase - Returns the base class declaration. const CXXRecordDecl *getBase() const { return Base; } @@ -47,7 +50,7 @@ public: } }; -} // end namespace clang +} // namespace clang namespace llvm { @@ -65,7 +68,8 @@ template<> struct DenseMapInfo<clang::BaseSubobject> { } static unsigned getHashValue(const clang::BaseSubobject &Base) { - typedef std::pair<const clang::CXXRecordDecl *, clang::CharUnits> PairTy; + using PairTy = std::pair<const clang::CXXRecordDecl *, clang::CharUnits>; + return DenseMapInfo<PairTy>::getHashValue(PairTy(Base.getBase(), Base.getBaseOffset())); } @@ -81,6 +85,6 @@ template <> struct isPodLike<clang::BaseSubobject> { static const bool value = true; }; -} +} // namespace llvm -#endif +#endif // LLVM_CLANG_AST_BASESUBOBJECT_H |