[PATCH] D32761: Fix bugs checking va_start in lambdas and erroneous contexts

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 2 14:43:31 PDT 2017


rnk created this revision.

First, getCurFunction looks through blocks and lambdas, which is wrong.
Inside a lambda, va_start should refer to the lambda call operator
prototype. This fixes PR32737.

Second, we shouldn't use any of the getCur* methods, because they look
through contexts that we don't want to look through (EnumDecl,
CapturedStmtDecl). We can use CurContext directly as the calling
context.

Finally, this code assumed that CallExprs would never appear outside of
code contexts (block, function, obj-c method), which is wrong. Struct
member initializers are an easy way to create and parse exprs in a
non-code context.


https://reviews.llvm.org/D32761

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaChecking.cpp
  clang/test/OpenMP/varargs.cpp
  clang/test/SemaCXX/varargs.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32761.97503.patch
Type: text/x-patch
Size: 5074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170502/dc4203a2/attachment.bin>


More information about the cfe-commits mailing list