r186720 - Add a cl.exe compatible driver mode
Hans Wennborg
hans at hanshq.net
Fri Jul 19 13:33:20 PDT 2013
Author: hans
Date: Fri Jul 19 15:33:20 2013
New Revision: 186720
URL: http://llvm.org/viewvc/llvm-project?rev=186720&view=rev
Log:
Add a cl.exe compatible driver mode
The mode doesn't actually do anything yet, but this provides a
way to get into it.
Added:
cfe/trunk/test/Driver/cl.c
Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/lit.cfg
cfe/trunk/tools/driver/CMakeLists.txt
cfe/trunk/tools/driver/clang_symlink.cmake
cfe/trunk/tools/driver/driver.cpp
Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=186720&r1=186719&r2=186720&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Fri Jul 19 15:33:20 2013
@@ -54,7 +54,8 @@ class Driver {
enum DriverMode {
GCCMode,
GXXMode,
- CPPMode
+ CPPMode,
+ CLMode
} Mode;
public:
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=186720&r1=186719&r2=186720&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Jul 19 15:33:20 2013
@@ -96,6 +96,7 @@ void Driver::ParseDriverMode(ArrayRef<co
.Case("gcc", GCCMode)
.Case("g++", GXXMode)
.Case("cpp", CPPMode)
+ .Case("cl", CLMode)
.Default(~0U);
if (M != ~0U)
Added: cfe/trunk/test/Driver/cl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl.c?rev=186720&view=auto
==============================================================================
--- cfe/trunk/test/Driver/cl.c (added)
+++ cfe/trunk/test/Driver/cl.c Fri Jul 19 15:33:20 2013
@@ -0,0 +1,3 @@
+// RUN: %clang_cl -fsyntax-only -c %s
+
+void f();
Modified: cfe/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=186720&r1=186719&r2=186720&view=diff
==============================================================================
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Fri Jul 19 15:33:20 2013
@@ -204,7 +204,8 @@ config.substitutions.append( ('%clang_cc
getClangBuiltinIncludeDir(config.clang))) )
config.substitutions.append( ('%clang_cpp', ' ' + config.clang +
' --driver-mode=cpp '))
-
+config.substitutions.append( ('%clang_cl', ' ' + config.clang +
+ ' --driver-mode=cl '))
config.substitutions.append( ('%clangxx', ' ' + config.clang +
' --driver-mode=g++ '))
config.substitutions.append( ('%clang', ' ' + config.clang + ' ') )
@@ -227,6 +228,9 @@ config.substitutions.append(
config.substitutions.append(
(' %clang-cpp ',
"""*** invalid substitution, use '%clang_cpp'. ***""") )
+config.substitutions.append(
+ (' %clang-cl ',
+ """*** invalid substitution, use '%clang_cl'. ***""") )
###
Modified: cfe/trunk/tools/driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/CMakeLists.txt?rev=186720&r1=186719&r2=186720&view=diff
==============================================================================
--- cfe/trunk/tools/driver/CMakeLists.txt (original)
+++ cfe/trunk/tools/driver/CMakeLists.txt Fri Jul 19 15:33:20 2013
@@ -76,8 +76,16 @@ add_custom_command(TARGET clang POST_BUI
set_property(DIRECTORY APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
+# Create the clang-cl symlink in the build directory.
+set(clang_cl "${LLVM_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}")
+add_custom_command(TARGET clang POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_cl}")
+
+set_property(DIRECTORY APPEND
+ PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_cl})
+
install(TARGETS clang
RUNTIME DESTINATION bin)
-# Create the clang++ symlink at installation time.
+# Create the clang++ and clang-cl symlinks at installation time.
install(SCRIPT clang_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
Modified: cfe/trunk/tools/driver/clang_symlink.cmake
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/clang_symlink.cmake?rev=186720&r1=186719&r2=186720&view=diff
==============================================================================
--- cfe/trunk/tools/driver/clang_symlink.cmake (original)
+++ cfe/trunk/tools/driver/clang_symlink.cmake Fri Jul 19 15:33:20 2013
@@ -19,9 +19,16 @@ endif()
set(bindir "${CLANGXX_DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/")
set(clang "clang${EXECUTABLE_SUFFIX}")
set(clangxx "clang++${EXECUTABLE_SUFFIX}")
+set(clang_cl "clang-cl${EXECUTABLE_SUFFIX}")
message("Creating clang++ executable based on ${clang}")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "${clangxx}"
WORKING_DIRECTORY "${bindir}")
+
+message("Creating clang-cl executable based on ${clang}")
+
+execute_process(
+ COMMAND "${CMAKE_COMMAND}" -E ${CLANGXX_LINK_OR_COPY} "${clang}" "${clang_cl}"
+ WORKING_DIRECTORY "${bindir}")
Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=186720&r1=186719&r2=186720&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Fri Jul 19 15:33:20 2013
@@ -219,8 +219,10 @@ static void ParseProgName(SmallVectorImp
{ "clang-cpp", "--driver-mode=cpp" },
{ "clang-g++", "--driver-mode=g++" },
{ "clang-gcc", 0 },
+ { "clang-cl", "--driver-mode=cl" },
{ "cc", 0 },
{ "cpp", "--driver-mode=cpp" },
+ { "cl" , "--driver-mode=cl" },
{ "++", "--driver-mode=g++" },
};
std::string ProgName(llvm::sys::path::stem(ArgVector[0]));
More information about the cfe-commits
mailing list