On 11-09-16 16:25 , Joachim Wieland wrote:
Hm, I don't see how exactly this would solve my problem... The issue I am facing is that references to necessary header files are optimized away. Just knowing that an expression has been folded doesn't help me... :-(
Sorry, I was too cryptic. The setting of EXPR_FOLDED would be the places where you want to capture the unfolded trees.
What I had in mind was to only keep additional copies of the original subtrees if the node has been replaced completely by folding. I don't see why memory consumption would go through the roof that way, this would mean that a very high percentage of the code can be folded and shrinked significantly which shouldn't be true in the general case. Of course I see that it can be difficult to implement this, it might require changes to every folding function.
IIUC, for every folded tree you want to keep the original form, right? That causes increased memory consumption.
Is there any function that I could create a hook for which still sees an unfolded expression?
Not really. At least, not using plugins. You'll need to modify the compiler for that.
If you are doing analysis this close to the original source, however, you may want to consider clang. GCC does not try to keep its ASTs close to the original source.
Diego.