[PATCH] D33497: clang-tidy check for __func__/__FUNCTION__ in lambdas

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 08:16:40 PDT 2017


lebedev.ri added a comment.

1. What about `__PRETTY_FUNCTION__` ?
2. Consider following generic error handling macro:

(ThrowException is some template function)

  #undef STR
  #define STR(a) XSTR(a)
  
  #define ThrowExceptionHelper(CLASS, fmt, ...) ThrowException<CLASS>(__FILE__ ":" STR(__LINE__) ": %s: " fmt, __PRETTY_FUNCTION__, ##__VA_ARGS__)
  #endif

Which is called like `if(somethig) ThrowException(std::exception, "%s", "bar");`
Even though the function name may be useless, file/line info is still there and is(?) correct.
Perhaps there should not be a warning in such a case?


https://reviews.llvm.org/D33497





More information about the cfe-commits mailing list