[PATCH] D52939: ExprConstant: Propagate correct return values from constant evaluation.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 5 11:07:53 PDT 2018


jyknight created this revision.
jyknight added a reviewer: rsmith.

The constant evaluation now returns false whenever indicating failure
would be appropriate for the requested mode, instead of returning
"true" for success, and depending on the caller examining the various
status variables after the fact, in some circumstances.

In EM_ConstantExpression mode, evaluation is aborted as soon as a
diagnostic note is generated, and therefore, a "true" return value now
actually indicates that the expression was a constexpr. (You no longer
have to additionally check for a lack of diagnostic messages.)

In EM_ConstantFold, evaluation is now aborted upon running into a
side-effect -- so a "true" return value now actually indicates that
there were no side-effects

Also -- update and clarify documentation for the evaluation modes.

This is a cleanup, not intending to change the functionality, as
callers had been checking those properties manually before.


https://reviews.llvm.org/D52939

Files:
  clang/include/clang/AST/Expr.h
  clang/lib/AST/ExprConstant.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52939.168493.patch
Type: text/x-patch
Size: 40688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181005/98bc0fca/attachment-0001.bin>


More information about the cfe-commits mailing list