[cfe-commits] [PATCH] Disallow __has_include and __has_include_next outside of preprocessor directives
Aaron Ballman
aaron at aaronballman.com
Wed Jan 16 10:07:09 PST 2013
RAII it is then -- once I've made the changes and committed, I'll post
the rev here and you can review after commit if you'd like. Thanks
for the tenacity!
~Aaron
On Wed, Jan 16, 2013 at 1:04 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Wed, Jan 16, 2013 at 7:52 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> On Wed, Jan 16, 2013 at 10:33 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>>> On Wed, Jan 16, 2013 at 3:15 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>>>> This patch moves the logic around slightly to handle macros better;
>>>> instead of relying on the PP Lexer, we track the information in the PP
>>>> itself so that is is always available. I've expanded the test cases
>>>> to cover macros more fully.
>>>
>>> void Preprocessor::HandleIfDirective(Token &IfToken,
>>> bool ReadAnyTokensBeforeDirective) {
>>> + ParsingPreprocessorDirective = true;
>>> ++NumIf;
>>>
>>> // Parse and evaluate the conditional expression.
>>> @@ -2101,6 +2102,7 @@
>>> SkipExcludedConditionalBlock(IfToken.getLocation(), /*Foundnonskip*/false,
>>> /*FoundElse*/false);
>>> }
>>> + ParsingPreprocessorDirective = false;
>>> }
>>>
>>> We have llvm/Support/SaveAndRestore.h to simplify this.
>>
>> That's neat, I didn't notice we had that. However, using that would
>> mean I couldn't use a bit-field for the property either (due to
>> requiring a reference). So the question I have is: which is "better"?
>> Given that we already have several other boolean bitfields, I am on
>> the fence.
>
> The size of the preprocessor object should not be a big issue, so I
> would go with RAII.
>
> 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 <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list