diff options
author | Timur Iskhodzhanov <timurrrr@google.com> | 2013-10-09 09:23:58 +0000 |
---|---|---|
committer | Timur Iskhodzhanov <timurrrr@google.com> | 2013-10-09 09:23:58 +0000 |
commit | 2cb17a06befb61b1434aaa991652fea4338c95d7 (patch) | |
tree | ab5b7621133bc0b5299ae38daf115f59e45dc11e /include/clang/Basic/ABI.h | |
parent | eeac7a4bb4bf6b2bf423ec84eabcf179b9d7e4ea (diff) | |
download | clang-2cb17a06befb61b1434aaa991652fea4338c95d7.tar.gz clang-2cb17a06befb61b1434aaa991652fea4338c95d7.tar.bz2 clang-2cb17a06befb61b1434aaa991652fea4338c95d7.tar.xz |
Reland 192220 "Abstract out parts of thunk emission code, add support for simple thunks when using -cxx-abi microsoft" with relaxed assertions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192285 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/ABI.h')
-rw-r--r-- | include/clang/Basic/ABI.h | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/include/clang/Basic/ABI.h b/include/clang/Basic/ABI.h index fecf613a04..7c76ec130e 100644 --- a/include/clang/Basic/ABI.h +++ b/include/clang/Basic/ABI.h @@ -54,6 +54,10 @@ struct ReturnAdjustment { LHS.VBaseOffsetOffset == RHS.VBaseOffsetOffset; } + friend bool operator!=(const ReturnAdjustment &LHS, const ReturnAdjustment &RHS) { + return !(LHS == RHS); + } + friend bool operator<(const ReturnAdjustment &LHS, const ReturnAdjustment &RHS) { if (LHS.NonVirtual < RHS.NonVirtual) @@ -83,6 +87,10 @@ struct ThisAdjustment { return LHS.NonVirtual == RHS.NonVirtual && LHS.VCallOffsetOffset == RHS.VCallOffsetOffset; } + + friend bool operator!=(const ThisAdjustment &LHS, const ThisAdjustment &RHS) { + return !(LHS == RHS); + } friend bool operator<(const ThisAdjustment &LHS, const ThisAdjustment &RHS) { @@ -94,6 +102,8 @@ struct ThisAdjustment { } }; +class CXXMethodDecl; + /// \brief The \c this pointer adjustment as well as an optional return /// adjustment for a thunk. struct ThunkInfo { @@ -103,23 +113,25 @@ struct ThunkInfo { /// \brief The return adjustment. ReturnAdjustment Return; - ThunkInfo() { } + /// \brief Holds a pointer to the overridden method this thunk is for, + /// if needed by the ABI to distinguish different thunks with equal + /// adjustments. Otherwise, null. + /// CAUTION: In the unlikely event you need to sort ThunkInfos, consider using + /// an ABI-specific comparator. + const CXXMethodDecl *Method; - ThunkInfo(const ThisAdjustment &This, const ReturnAdjustment &Return) - : This(This), Return(Return) { } + ThunkInfo() : Method(0) { } - friend bool operator==(const ThunkInfo &LHS, const ThunkInfo &RHS) { - return LHS.This == RHS.This && LHS.Return == RHS.Return; - } + ThunkInfo(const ThisAdjustment &This, const ReturnAdjustment &Return, + const CXXMethodDecl *Method = 0) + : This(This), Return(Return), Method(Method) {} - friend bool operator<(const ThunkInfo &LHS, const ThunkInfo &RHS) { - if (LHS.This < RHS.This) - return true; - - return LHS.This == RHS.This && LHS.Return < RHS.Return; + friend bool operator==(const ThunkInfo &LHS, const ThunkInfo &RHS) { + return LHS.This == RHS.This && LHS.Return == RHS.Return && + LHS.Method == RHS.Method; } - bool isEmpty() const { return This.isEmpty() && Return.isEmpty(); } + bool isEmpty() const { return This.isEmpty() && Return.isEmpty() && Method == 0; } }; } // end namespace clang |