[cfe-dev] Patch to allow comment translators implementation
Chris Lattner
clattner at apple.com
Mon Feb 1 18:20:03 PST 2010
On Jan 28, 2010, at 2:19 PM, Abramo Bagnara wrote:
>> I'm sorry for the delay. I think that #1 is the best approach.
>> Comment handles should not be invoked on things in #if 0 blocks,
>> because #if 0 blocks should be completely skipped according to the
>> rules of the preprocessor: not doing this would invalidate the
>> "include once" optimization that is applied to files wrapped in the
>> "#ifndef FOO_H / #define FOO_H ... #endif" idiom.
>>
>> In short, I think that #1 is the right fix.
>
> I've attached a (trivial) patch to do that.
Thanks Abramo,
Does it work to use a simpler patch that does something like this in
both places that currently call HandleComment:
// Found but did not consume the newline.
- if (PP && PP->HandleComment(Result,
- SourceRange(getSourceLocation(BufferPtr),
-
getSourceLocation(CurPtr)))) {
+ if (PP && !isLexingRawMode() &&
+ PP->HandleComment(Result,
SourceRange(getSourceLocation(BufferPtr),
+
getSourceLocation(CurPtr)))) {
?
If so, please supply a patch (I can't test this) and I'll happily
apply it for you,
-Chris
More information about the cfe-dev
mailing list