Fix infinite recursion in deferred diag emitter
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Fri, 27 Mar 2020 16:38:20 +0000 (12:38 -0400)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Thu, 2 Apr 2020 02:17:43 +0000 (22:17 -0400)
commit5767085c8de97d15d7fb5433f22bb5b858cc4f3a
tree17b95ce23ce16bd6bdc9d0123a50b86543edef75
parentff09135fc2b7a9696f87a8a8e89be2ef777895d3
Fix infinite recursion in deferred diag emitter

Currently deferred diagnostic emitter checks variable decl in DeclRefExpr, which
causes infinite recursion for cases like long a = (long)&a;.

Deferred diagnostic emitter does not need check variable decls in DeclRefExpr
since reference of a variable does not cause emission of functions directly or
indirectly. Therefore there is no need to check variable decls in DeclRefExpr.

Differential Revision: https://reviews.llvm.org/D76937
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaDecl.cpp
clang/test/OpenMP/nvptx_target_exceptions_messages.cpp