[PATCH] D156604: [clang][ExprConst] Use call source range for 'in call to' diags

Takuya Shimizu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 1 01:37:58 PDT 2023


hazohelet added a comment.

In D156604#4549524 <https://reviews.llvm.org/D156604#4549524>, @tbaeder wrote:

> @hazohelet I changed this to just return `CallExpr->getSourceRange()` and to not save a source range separately. Can you give this a look please?

I was thinking about removing `CallLoc` some time ago, and concluded that we shouldn't.
Destructor calls are usually not explicitly written by the user, so `CallExpr` is set to null. `CallLoc` is often set to the declaration location (https://github.com/llvm/llvm-project/blob/97cddb78502eee583b5f4ee02c59b7156398587f/clang/lib/AST/ExprConstant.cpp#L703-L708).
So we'll lose this information if we are to remove `CallLoc` from the stack frame, and it seems to be the reason for the test failures.

About getting source range from `CallExpr->getSourceRange`, I don't see any obvious problems. All explicitly-written function calls should have its AST in `CallExpr` field.
So using the `CallLoc` for the diagnostics location and `CallExpr->getSourceRange` for the source range would do the trick.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156604/new/

https://reviews.llvm.org/D156604



More information about the cfe-commits mailing list