[clang-tools-extra] r201599 - Add a makefile for clang-query. Patch by Alex Horn!

Peter Collingbourne peter at pcc.me.uk
Tue Feb 18 11:46:01 PST 2014


Author: pcc
Date: Tue Feb 18 13:46:01 2014
New Revision: 201599

URL: http://llvm.org/viewvc/llvm-project?rev=201599&view=rev
Log:
Add a makefile for clang-query. Patch by Alex Horn!

While at it, have cmake build and test the tool if libedit is not installed,
as this dependency is now optional.

Added:
    clang-tools-extra/trunk/clang-query/tool/Makefile
Modified:
    clang-tools-extra/trunk/clang-query/Makefile
    clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt
    clang-tools-extra/trunk/test/CMakeLists.txt
    clang-tools-extra/trunk/test/clang-query/errors.c
    clang-tools-extra/trunk/test/clang-query/function-decl.c
    clang-tools-extra/trunk/test/lit.cfg
    clang-tools-extra/trunk/test/lit.site.cfg.in

Modified: clang-tools-extra/trunk/clang-query/Makefile
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/Makefile?rev=201599&r1=201598&r2=201599&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/Makefile (original)
+++ clang-tools-extra/trunk/clang-query/Makefile Tue Feb 18 13:46:01 2014
@@ -11,4 +11,6 @@ CLANG_LEVEL := ../../..
 LIBRARYNAME := clangQuery
 include $(CLANG_LEVEL)/../../Makefile.config
 
+DIRS = tool
+
 include $(CLANG_LEVEL)/Makefile

Modified: clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt?rev=201599&r1=201598&r2=201599&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-query/tool/CMakeLists.txt Tue Feb 18 13:46:01 2014
@@ -1,11 +1,8 @@
-if(HAVE_LIBEDIT)
-  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
-  add_clang_executable(clang-query ClangQuery.cpp)
-  target_link_libraries(clang-query
-    edit
-    clangFrontend
-    clangQuery
-    clangTooling
-    )
-endif()
+add_clang_executable(clang-query ClangQuery.cpp)
+target_link_libraries(clang-query
+  clangFrontend
+  clangQuery
+  clangTooling
+  )

Added: clang-tools-extra/trunk/clang-query/tool/Makefile
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/tool/Makefile?rev=201599&view=auto
==============================================================================
--- clang-tools-extra/trunk/clang-query/tool/Makefile (added)
+++ clang-tools-extra/trunk/clang-query/tool/Makefile Tue Feb 18 13:46:01 2014
@@ -0,0 +1,39 @@
+##===- tools/extra/clang-query/tool/Makefile ---------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+CLANG_LEVEL := ../../../..
+include $(CLANG_LEVEL)/../../Makefile.config
+
+TOOLNAME = clang-query
+
+# No plugins, optimize startup time.
+TOOL_NO_EXPORTS = 1
+
+SOURCES = ClangQuery.cpp
+
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc mcparser option
+USEDLIBS = clangQuery.a clangDynamicASTMatchers.a clangFormat.a clangTooling.a \
+	   clangFrontend.a clangSerialization.a clangDriver.a clangRewriteFrontend.a \
+	   LLVMLineEditor.a clangRewriteCore.a clangParse.a clangSema.a clangAnalysis.a \
+	   clangAST.a clangASTMatchers.a clangEdit.a clangLex.a clangBasic.a
+
+include $(CLANG_LEVEL)/Makefile
+
+CPP.Flags += -I$(PROJ_SRC_DIR)/..
+
+# BUILT_SOURCES gets used as a prereq for many top-level targets. However, at
+# the point those targets are defined, $(ObjDir) hasn't been defined and so the
+# directory to create becomes /<name>/ which is not what we want. So instead,
+# this .objdir recipe is defined at at point where $(ObjDir) is defined and
+# it's specialized to $(ObjDir) to ensure it only works on targets we want it
+# to.
+$(ObjDir)/%.objdir:
+	$(Verb) $(MKDIR) $(ObjDir)/$* > /dev/null
+	$(Verb) $(DOTDIR_TIMESTAMP_COMMAND) > $@
+

Modified: clang-tools-extra/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/CMakeLists.txt?rev=201599&r1=201598&r2=201599&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/test/CMakeLists.txt Tue Feb 18 13:46:01 2014
@@ -37,6 +37,7 @@ set(CLANG_TOOLS_TEST_DEPS
   # Individual tools we test.
   clang-apply-replacements
   clang-modernize
+  clang-query
   clang-tidy
   modularize
   module-map-checker
@@ -47,10 +48,6 @@ set(CLANG_TOOLS_TEST_DEPS
   ExtraToolsUnitTests
   )
 
-if(HAVE_LIBEDIT)
-  list(APPEND CLANG_TOOLS_TEST_DEPS clang-query)
-endif()
-
 add_lit_testsuite(check-clang-tools "Running the Clang extra tools' regression tests"
   ${CMAKE_CURRENT_BINARY_DIR}
   DEPENDS ${CLANG_TOOLS_TEST_DEPS}

Modified: clang-tools-extra/trunk/test/clang-query/errors.c
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-query/errors.c?rev=201599&r1=201598&r2=201599&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-query/errors.c (original)
+++ clang-tools-extra/trunk/test/clang-query/errors.c Tue Feb 18 13:46:01 2014
@@ -2,7 +2,6 @@
 // RUN: not clang-query -f %S/Inputs/foo.script %s -- | FileCheck %s
 // RUN: not clang-query -f %S/Inputs/nonexistent.script %s -- 2>&1 | FileCheck --check-prefix=CHECK-NONEXISTENT %s
 // RUN: not clang-query -c foo -f foo %s -- 2>&1 | FileCheck --check-prefix=CHECK-BOTH %s
-// REQUIRES: libedit
 
 // CHECK: unknown command: foo
 // CHECK-NOT: unknown command: bar

Modified: clang-tools-extra/trunk/test/clang-query/function-decl.c
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-query/function-decl.c?rev=201599&r1=201598&r2=201599&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-query/function-decl.c (original)
+++ clang-tools-extra/trunk/test/clang-query/function-decl.c Tue Feb 18 13:46:01 2014
@@ -1,5 +1,4 @@
 // RUN: clang-query -c "match functionDecl()" %s -- | FileCheck %s
-// REQUIRES: libedit
 
-// CHECK: function-decl.c:5:1: note: "root" binds here
+// CHECK: function-decl.c:4:1: note: "root" binds here
 void foo(void) {}

Modified: clang-tools-extra/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.cfg?rev=201599&r1=201598&r2=201599&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/lit.cfg (original)
+++ clang-tools-extra/trunk/test/lit.cfg Tue Feb 18 13:46:01 2014
@@ -174,6 +174,3 @@ if platform.system() not in ['Windows']
 # ANSI escape sequences in non-dumb terminal
 if platform.system() not in ['Windows']:
     config.available_features.add('ansi-escape-sequences')
-
-if config.have_libedit == "1":
-  config.available_features.add('libedit')

Modified: clang-tools-extra/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.site.cfg.in?rev=201599&r1=201598&r2=201599&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/lit.site.cfg.in (original)
+++ clang-tools-extra/trunk/test/lit.site.cfg.in Tue Feb 18 13:46:01 2014
@@ -8,7 +8,6 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_
 config.clang_tools_binary_dir = "@CLANG_TOOLS_BINARY_DIR@"
 config.clang_tools_dir = "@CLANG_TOOLS_DIR@"
 config.target_triple = "@TARGET_TRIPLE@"
-config.have_libedit = "@HAVE_LIBEDIT@"
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.





More information about the cfe-commits mailing list