This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Push and Pop Expression Evaluation Context Records at the start and end of function definitions
ClosedPublic

Authored by leonardchan on Nov 1 2018, 5:16 PM.

Details

Summary

This patch creates a new context for every function definition we enter. Currently we do not push and pop on these, usually working off of the global context record added in the Sema constructor, which never gets popped.

Ideally this will be one of the first patches for pushing and popping records so that we operate less off the global Sema record. I tried doing this as @rsmith recommends in https://reviews.llvm.org/D49511?id=160892#inline-451745, but ended up running into many issues that would be better addressed accross multiple patches.

Parent of https://reviews.llvm.org/D49511 where we would like to check for noderef usage on each context.

Diff Detail

Repository
rC Clang

Event Timeline

rsmith accepted this revision.Dec 5 2018, 1:52 PM

Thanks!

clang/lib/Sema/SemaDecl.cpp
13181–13182 ↗(On Diff #172272)

Adding this pop before each return seems error-prone. Can you do this with an RAII object instead?

This revision is now accepted and ready to land.Dec 5 2018, 1:52 PM
leonardchan marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.