Closed balazske closed 6 years ago
The Decl is first visited (without a DeclRefExpr and in non-used state), then the DeclRefExpr that contains the same Decl object and the 'used' flag is set to true here.
What about setting explicitly the used flag in VisitDeclRefExpr
?
The same Decl object is tried to be imported more than once
How could that happen? We should assert if we are trying to import something already imported.
"Already imported" means here that Import
was called already on it. If Import
is called again the existing (imported) object is returned. (With the new changes, the existing object's isUsed value can be updated. I suspect that it is possible that other flags or attributes needs to be updated too.)
"Already imported" means here that Import was called already on it. If Import is called again the existing (imported) object is returned.
Then perhaps the flag update could be done in Import(Decl*)
right before return. That seems more clean to me than to change in an already misused function which should be const and should not modify its parameters.
Updated code.
There was a failure in lldb test (issue #374): test_top_level_expressions_dwarf (TestTopLevelExprs.TopLevelExpressionsTestCase) "Should not use decl without marking it used!" This problem should be fixed now.