[Lldb-commits] [lldb] r284756 - Re-landing a cleaned up implementation of r284550

Chris Bieneman via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 20 11:01:19 PDT 2016


Author: cbieneman
Date: Thu Oct 20 13:01:19 2016
New Revision: 284756

URL: http://llvm.org/viewvc/llvm-project?rev=284756&view=rev
Log:
Re-landing a cleaned up implementation of r284550

This time it should actually work. The previous implementaiton was not
getting the linker or compiler flag set correctly in all the right
situations. By moving the check down and basing it of whether or not CXX
is set I we can have the logic to add the flags exist only once for the
linker and once for the compiler instead of duplicating it.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=284756&r1=284755&r2=284756&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Thu Oct 20 13:01:19 2016
@@ -242,27 +242,23 @@ ifneq "$(DYLIB_NAME)" ""
 endif
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
-cxx_compiler_notdir = $(if $(findstring clang,$(1)), \
-                           $(subst clang,clang++,$(1)), \
-                           $(if $(findstring icc,$(1)), \
-                                $(subst icc,icpc,$(1)), \
-                                $(if $(findstring llvm-gcc,$(1)), \
-                                     $(subst llvm-gcc,llvm-g++,$(1)), \
-                                     $(if $(findstring gcc,$(1)), \
-                                          $(subst gcc,g++,$(1)), \
-                                          $(subst cc,c++,$(1))))))
+cxx_compiler_notdir = $(if $(findstring icc,$(1)), \
+                            $(subst icc,icpc,$(1)), \
+                            $(if $(findstring llvm-gcc,$(1)), \
+                                 $(subst llvm-gcc,llvm-g++,$(1)), \
+                                 $(if $(findstring gcc,$(1)), \
+                                      $(subst gcc,g++,$(1)), \
+                                      $(subst cc,c++,$(1)))))
 cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_compiler_notdir,$(notdir $(1)))),$(call cxx_compiler_notdir,$(1)))
 
 # Function that returns the C++ linker, given $(CC) as arg.
-cxx_linker_notdir = $(if $(findstring clang,$(1)), \
-                         $(subst clang,clang++,$(1)), \
-                         $(if $(findstring icc,$(1)), \
-                              $(subst icc,icpc,$(1)), \
-                              $(if $(findstring llvm-gcc,$(1)), \
-                                   $(subst llvm-gcc,llvm-g++,$(1)), \
-                                   $(if $(findstring gcc,$(1)), \
-                                        $(subst gcc,g++,$(1)), \
-                                        $(subst cc,c++,$(1))))))
+cxx_linker_notdir = $(if $(findstring icc,$(1)), \
+                          $(subst icc,icpc,$(1)), \
+                          $(if $(findstring llvm-gcc,$(1)), \
+                               $(subst llvm-gcc,llvm-g++,$(1)), \
+                               $(if $(findstring gcc,$(1)), \
+                                    $(subst gcc,g++,$(1)), \
+                                    $(subst cc,c++,$(1)))))
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1)))),$(call cxx_linker_notdir,$(1)))
 
 ifneq "$(OS)" "Darwin"
@@ -450,6 +446,16 @@ ifneq "$(filter g++,$(CXX))" ""
 endif
 endif
 
+ifeq ($(findstring clang, $(CXX)), clang)
+  CXXFLAGS += --driver-mode=g++
+endif
+
+ifneq "$(CXX)" ""
+  ifeq ($(findstring clang, $(LD)), clang)
+    LDFLAGS += --driver-mode=g++
+  endif
+endif
+
 #----------------------------------------------------------------------
 # DYLIB_ONLY variable can be used to skip the building of a.out.
 # See the sections below regarding dSYM file as well as the building of




More information about the lldb-commits mailing list