summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-10-02 20:06:51 +0000
committerDouglas Gregor <dgregor@apple.com>2010-10-02 20:06:51 +0000
commitdb9fb5a42777f3c215dd10a8f53e787d5b0609a5 (patch)
treeff10113ae4a671c354a28c1ecb00a7f0a0bdc69b /clang/tools/libclang/CIndex.cpp
parent3478c75b7171d235297ba3e8846093ac88f1c295 (diff)
downloadbcm5719-llvm-db9fb5a42777f3c215dd10a8f53e787d5b0609a5.tar.gz
bcm5719-llvm-db9fb5a42777f3c215dd10a8f53e787d5b0609a5.zip
Don't add -fno-spell-checking in libclang if a spell-checking-related argument is already in the command-line arguments
llvm-svn: 115420
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 04d0bc50d60..4f551b4190e 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud