]> granicus.if.org Git - clang/commit
Fix bugs checking va_start in lambdas and erroneous contexts
authorReid Kleckner <rnk@google.com>
Thu, 4 May 2017 19:51:05 +0000 (19:51 +0000)
committerReid Kleckner <rnk@google.com>
Thu, 4 May 2017 19:51:05 +0000 (19:51 +0000)
commit42925a0581982545cf101d7d2051ef09d2eaf970
treea89e1efa7421775941f5f10135a6db96e9b65470
parente9b4c0cdb33c97b06e7ca1f58f0a8ec254a7635e
Fix bugs checking va_start in lambdas and erroneous contexts

Summary:
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.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D32761

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302188 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaChecking.cpp
test/OpenMP/varargs.cpp [new file with mode: 0644]
test/SemaCXX/varargs.cpp