This is an archive of the discontinued LLVM Phabricator instance.

Divide TraverseInitListExpr to a different function for each form.
ClosedPublic

Authored by angelgarcia on Sep 29 2015, 8:52 AM.

Diff Detail

Event Timeline

angelgarcia retitled this revision from to Divide TraverseInitListExpr to a different function for each form..
angelgarcia updated this object.
angelgarcia added a reviewer: klimek.
angelgarcia added subscribers: alexfh, cfe-commits.
klimek added inline comments.Sep 29 2015, 10:22 AM
include/clang/AST/RecursiveASTVisitor.h
2083

Did you try putting an assert(S->isSemanticForm()); (or the reverse) here?

Yes, it breaks a few tests:

FAIL: Clang :: Analysis/operator-calls.cpp (598 of 8596)

FAIL: Clang :: Analysis/misc-ps-region-store.cpp (599 of 8596)

FAIL: Clang :: Analysis/array-struct-region.c (602 of 8596)

klimek edited edge metadata.Sep 29 2015, 9:03 PM
klimek added a subscriber: klimek.

I think it's worth figuring out when this is called with the semantic or
syntactic version and why this can't lead to double visitation. Then add a
comment while you're changing the method so the next person doesn't have to
figure it all out :)

angelgarcia edited edge metadata.

Add some comments.

klimek added inline comments.Sep 30 2015, 6:58 AM
include/clang/AST/RecursiveASTVisitor.h
2065–2075

Ok, I'd now pull out the first line of these functions into the TraverseInitListExpr, and then we only need one function here, right?

2077–2081

I think we can remove this - I'm not sure it adds value.

+richard to tell us whether that comment is correct :)

Use only one function.

I find somewhat frustating that getSemanticForm() returns nullptr if the object is already in its semantic form (and the same for isSyntacticForm()). Something like QualType::getNonReferenceType(), that returns the object itself if it is already a non-reference type, would be more intuitive.

klimek accepted this revision.Oct 1 2015, 1:42 AM
klimek edited edge metadata.

LG

This revision is now accepted and ready to land.Oct 1 2015, 1:42 AM
angelgarcia closed this revision.Oct 2 2015, 6:27 AM