This is an archive of the discontinued LLVM Phabricator instance.

[CFG] [analyzer] Add construction context when the constructor is being no-op-casted to a const value type.
ClosedPublic

Authored by NoQ on Feb 19 2018, 2:13 PM.

Details

Summary

Because lifetime-extended temporaries are treated as const objects, an implicit NoOp cast to const usually surrounds them in the AST, somewhere between MaterializeTemporaryExpr and CXXBindTemporaryExpr. Skip the cast while looking for the construction context.

In the Analyzer this, again, is more useful for adding MaterializeTemporaryExpr to existing contexts (which are still to be used) than to finding more "top-level" contexts, because CXXBindTemporaryExpr is usually enough to provide some context, and if there's no CXXBindTemporaryExpr then we're having no destructors and we'd inline the constructor anyway. So there are no functional changes in the analyzer yet.

Diff Detail