// This file implements the parsing of configuration files for the LLVM Compiler
// Driver (llvmc).
//
-//===------------------------------------------------------------------------===
+//===----------------------------------------------------------------------===//
#include "Configuration.h"
#include "ConfigLexer.h"
result.clear();
while (next_is_real()) {
switch (token ) {
+ case LLVMGCCDIR_SUBST:
+ case LLVMGCCARCH_SUBST:
case STRING :
case OPTION :
result += ConfigLexerState.StringVal;
str.clear();
do {
switch (token) {
+ case BINDIR_SUBST:
+ case LLVMGCC_SUBST:
+ case LLVMGXX_SUBST:
+ case LLVMCC1_SUBST:
+ case LLVMCC1PLUS_SUBST:
case OPTION:
case STRING:
case ARGS_SUBST:
case ASSEMBLY:
str += "assembly";
break;
- case BYTECODE:
- str += "bytecode";
+ case BITCODE:
+ str += "bitcode";
break;
case TRUETOK:
str += "true";
{
std::string progname;
if (parseProgramName(progname))
- action.program.setFile(progname);
+ action.program.set(progname);
else
error("Expecting a program name");
case ASSEMBLY:
anOption += "assembly";
break;
- case BYTECODE:
- anOption += "bytecode";
+ case BITCODE:
+ anOption += "bitcode";
break;
case TRUETOK:
anOption += "true";
next();
if (token == ASSEMBLY) {
return true;
- } else if (token == BYTECODE) {
+ } else if (token == BITCODE) {
return false;
} else {
error("Expecting output type value");
// Try the environment variable
const char* conf = getenv("LLVM_CONFIG_DIR");
if (conf) {
- confFile.setDirectory(conf);
- confFile.appendFile(ftype);
- if (!confFile.readable())
+ confFile.set(conf);
+ confFile.appendComponent(ftype);
+ if (!confFile.canRead())
throw std::string("Configuration file for '") + ftype +
"' is not available.";
} else {
// Try the user's home directory
confFile = sys::Path::GetUserHomeDirectory();
if (!confFile.isEmpty()) {
- confFile.appendDirectory(".llvm");
- confFile.appendDirectory("etc");
- confFile.appendFile(ftype);
- if (!confFile.readable())
+ confFile.appendComponent(".llvm");
+ confFile.appendComponent("etc");
+ confFile.appendComponent(ftype);
+ if (!confFile.canRead())
confFile.clear();
}
- if (!confFile.isEmpty()) {
+ if (confFile.isEmpty()) {
// Okay, try the LLVM installation directory
confFile = sys::Path::GetLLVMConfigDir();
- confFile.appendFile(ftype);
- if (!confFile.readable()) {
+ confFile.appendComponent(ftype);
+ if (!confFile.canRead()) {
// Okay, try the "standard" place
confFile = sys::Path::GetLLVMDefaultConfigDir();
- confFile.appendFile(ftype);
- if (!confFile.readable()) {
+ confFile.appendComponent(ftype);
+ if (!confFile.canRead()) {
throw std::string("Configuration file for '") + ftype +
"' is not available.";
}
}
} else {
confFile = configDir;
- confFile.appendFile(ftype);
- if (!confFile.readable())
+ confFile.appendComponent(ftype);
+ if (!confFile.canRead())
throw std::string("Configuration file for '") + ftype +
"' is not available.";
}