diff options
author | Craig Topper <craig.topper@intel.com> | 2018-08-08 20:59:40 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-08-08 20:59:40 +0000 |
commit | 9ff024a54fefa08cb93065e25ecbb974b74bc6e4 (patch) | |
tree | 0d4597b24dfa19e807119c764fb22e24a0d306fb /clang/lib/AST/ExprConstant.cpp | |
parent | c4ede8f8af27e328c9d4dcbe5f8c9a07b4653d4b (diff) | |
download | llvm-9ff024a54fefa08cb93065e25ecbb974b74bc6e4.zip llvm-9ff024a54fefa08cb93065e25ecbb974b74bc6e4.tar.gz llvm-9ff024a54fefa08cb93065e25ecbb974b74bc6e4.tar.bz2 |
[Builtins] Add __builtin_clrsb support to IntExprEvaluator::VisitBuiltinCallExpr
This addresses a FIXME that has existed since before clang supported the builtin.
Differential Revision: https://reviews.llvm.org/D50471
llvm-svn: 339287
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 7e596d0..0ce962e 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -8117,9 +8117,15 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E, case Builtin::BI__builtin_classify_type: return Success((int)EvaluateBuiltinClassifyType(E, Info.getLangOpts()), E); - // FIXME: BI__builtin_clrsb - // FIXME: BI__builtin_clrsbl - // FIXME: BI__builtin_clrsbll + case Builtin::BI__builtin_clrsb: + case Builtin::BI__builtin_clrsbl: + case Builtin::BI__builtin_clrsbll: { + APSInt Val; + if (!EvaluateInteger(E->getArg(0), Val, Info)) + return false; + + return Success(Val.getBitWidth() - Val.getMinSignedBits(), E); + } case Builtin::BI__builtin_clz: case Builtin::BI__builtin_clzl: |