summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Frontend/plugins.c5
-rw-r--r--clang/test/lit.cfg16
-rw-r--r--clang/test/lit.site.cfg.in4
3 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Frontend/plugins.c b/clang/test/Frontend/plugins.c
new file mode 100644
index 00000000000..8117f72fa7a
--- /dev/null
+++ b/clang/test/Frontend/plugins.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -load %llvmshlibdir/PrintFunctionNames%pluginext -plugin print-fns %s 2>&1 | FileCheck %s
+// REQUIRES: plugins, examples
+
+// CHECK: top-level-decl: "x"
+void x();
diff --git a/clang/test/lit.cfg b/clang/test/lit.cfg
index eea7f89b9ff..ee011c6d2ea 100644
--- a/clang/test/lit.cfg
+++ b/clang/test/lit.cfg
@@ -195,6 +195,22 @@ config.clang = inferClang(config.environment['PATH']).replace('\\', '/')
if not lit_config.quiet:
lit_config.note('using clang: %r' % config.clang)
+# Plugins (loadable modules)
+# TODO: This should be supplied by Makefile or autoconf.
+if sys.platform in ['win32', 'cygwin']:
+ has_plugins = (config.enable_shared == 1)
+else:
+ has_plugins = True
+
+if has_plugins and config.llvm_plugin_ext:
+ config.available_features.add('plugins')
+
+config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
+config.substitutions.append( ('%pluginext', config.llvm_plugin_ext) )
+
+if config.clang_examples:
+ config.available_features.add('examples')
+
# Note that when substituting %clang_cc1 also fill in the include directory of
# the builtin headers. Those are part of even a freestanding environment, but
# Clang relies on the driver to locate them.
diff --git a/clang/test/lit.site.cfg.in b/clang/test/lit.site.cfg.in
index a5234da01e7..09d4d213f16 100644
--- a/clang/test/lit.site.cfg.in
+++ b/clang/test/lit.site.cfg.in
@@ -6,6 +6,8 @@ config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.llvm_shlib_dir = "@SHLIBDIR@"
+config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.clang_obj_root = "@CLANG_BINARY_DIR@"
config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
@@ -14,6 +16,7 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
config.clang_arcmt = @ENABLE_CLANG_ARCMT@
config.clang_staticanalyzer = @ENABLE_CLANG_STATIC_ANALYZER@
config.clang_rewriter = @ENABLE_CLANG_REWRITER@
+config.clang_examples = @CLANG_BUILD_EXAMPLES@
config.host_arch = "@HOST_ARCH@"
# Support substitution of the tools and libs dirs with user parameters. This is
@@ -21,6 +24,7 @@ config.host_arch = "@HOST_ARCH@"
try:
config.clang_tools_dir = config.clang_tools_dir % lit_config.params
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
+ config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
except KeyError:
e = sys.exc_info()[1]
OpenPOWER on IntegriCloud