diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-06-28 16:10:13 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-06-28 16:10:13 +0000 |
commit | 62d7afad8faf7a1fbbf3402f8e23ce4ece9ab108 (patch) | |
tree | d302bbdc65dd8eef01f8d303ac87c9db93d82da1 /lib/Support | |
parent | ceb5bc7df1a3f6b1d4a301adf30f4d0e21bbaa15 (diff) | |
download | external_llvm-62d7afad8faf7a1fbbf3402f8e23ce4ece9ab108.zip external_llvm-62d7afad8faf7a1fbbf3402f8e23ce4ece9ab108.tar.gz external_llvm-62d7afad8faf7a1fbbf3402f8e23ce4ece9ab108.tar.bz2 |
add ConstantRange::difference (to perform set difference/relative complement)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159352 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/ConstantRange.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp index 61d333f..91d086b 100644 --- a/lib/Support/ConstantRange.cpp +++ b/lib/Support/ConstantRange.cpp @@ -248,6 +248,12 @@ ConstantRange ConstantRange::subtract(const APInt &Val) const { return ConstantRange(Lower - Val, Upper - Val); } +/// \brief Subtract the specified range from this range (aka relative complement +/// of the sets). +ConstantRange ConstantRange::difference(const ConstantRange &CR) const { + return intersectWith(CR.inverse()); +} + /// intersectWith - Return the range that results from the intersection of this /// range with another range. The resultant range is guaranteed to include all /// elements contained in both input ranges, and to have the smallest possible |