[clang][OpenMP][DebugInfo] Debug support for TLS variables present in OpenMP consruct
authorAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Thu, 14 Apr 2022 09:04:22 +0000 (14:34 +0530)
committerAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Sat, 23 Apr 2022 06:59:32 +0000 (12:29 +0530)
commita48300aee570f8eea4ec0b03e2d176aab648afb0
tree923fc4d622d574cb2baad8e79ad1a8928919cf0c
parent9b8a04313f0ec9b262c4c3c5182dc5566f53fe67
[clang][OpenMP][DebugInfo] Debug support for TLS variables present in OpenMP consruct

In case of OpenMP programs, thread local variables can be present in
any clause pertaining to OpenMP constructs, as we know that compiler
generates artificial functions and in some cases values are passed to
those artificial functions thru parameters. For an example, if thread
local variable is present in copyin clause (testcase attached with the
patch), parameter with same name is generated as parameter to artificial
function. When user inquires the thread Local variable, its debug info
is hidden by the parameter. User never gets the actual TLS variable
when inquires it, instead gets the artificial parameter.

Current patch suppresses the debug info for such artificial parameter to
enable correct debugging of TLS variables.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D123787
clang/include/clang/AST/Decl.h
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/test/OpenMP/debug_threadprivate_copyin.c [new file with mode: 0644]