[cfe-commits] r115420 - /cfe/trunk/tools/libclang/CIndex.cpp

Douglas Gregor dgregor at apple.com
Wed Oct 6 20:28:40 PDT 2010


On Oct 6, 2010, at 8:08 PM, Daniel Dunbar wrote:

> Not exactly sure what this is solving, but it could probably just add
> the arg at the beginning. This code would fail of we renamed the
> option or made aliases for it.

That's what we did before, but we end up getting unused-argument warnings that I didn't want to see any more.

	- Doug


> - Daniel
> 
> 
> On Oct 2, 2010, at 13:06, Douglas Gregor <dgregor at apple.com> wrote:
> 
>> Author: dgregor
>> Date: Sat Oct  2 15:06:51 2010
>> New Revision: 115420
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=115420&view=rev
>> Log:
>> Don't add -fno-spell-checking in libclang if a spell-checking-related argument is already in the command-line arguments
>> 
>> Modified:
>>   cfe/trunk/tools/libclang/CIndex.cpp
>> 
>> Modified: cfe/trunk/tools/libclang/CIndex.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=115420&r1=115419&r2=115420&view=diff
>> ==============================================================================
>> --- cfe/trunk/tools/libclang/CIndex.cpp (original)
>> +++ cfe/trunk/tools/libclang/CIndex.cpp Sat Oct  2 15:06:51 2010
>> @@ -2042,9 +2042,17 @@
>>    // (often very broken) source code, where spell-checking can have a
>>    // significant negative impact on performance (particularly when
>>    // precompiled headers are involved), we disable it by default.
>> -    // Note that we place this argument early in the list, so that it can be
>> -    // overridden by the caller with "-fspell-checking".
>> -    Args.push_back("-fno-spell-checking");
>> +    // Only do this if we haven't found a spell-checking-related argument.
>> +    bool FoundSpellCheckingArgument = false;
>> +    for (int I = 0; I != num_command_line_args; ++I) {
>> +      if (strcmp(command_line_args[I], "-fno-spell-checking") == 0 ||
>> +          strcmp(command_line_args[I], "-fspell-checking") == 0) {
>> +        FoundSpellCheckingArgument = true;
>> +        break;
>> +      }
>> +    }
>> +    if (!FoundSpellCheckingArgument)
>> +      Args.push_back("-fno-spell-checking");
>> 
>>    Args.insert(Args.end(), command_line_args,
>>                command_line_args + num_command_line_args);
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list