1 & 2 -- I'll resolve; good catch. 3 -- if there's not a current lexer, we have no way to know we're currently in a preprocessor directive (that I'm aware of). 4 -- I prefer not to move it up because the diagnostic uses LParenLoc; I could use Tok.getLocation, but that wraps the Diag call.
~Aaron On Tue, Jan 15, 2013 at 6:35 PM, Dmitri Gribenko <[email protected]> wrote: > On Wed, Jan 16, 2013 at 1:12 AM, Aaron Ballman <[email protected]> wrote: >> Yes, I prefer the way that looks -- new patch attached. Note that it >> does change another test in the test cases, but I think the change is >> beneficial. > > + // We only want to get the file name if we're currently within a > + // preprocessor directive. > + if (PP.getCurrentLexer() && > + !PP.getCurrentLexer()->isParsingPreprocessorDirective()) { > > 1. Trailing whitespace. > > 2. The comment should say something like "These macros are only > allowed in a PP directive." > > 3. What about the case when PP.getCurrentLexer() == 0? > > 4. You can move the check before LParenLoc is declared. > > Dmitri > > -- > main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if > (j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/ _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
