[cfe-commits] [PATCH] Missing call to preprocessor callback.

Enea Zaffanella zaffanella at cs.unipr.it
Mon Jan 14 03:05:20 PST 2013


Hello.

The comment for the preprocessor callback MacroUndefined says:

   /// \brief Hook called whenever a macro \#undef is seen.

However, in function

   void Preprocessor::HandleUndefDirective(Token &UndefTok) {

the callback is only called after the following check:

   // If the macro is not defined, this is a noop undef, just return.
   if (MI == 0) return;

As a result, the client is not notified for some of the #undef's.

Afawct, the client should always be notified, no matter if the macro was 
actually defined or not (if it was not previously defined, the callback 
should be passed in the null MacroInfo pointer).

Please, find attached a corresponding patch for review.

NOTE: searching the mailing list, it seems the same issue was reported 
by Jason Haslam in the following post, apparently with no follow up:

 
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120220/053916.html

Enea.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MacroUndefined.patch
Type: text/x-diff
Size: 1521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130114/3eb772dd/attachment.patch>


More information about the cfe-commits mailing list