aaron.ballman added a comment.

In D136343#3873284 <https://reviews.llvm.org/D136343#3873284>, @Qfrost911 wrote:

> I understand you mean, but I can't get function name at macro expedition 
> stage.

Correct! We have a `PredefinedExpr` AST node type 
(https://github.com/llvm/llvm-project/blob/main/clang/include/clang/AST/Expr.h#L1968)
 to handle this, and it seems we already support `__FUNCTION__` (and friends): 
https://godbolt.org/z/cEWh1Prnx. However, we're matching the GCC behavior for 
printing a member function name instead of following the MSVC behavior when in 
`-fms-compatibility` mode, which we might want to consider changing.

The reason your code example in the summary doesn't compile is because a 
`PredefinedExpr` is not a string literal, so there is no way to do string 
concatenation with an adjacent literal. MSVC implements these as actual macros 
that expand to a string literal, which is not a behavior Clang can easily match.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136343

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to