During analysis of one project we failed to import one
CXXDestructorDecl. But since we did not propagate the error in
importDeclContext we had a CXXRecordDecl without a destructor. Then the
analyzer engine had a CallEvent where the nonexistent dtor was requested
(crash).
Solution is to propagate the errors we have during importing a
DeclContext.
You might consider using just a lambda with llvm::make_scope_exit.
https://llvm.org/doxygen/namespacellvm.html#a4896534f3c6278be56967444daf38e3f
For example: