[cfe-commits] Add a method which checks if an expression could be turned into a function call (issue4439065)

matthewbg at google.com matthewbg at google.com
Mon Apr 25 10:55:55 PDT 2011


PTAL


http://codereview.appspot.com/4439065/diff/1/include/clang/Sema/Sema.h
File include/clang/Sema/Sema.h (right):

http://codereview.appspot.com/4439065/diff/1/include/clang/Sema/Sema.h#newcode1940
include/clang/Sema/Sema.h:1940: bool CanCall(const Expr* E, QualType&
ZeroArgCallReturnTy,
On 2011/04/22 22:24:44, chandlerc wrote:
> I think a bit more context in the name would help when this is stuffed
into the
> Sema interface of dhoom...

> IsExprCallable?

Good call. I had something long and unwieldy in an early version,
"IsExprCallable" is a nice medium.

Also, is there a better place within this file to put the declaration
(likewise for the definition)?

http://codereview.appspot.com/4439065/diff/1/lib/Sema/Sema.cpp
File lib/Sema/Sema.cpp (right):

http://codereview.appspot.com/4439065/diff/1/lib/Sema/Sema.cpp#newcode757
lib/Sema/Sema.cpp:757: /// Use this when trying to recover from an error
that could have been due to
On 2011/04/22 22:24:44, chandlerc wrote:
> "... that could have been due to the programmer writing ..."

> to

> "... where the programmer may have written ..."

Done.

http://codereview.appspot.com/4439065/diff/1/lib/Sema/Sema.cpp#newcode767
lib/Sema/Sema.cpp:767: bool Sema::CanCall(const Expr* E, QualType&
ZeroArgCallReturnTy,
On 2011/04/22 22:24:44, chandlerc wrote:
> Can E be NULL? If not, maybe use a const & here?

Done.

http://codereview.appspot.com/4439065/diff/1/lib/Sema/SemaExpr.cpp
File lib/Sema/SemaExpr.cpp (right):

http://codereview.appspot.com/4439065/diff/1/lib/Sema/SemaExpr.cpp#newcode4340
lib/Sema/SemaExpr.cpp:4340: UnresolvedSet<4> AllOverloads;
On 2011/04/22 22:24:44, chandlerc wrote:
> Maybe an inline size of 1 instead of 4? That seems to be the case
you're
> optimizing for anyways... but then again, we've already hit an error.

This made more sense when I was using AllOverloads for a greater purpose
than asking if there was >1 overload, i.e. printing "did you mean this
overload?" notes. I originally ripped that code out because it was
complicated and ugly. I've re-added it in slightly less ugly form, but
there's probably still room for improvement.

http://codereview.appspot.com/4439065/diff/1/lib/Sema/SemaExpr.cpp#newcode4342
lib/Sema/SemaExpr.cpp:4342: if (ZeroArgCallTy.isNull()) {
On 2011/04/22 22:24:44, chandlerc wrote:
> No need for an explicit isNull(), conversion to bool works here.

Er, compiler disagrees with you.

http://codereview.appspot.com/4439065/



More information about the cfe-commits mailing list