From fe08e406c1d03d3bed9d93d745501e5e179d19d0 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sat, 2 Oct 2010 20:06:51 +0000 Subject: [PATCH] Don't add -fno-spell-checking in libclang if a spell-checking-related argument is already in the command-line arguments git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115420 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/libclang/CIndex.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 04d0bc50d6..4f551b4190 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2042,9 +2042,17 @@ static void clang_parseTranslationUnit_Impl(void *UserData) { // (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); -- 2.50.1