summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-06-19 19:36:03 +0000
committerJustin Bogner <mail@justinbogner.com>2014-06-19 19:36:03 +0000
commit86d1259ca78b291cd5e11e5aaf797d8c387643f2 (patch)
tree9cc300d4e4303632bb3d108a4b41de94da5e4f82 /clang/test/Modules
parentcd45f963e2bbd97ad7cb657e668ef7ca3de7ee27 (diff)
downloadbcm5719-llvm-86d1259ca78b291cd5e11e5aaf797d8c387643f2.tar.gz
bcm5719-llvm-86d1259ca78b291cd5e11e5aaf797d8c387643f2.zip
Frontend: Add a CC1 flag to dump module dependencies to a directory
This adds the -module-dependency-dir to clang -cc1, which specifies a directory to copy all of a module's dependencies into in a form suitable to be used as a VFS using -ivfsoverlay with the generated vfs.yaml. This is useful for crashdumps that involve modules, so that the module dependencies will be intact when a crash report script is used to reproduce a problem on another machine. We currently encode the absolute path to the dump directory, due to limitations in the VFS system. Until we can handle relative paths in the VFS, users of the VFS map may need to run a simple search and replace in the file. llvm-svn: 211303
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/dependency-dump-dependent-module.m27
-rw-r--r--clang/test/Modules/dependency-dump.m25
2 files changed, 52 insertions, 0 deletions
diff --git a/clang/test/Modules/dependency-dump-dependent-module.m b/clang/test/Modules/dependency-dump-dependent-module.m
new file mode 100644
index 00000000000..5308f7efba3
--- /dev/null
+++ b/clang/test/Modules/dependency-dump-dependent-module.m
@@ -0,0 +1,27 @@
+// When a module depends on another, check that we dump the dependency header
+// files for both.
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -module-dependency-dir %t/vfs -F %S/Inputs -I %S/Inputs -verify %s
+// expected-no-diagnostics
+
+// RUN: FileCheck %s -check-prefix=VFS < %t/vfs/vfs.yaml
+// VFS: 'name': "AlsoDependsOnModule.h"
+// VFS: 'name': "SubFramework.h"
+// VFS: 'name': "Treasure.h"
+// VFS: 'name': "Module.h"
+// VFS: 'name': "Sub.h"
+// VFS: 'name': "Sub2.h"
+
+// TODO: We need shell to use find here. Is there a simpler way?
+// REQUIRES: shell
+
+// RUN: find %t/vfs -type f | FileCheck %s -check-prefix=DUMP
+// DUMP: AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h
+// DUMP: Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h
+// DUMP: Module.framework/Headers/Buried/Treasure.h
+// DUMP: Module.framework/Headers/Module.h
+// DUMP: Module.framework/Headers/Sub.h
+// DUMP: Module.framework/Headers/Sub2.h
+
+@import AlsoDependsOnModule;
diff --git a/clang/test/Modules/dependency-dump.m b/clang/test/Modules/dependency-dump.m
new file mode 100644
index 00000000000..58d6c1572da
--- /dev/null
+++ b/clang/test/Modules/dependency-dump.m
@@ -0,0 +1,25 @@
+// Check that we can dump all of the headers a module depends on, and a VFS map
+// for the same.
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -module-dependency-dir %t/vfs -F %S/Inputs -I %S/Inputs -verify %s
+// expected-no-diagnostics
+
+// RUN: FileCheck %s -check-prefix=VFS -input-file %t/vfs/vfs.yaml
+// VFS: 'name': "SubFramework.h"
+// VFS: 'name': "Treasure.h"
+// VFS: 'name': "Module.h"
+// VFS: 'name': "Sub.h"
+// VFS: 'name': "Sub2.h"
+
+// TODO: We need shell to use find here. Is there a simpler way?
+// REQUIRES: shell
+
+// RUN: find %t/vfs -type f | FileCheck %s -check-prefix=DUMP
+// DUMP: Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h
+// DUMP: Module.framework/Headers/Buried/Treasure.h
+// DUMP: Module.framework/Headers/Module.h
+// DUMP: Module.framework/Headers/Sub.h
+// DUMP: Module.framework/Headers/Sub2.h
+
+@import Module;
OpenPOWER on IntegriCloud