diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2019-10-03 13:00:29 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2019-10-03 13:00:29 +0000 |
commit | 4eef7a8ad0695039c9eca1e5fe6c89a37ba8bdf2 (patch) | |
tree | d9d5b18878d6c26ca2edf912057324559f131914 /include/clang/AST | |
parent | 84d475a5ed105e42257720e7720ec3f3faecfdda (diff) | |
download | clang-4eef7a8ad0695039c9eca1e5fe6c89a37ba8bdf2.tar.gz |
[Alignment][Clang][NFC] Add CharUnits::getAsAlign
Summary:
This is a prerequisite to removing `llvm::GlobalObject::setAlignment(unsigned)`.
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: jholewinski, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68274
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373592 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST')
-rw-r--r-- | include/clang/AST/CharUnits.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/clang/AST/CharUnits.h b/include/clang/AST/CharUnits.h index 37f489c770..f14d3abf71 100644 --- a/include/clang/AST/CharUnits.h +++ b/include/clang/AST/CharUnits.h @@ -14,6 +14,7 @@ #define LLVM_CLANG_AST_CHARUNITS_H #include "llvm/ADT/DenseMapInfo.h" +#include "llvm/Support/Alignment.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/MathExtras.h" @@ -177,6 +178,10 @@ namespace clang { /// getQuantity - Get the raw integer representation of this quantity. QuantityType getQuantity() const { return Quantity; } + /// getAsAlign - Returns Quantity as a valid llvm::Align, + /// Beware llvm::Align assumes power of two 8-bit bytes. + llvm::Align getAsAlign() const { return llvm::Align(Quantity); } + /// alignTo - Returns the next integer (mod 2**64) that is /// greater than or equal to this quantity and is a multiple of \p Align. /// Align must be non-zero. |