[cfe-dev] Crash in TagType::getAsString()

Alexei Svitkine alexei.svitkine at gmail.com
Tue Jan 13 21:29:13 PST 2009


Ok I figured out my problem.

Turns out the Preprocessor owns the IdentifierTable and I wasn't
keeping the Preprocessor around.

Are there any docs on what parts of the AST are owned by what? Also,
is there any way to get at the objects allocated by ParseAST if the
FreeMemory argument is false, so that I can delete them when I am done
with them?

Is there a reason that there isn't a self-contained AST object that
contains and owns everything necessary, rather than having different
parts of it owned by different classes?

It seems weird to me that the Preprocessor would retain ownership to
something used by the AST. To me, the name Preprocessor suggests that
its purpose it to preprocess the code, and I shouldn't need to keep it
around after that's done (but evidently that's not the case).

Sorry if there is a good reason to keep it this way, and I am just missing it.

-Alexei



More information about the cfe-dev mailing list