[PATCH] D121765: [CUDA][HIP] Fix hostness check with -fopenmp

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 24 08:32:20 PDT 2022


yaxunl marked an inline comment as done.
yaxunl added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:3325-3330
+  /// getCurFunctionDecl - If parsing a lambda, then return the lambda
+  /// declaration if \p AllowLambda is true, otherwise return the function
+  /// declaration enclosing the lambda. If in 'block' context, return the
+  /// enclosing function or lambda declaration if \p AllowLambda is true,
+  /// otherwise return the enclosing function declaration. For regular
+  /// functions, return the function declarations.
----------------
rsmith wrote:
> This comment would be clearer if it started with the common case and then explains any special cases. We also prefer to not include the function name at the start of the comment, so that should be removed when updating a function comment. It's also possible for a (member) function to be nested within a lambda, so I don't think it's correct that we will return the lambda whenever we're parsing one. Also, talking about "parsing" isn't right during template instantiation.
> 
> Maybe: "Returns a pointer to the innermost enclosing function, or `nullptr` if the current context is not inside a function. If \p AllowLambda is true, this can return the call operator of an enclosing lambda, otherwise lambdas are skipped when looking for an enclosing function."
Thanks. Will fix when committing.


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

https://reviews.llvm.org/D121765



More information about the cfe-commits mailing list