diff options
author | Reid Kleckner <rnk@google.com> | 2017-05-04 19:51:05 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-05-04 19:51:05 +0000 |
commit | 42925a0581982545cf101d7d2051ef09d2eaf970 (patch) | |
tree | a89e1efa7421775941f5f10135a6db96e9b65470 /include/clang/Basic/DiagnosticSemaKinds.td | |
parent | e9b4c0cdb33c97b06e7ca1f58f0a8ec254a7635e (diff) |
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
Diffstat (limited to 'include/clang/Basic/DiagnosticSemaKinds.td')
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index cc530a6dd4..ff9626d79d 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -7920,7 +7920,11 @@ def warn_empty_switch_body : Warning< def note_empty_body_on_separate_line : Note< "put the semicolon on a separate line to silence this warning">; -def err_va_start_used_in_non_variadic_function : Error< +def err_va_start_captured_stmt : Error< + "'va_start' cannot be used in a captured statement">; +def err_va_start_outside_function : Error< + "'va_start' cannot be used outside a function">; +def err_va_start_fixed_function : Error< "'va_start' used in function with fixed args">; def err_va_start_used_in_wrong_abi_function : Error< "'va_start' used in %select{System V|Win64}0 ABI function">; |