Description
In systemd, we define the following macro:
#define _cleanup_(x) __attribute__((__cleanup__(x)))
This breaks the integration for __cleanup__
that I added in #138669.
The problem is caused by this bit of code in Analysis.cpp:
auto FID = SM.getFileID(SM.getSpellingLoc(Loc));
if (FID != SM.getMainFileID() && FID != SM.getPreambleFileID())
return;
The location passed in VisitCleanupAttr()
doesn't map to either the main file ID or the preamble file ID.
I assume this happens because we only have a location for the cleanup attribute which is mapped back to the macro. But we don't seem to have a location for the function decl that's in the cleanup macro. Otherwise I'd pass in that location and expect things to work but that doesn't seem to be an option.
Happy to work on a fix, I just don't have a clue what the best way to fix this would be.