This is an archive of the discontinued LLVM Phabricator instance.

[ASTImporter] Merge ExprBits
ClosedPublic

Authored by martong on Aug 31 2018, 2:57 AM.

Details

Summary

Some Expr classes set up default values for the ExprBits of Stmt. These
default values are then overwritten by the parser sometimes. One example is
InitListExpr which sets the value kind to be an rvalue in the ctor. However,
this bit may change after the InitListExpr is created. There may be other
expressions similar to InitListExpr in this sense, thus the safest solution
is to copy the expression bits.

The lack of copying ExprBits causes an assertion in the analyzer engine in a
specific case: Since the value kind is not imported, the analyzer engine
believes that the given InitListExpr is an rvalue, thus it creates a
nonloc::CompoundVal instead of creating memory region (as in case of an lvalue
reference).

Diff Detail

Repository
rL LLVM

Event Timeline

martong created this revision.Aug 31 2018, 2:57 AM
a_sidorin accepted this revision.Sep 2 2018, 1:51 PM

Looks good, thanks!

unittests/AST/ASTImporterTest.cpp
3241 ↗(On Diff #163494)

EXPECT_TRUE (same below).

This revision is now accepted and ready to land.Sep 2 2018, 1:51 PM
This revision was automatically updated to reflect the committed changes.
martong marked an inline comment as done.
martong added inline comments.Sep 3 2018, 6:12 AM
unittests/AST/ASTImporterTest.cpp
3241 ↗(On Diff #163494)

Thanks, changed it.