This is an archive of the discontinued LLVM Phabricator instance.

Fix bugs checking va_start in lambdas and erroneous contexts
ClosedPublic

Authored by rnk on May 2 2017, 2:43 PM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.May 2 2017, 2:43 PM
This revision was automatically updated to reflect the committed changes.