[Lldb-commits] [PATCH] D25753: Use clang --driver-mode instead of guessing c++ compiler path

2016-10-18 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284550: Use clang --driver-mode instead of guessing c++ 
compiler path (authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D25753?vs=75078&id=75095#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25753

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


Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@
 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)))
 
+ifeq ($(findstring clang, $(cxx_compiler)), clang)
+CXXFLAGS += --driver-mode=g++
+endif
+
 # 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"
@@ -354,6 +354,7 @@
 DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
 CXX = $(call cxx_compiler,$(CC))
 LD = $(call cxx_linker,$(CC))
+LDFLAGS += --driver-mode=g++
 endif
 
 #--
@@ -377,6 +378,7 @@
 ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
+  LDFLAGS += --driver-mode=g++
LD = $(call cxx_linker,$(CC))
 endif
 
@@ -395,6 +397,7 @@
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+  LDFLAGS += --driver-mode=g++
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif


Index: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@
 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 $(find

[Lldb-commits] [PATCH] D25753: Use clang --driver-mode instead of guessing c++ compiler path

2016-10-18 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D25753



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25753: Use clang --driver-mode instead of guessing c++ compiler path

2016-10-18 Thread Chris Bieneman via lldb-commits
beanz created this revision.
beanz added reviewers: tfiala, zturner, labath.
beanz added a subscriber: lldb-commits.

When building the LLDB test programs, if your CC is clang it actually isn't 
safe to make CXX a string replace of "clang -> clang++". This falls down on 
unix configurations if your compiler is clang-${version}.

A safer approach is to use the "--driver-mode=g++" option to tell clang to act 
like clang++.


https://reviews.llvm.org/D25753

Files:
  packages/Python/lldbsuite/test/make/Makefile.rules


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@
 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)))
 
+ifeq ($(findstring clang, $(cxx_compiler)), clang)
+CXXFLAGS += --driver-mode=g++
+endif
+
 # 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"
@@ -354,6 +354,7 @@
 DYLIB_OBJECTS +=$(strip $(DYLIB_CXX_SOURCES:.cpp=.o))
 CXX = $(call cxx_compiler,$(CC))
 LD = $(call cxx_linker,$(CC))
+LDFLAGS += --driver-mode=g++
 endif
 
 #--
@@ -377,6 +378,7 @@
 ifneq "$(strip $(CXX_SOURCES))" ""
OBJECTS +=$(strip $(CXX_SOURCES:.cpp=.o))
CXX = $(call cxx_compiler,$(CC))
+  LDFLAGS += --driver-mode=g++
LD = $(call cxx_linker,$(CC))
 endif
 
@@ -395,6 +397,7 @@
OBJECTS +=$(strip $(OBJCXX_SOURCES:.mm=.o))
CXX = $(call cxx_compiler,$(CC))
LD = $(call cxx_linker,$(CC))
+  LDFLAGS += --driver-mode=g++
ifeq "$(findstring lobjc,$(LDFLAGS))" ""
LDFLAGS +=-lobjc
endif


Index: packages/Python/lldbsuite/test/make/Makefile.rules
===
--- packages/Python/lldbsuite/test/make/Makefile.rules
+++ packages/Python/lldbsuite/test/make/Makefile.rules
@@ -242,27 +242,27 @@
 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)), \
-  $(su