trick-ICG fails when using clang < 3.4

The clang path created uses the patchlevel which prior to 3.4 was not used by
clang.  This resulted in a bad being created and eventually an llvm assertion
error.  Added a compiler ifdef so that the patchlevel is not used before 3.4

refs #65
This commit is contained in:
Alex Lin 2015-06-15 11:38:21 -05:00
parent 8193b5de7b
commit 3577e72bce
2 changed files with 6 additions and 2 deletions

View File

@ -39,12 +39,16 @@ void HeaderSearchDirs::AddCompilerBuiltInSearchDirs () {
std::stringstream icg_dir ;
icg_dir << LLVM_HOME << "/lib/clang/" ;
icg_dir << __clang_major__ << "." << __clang_minor__ ;
#if (__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ >= 4))
#ifdef __clang_patchlevel__
icg_dir << "." << __clang_patchlevel__ ;
#endif
#endif
icg_dir << "/include" ;
char * resolved_path = realpath(icg_dir.str().c_str(), NULL ) ;
hso.AddPath(resolved_path , clang::frontend::System, IsFramework, IsSysRootRelative);
if ( resolved_path != NULL ) {
hso.AddPath(resolved_path , clang::frontend::System, IsFramework, IsSysRootRelative);
}
#endif
fp = popen("${TRICK_HOME}/bin/trick-gte TRICK_CPPC" , "r") ;

View File

@ -4,7 +4,7 @@ include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
CC := $(shell $(LLVM_HOME)/bin/llvm-config --bindir)/clang
CXX := $(shell $(LLVM_HOME)/bin/llvm-config --bindir)/clang++
CXXFLAGS := -I$(shell $(LLVM_HOME)/bin/llvm-config --includedir) -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti
CXXFLAGS := -g -I$(shell $(LLVM_HOME)/bin/llvm-config --includedir) -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti
CLANG_MINOR_GTEQ5 := $(shell expr `$(LLVM_HOME)/bin/llvm-config --version | cut -f2 -d. ` \>= 5 )