r265343 - [CrashReproducer] Pass -I, -F and -resource-dir to the reproducer script when using modules/vfs
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 4 13:26:58 PDT 2016
Author: bruno
Date: Mon Apr 4 15:26:57 2016
New Revision: 265343
URL: http://llvm.org/viewvc/llvm-project?rev=265343&view=rev
Log:
[CrashReproducer] Pass -I, -F and -resource-dir to the reproducer script when using modules/vfs
The reproducer should use -I/-F/-resource-dir in the same way as the
original command. The VFS already collects the right headers but without
these flags the reproducer will fail to do the right thing.
Modified:
cfe/trunk/lib/Driver/Job.cpp
cfe/trunk/test/Modules/crash-vfs-relative-overlay.m
Modified: cfe/trunk/lib/Driver/Job.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=265343&r1=265342&r2=265343&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Job.cpp (original)
+++ cfe/trunk/lib/Driver/Job.cpp Mon Apr 4 15:26:57 2016
@@ -41,17 +41,16 @@ static int skipArgs(const char *Flag, bo
// These flags are all of the form -Flag <Arg> and are treated as two
// arguments. Therefore, we need to skip the flag and the next argument.
bool Res = llvm::StringSwitch<bool>(Flag)
- .Cases("-I", "-MF", "-MT", "-MQ", true)
+ .Cases("-MF", "-MT", "-MQ", "-serialize-diagnostic-file", true)
.Cases("-o", "-coverage-file", "-dependency-file", true)
.Cases("-fdebug-compilation-dir", "-idirafter", true)
.Cases("-include", "-include-pch", "-internal-isystem", true)
.Cases("-internal-externc-isystem", "-iprefix", "-iwithprefix", true)
.Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
- .Cases("-resource-dir", "-serialize-diagnostic-file", true)
.Cases("-dwarf-debug-flags", "-ivfsoverlay", true)
.Cases("-header-include-file", "-diagnostic-log-file", true)
// Some include flags shouldn't be skipped if we have a crash VFS
- .Case("-isysroot", !HaveCrashVFS)
+ .Cases("-isysroot", "-I", "-F", "-resource-dir", !HaveCrashVFS)
.Default(false);
// Match found.
@@ -72,7 +71,8 @@ static int skipArgs(const char *Flag, bo
// These flags are treated as a single argument (e.g., -F<Dir>).
StringRef FlagRef(Flag);
- if (FlagRef.startswith("-F") || FlagRef.startswith("-I") ||
+ if ((!HaveCrashVFS &&
+ (FlagRef.startswith("-F") || FlagRef.startswith("-I"))) ||
FlagRef.startswith("-fmodules-cache-path="))
return 1;
Modified: cfe/trunk/test/Modules/crash-vfs-relative-overlay.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-relative-overlay.m?rev=265343&r1=265342&r2=265343&view=diff
==============================================================================
--- cfe/trunk/test/Modules/crash-vfs-relative-overlay.m (original)
+++ cfe/trunk/test/Modules/crash-vfs-relative-overlay.m Mon Apr 4 15:26:57 2016
@@ -7,8 +7,9 @@
// RUN: mkdir -p %t/i %t/m %t
// RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
-// RUN: %clang -fsyntax-only %s -I %S/Inputs/crash-recovery -isysroot %/t/i/ \
-// RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
+// RUN: %clang -fsyntax-only -nostdinc %s \
+// RUN: -I %S/Inputs/crash-recovery/usr/include -isysroot %/t/i/ \
+// RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
// RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m
// RUN: FileCheck --check-prefix=CHECKSH %s -input-file %t/crash-vfs-*.sh
@@ -17,7 +18,7 @@
// RUN: find %t/crash-vfs-*.cache/vfs | \
// RUN: grep "Inputs/crash-recovery/usr/include/stdio.h" | count 1
-#include "usr/include/stdio.h"
+#include <stdio.h>
// CHECK: Preprocessed source(s) and associated run script(s) are located at:
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
@@ -29,8 +30,8 @@
// CHECKSH-NEXT: # Driver args: "-fsyntax-only"
// CHECKSH-NEXT: # Original command: {{.*$}}
// CHECKSH-NEXT: "-cc1"
+// CHECKSH: "-resource-dir"
// CHECKSH: "-isysroot" "{{[^"]*}}/i/"
-// CHECKSH-NOT: "-fmodules-cache-path="
// CHECKSH: "crash-vfs-{{[^ ]*}}.m"
// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
@@ -49,7 +50,7 @@
// the overlay dir is prefixed to access headers in .cache/vfs directory.
// RUN: unset FORCE_CLANG_DIAGNOSTICS_CRASH
-// RUN: %clang -E %s -I %S/Inputs/crash-recovery -isysroot %/t/i/ \
+// RUN: %clang -E %s -I %S/Inputs/crash-recovery/usr/include -isysroot %/t/i/ \
// RUN: -ivfsoverlay %t/crash-vfs-*.cache/vfs/vfs.yaml -fmodules \
// RUN: -fmodules-cache-path=%t/m/ 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECKOVERLAY
More information about the cfe-commits
mailing list