forked from OSchip/llvm-project
Patches to correct several bugs in llvmc.
Patches contributed by Bram Adams. Thanks Bram. llvm-svn: 29729
This commit is contained in:
parent
bf8e751488
commit
4e41aaf805
|
@ -227,9 +227,54 @@ private:
|
||||||
assert(pat != 0 && "Invalid command pattern");
|
assert(pat != 0 && "Invalid command pattern");
|
||||||
|
|
||||||
// Copy over some pattern things that don't need to change
|
// Copy over some pattern things that don't need to change
|
||||||
action->program = pat->program;
|
|
||||||
action->flags = pat->flags;
|
action->flags = pat->flags;
|
||||||
|
|
||||||
|
// See if program starts with wildcard...
|
||||||
|
std::string programName=pat->program.toString();
|
||||||
|
if (programName[0] == '%' && programName.length() >2) {
|
||||||
|
switch(programName[1]){
|
||||||
|
case 'b':
|
||||||
|
if (programName.substr(0,8) == "%bindir%") {
|
||||||
|
std::string tmp(LLVM_BINDIR);
|
||||||
|
tmp.append(programName.substr(8));
|
||||||
|
pat->program.set(tmp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'l':
|
||||||
|
if (programName.substr(0,12) == "%llvmgccdir%"){
|
||||||
|
std::string tmp(LLVMGCCDIR);
|
||||||
|
tmp.append(programName.substr(12));
|
||||||
|
pat->program.set(tmp);
|
||||||
|
}else if (programName.substr(0,13) == "%llvmgccarch%"){
|
||||||
|
std::string tmp(LLVMGCCARCH);
|
||||||
|
tmp.append(programName.substr(13));
|
||||||
|
pat->program.set(tmp);
|
||||||
|
}else if (programName.substr(0,9) == "%llvmgcc%"){
|
||||||
|
std::string tmp(LLVMGCC);
|
||||||
|
tmp.append(programName.substr(9));
|
||||||
|
pat->program.set(tmp);
|
||||||
|
}else if (programName.substr(0,9) == "%llvmgxx%"){
|
||||||
|
std::string tmp(LLVMGXX);
|
||||||
|
tmp.append(programName.substr(9));
|
||||||
|
pat->program.set(tmp);
|
||||||
|
}else if (programName.substr(0,9) == "%llvmcc1%"){
|
||||||
|
std::string tmp(LLVMCC1);
|
||||||
|
tmp.append(programName.substr(9));
|
||||||
|
pat->program.set(tmp);
|
||||||
|
}else if (programName.substr(0,13) == "%llvmcc1plus%"){
|
||||||
|
std::string tmp(LLVMCC1PLUS);
|
||||||
|
tmp.append(programName.substr(13));
|
||||||
|
pat->program.set(tmp);
|
||||||
|
}else if (programName.substr(0,8) == "%libdir%") {
|
||||||
|
std::string tmp(LLVM_LIBDIR);
|
||||||
|
tmp.append(programName.substr(8));
|
||||||
|
pat->program.set(tmp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
action->program = pat->program;
|
||||||
|
|
||||||
// Do the substitutions from the pattern to the actual
|
// Do the substitutions from the pattern to the actual
|
||||||
StringVector::iterator PI = pat->args.begin();
|
StringVector::iterator PI = pat->args.begin();
|
||||||
StringVector::iterator PE = pat->args.end();
|
StringVector::iterator PE = pat->args.end();
|
||||||
|
@ -426,9 +471,9 @@ private:
|
||||||
const char** Args = (const char**)
|
const char** Args = (const char**)
|
||||||
alloca(sizeof(const char*)*(action->args.size()+2));
|
alloca(sizeof(const char*)*(action->args.size()+2));
|
||||||
Args[0] = action->program.toString().c_str();
|
Args[0] = action->program.toString().c_str();
|
||||||
for (unsigned i = 1; i != action->args.size(); ++i)
|
for (unsigned i = 1; i <= action->args.size(); ++i)
|
||||||
Args[i] = action->args[i].c_str();
|
Args[i] = action->args[i-1].c_str();
|
||||||
Args[action->args.size()] = 0; // null terminate list.
|
Args[action->args.size()+1] = 0; // null terminate list.
|
||||||
if (isSet(TIME_ACTIONS_FLAG)) {
|
if (isSet(TIME_ACTIONS_FLAG)) {
|
||||||
Timer timer(action->program.toString());
|
Timer timer(action->program.toString());
|
||||||
timer.startTimer();
|
timer.startTimer();
|
||||||
|
|
|
@ -116,6 +116,8 @@ namespace {
|
||||||
result.clear();
|
result.clear();
|
||||||
while (next_is_real()) {
|
while (next_is_real()) {
|
||||||
switch (token ) {
|
switch (token ) {
|
||||||
|
case LLVMGCCDIR_SUBST:
|
||||||
|
case LLVMGCCARCH_SUBST:
|
||||||
case STRING :
|
case STRING :
|
||||||
case OPTION :
|
case OPTION :
|
||||||
result += ConfigLexerState.StringVal;
|
result += ConfigLexerState.StringVal;
|
||||||
|
@ -260,6 +262,11 @@ namespace {
|
||||||
str.clear();
|
str.clear();
|
||||||
do {
|
do {
|
||||||
switch (token) {
|
switch (token) {
|
||||||
|
case BINDIR_SUBST:
|
||||||
|
case LLVMGCC_SUBST:
|
||||||
|
case LLVMGXX_SUBST:
|
||||||
|
case LLVMCC1_SUBST:
|
||||||
|
case LLVMCC1PLUS_SUBST:
|
||||||
case OPTION:
|
case OPTION:
|
||||||
case STRING:
|
case STRING:
|
||||||
case ARGS_SUBST:
|
case ARGS_SUBST:
|
||||||
|
|
|
@ -24,7 +24,7 @@ CPPFLAGS = -DLLVMGCCDIR="\"$(LLVMGCCDIR)\"" \
|
||||||
-DLLVMGCC="\"$(LLVMGCC)\"" \
|
-DLLVMGCC="\"$(LLVMGCC)\"" \
|
||||||
-DLLVMGXX="\"$(LLVMGXX)\"" \
|
-DLLVMGXX="\"$(LLVMGXX)\"" \
|
||||||
-DLLVMCC1="\"$(LLVMCC1)\"" \
|
-DLLVMCC1="\"$(LLVMCC1)\"" \
|
||||||
-DLLVMCC1PLUS="$(LLVMCC1PLUS)"
|
-DLLVMCC1PLUS="\"$(LLVMCC1PLUS)\""
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
include $(LEVEL)/Makefile.common
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
lang.opt3=-O3
|
lang.opt3=-O3
|
||||||
lang.opt4=-O3
|
lang.opt4=-O3
|
||||||
lang.opt5=-O3
|
lang.opt5=-O3
|
||||||
lang.libs=%llvmgccdir%/lib %llvmgccdir%/lib \
|
lang.libs=%llvmgccdir%/lib %llvmgccdir%/lib %llvmgccdir%/lib/gcc/%llvmgccarch%
|
||||||
%llvmgccdir%/lib/gcc/%llvmgccarch%
|
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
# Pre-processor definitions
|
# Pre-processor definitions
|
||||||
|
|
Loading…
Reference in New Issue