[llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.cpp CompilerDriver.h Configuration.cpp llvmc.cpp
Reid Spencer
reid at x10sys.com
Fri Nov 5 14:15:49 PST 2004
Changes in directory llvm/tools/llvmc:
CompilerDriver.cpp updated: 1.16 -> 1.17
CompilerDriver.h updated: 1.13 -> 1.14
Configuration.cpp updated: 1.14 -> 1.15
llvmc.cpp updated: 1.17 -> 1.18
---
Log message:
Stop propagating method names that violate the coding standard
---
Diffs of the changes: (+66 -55)
Index: llvm/tools/llvmc/CompilerDriver.cpp
diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.16 llvm/tools/llvmc/CompilerDriver.cpp:1.17
--- llvm/tools/llvmc/CompilerDriver.cpp:1.16 Wed Oct 27 23:05:06 2004
+++ llvm/tools/llvmc/CompilerDriver.cpp Fri Nov 5 16:15:36 2004
@@ -134,7 +134,7 @@
StringVector::const_iterator E = paths.end();
while (I != E) {
sys::Path tmp;
- tmp.set_directory(*I);
+ tmp.setDirectory(*I);
IncludePaths.push_back(tmp);
++I;
}
@@ -149,7 +149,7 @@
StringVector::const_iterator E = paths.end();
while (I != E) {
sys::Path tmp;
- tmp.set_directory(*I);
+ tmp.setDirectory(*I);
LibraryPaths.push_back(tmp);
++I;
}
@@ -159,6 +159,10 @@
LibraryPaths.push_back(libPath);
}
+ virtual void addToolPath( const sys::Path& toolPath ) {
+ ToolPaths.push_back(toolPath);
+ }
+
virtual void setfPassThrough(const StringVector& fOpts) {
fOptions = fOpts;
}
@@ -182,8 +186,8 @@
void cleanup() {
if (!isSet(KEEP_TEMPS_FLAG)) {
- if (TempDir.is_directory() && TempDir.writable())
- TempDir.destroy_directory(/*remove_contents=*/true);
+ if (TempDir.isDirectory() && TempDir.writable())
+ TempDir.destroyDirectory(/*remove_contents=*/true);
} else {
std::cout << "Temporary files are in " << TempDir.get() << "\n";
}
@@ -192,9 +196,9 @@
sys::Path MakeTempFile(const std::string& basename,
const std::string& suffix ) {
sys::Path result(TempDir);
- if (!result.append_file(basename))
+ if (!result.appendFile(basename))
throw basename + ": can't use this file name";
- if (!result.append_suffix(suffix))
+ if (!result.appendSuffix(suffix))
throw suffix + ": can't use this file suffix";
return result;
}
@@ -373,7 +377,7 @@
if (!isSet(DRY_RUN_FLAG)) {
sys::Path progpath = sys::Program::FindProgramByName(
action->program.get());
- if (progpath.is_empty())
+ if (progpath.isEmpty())
throw std::string("Can't find program '"+progpath.get()+"'");
else if (progpath.executable())
action->program = progpath;
@@ -404,24 +408,24 @@
const sys::Path& dir,
bool native = false) {
sys::Path fullpath(dir);
- fullpath.append_file(link_item);
+ fullpath.appendFile(link_item);
if (native) {
- fullpath.append_suffix("a");
+ fullpath.appendSuffix("a");
} else {
- fullpath.append_suffix("bc");
+ fullpath.appendSuffix("bc");
if (fullpath.readable())
return fullpath;
- fullpath.elide_suffix();
- fullpath.append_suffix("o");
+ fullpath.elideSuffix();
+ fullpath.appendSuffix("o");
if (fullpath.readable())
return fullpath;
fullpath = dir;
- fullpath.append_file(std::string("lib") + link_item);
- fullpath.append_suffix("a");
+ fullpath.appendFile(std::string("lib") + link_item);
+ fullpath.appendSuffix("a");
if (fullpath.readable())
return fullpath;
- fullpath.elide_suffix();
- fullpath.append_suffix("so");
+ fullpath.elideSuffix();
+ fullpath.appendSuffix("so");
if (fullpath.readable())
return fullpath;
}
@@ -446,14 +450,14 @@
// on the command line.
PathVector::iterator PI = LibraryPaths.begin();
PathVector::iterator PE = LibraryPaths.end();
- while (PI != PE && fullpath.is_empty()) {
+ while (PI != PE && fullpath.isEmpty()) {
fullpath = GetPathForLinkageItem(link_item.get(),*PI);
++PI;
}
// If we didn't find the file in any of the library search paths
// so we have to bail. No where else to look.
- if (fullpath.is_empty()) {
+ if (fullpath.isEmpty()) {
err =
std::string("Can't find linkage item '") + link_item.get() + "'";
return false;
@@ -466,7 +470,7 @@
set.insert(fullpath);
// If its an LLVM bytecode file ...
- if (fullpath.is_bytecode_file()) {
+ if (fullpath.isBytecodeFile()) {
// Process the dependent libraries recursively
Module::LibraryListType modlibs;
if (GetBytecodeDependentLibraries(fullpath.get(),modlibs)) {
@@ -530,13 +534,13 @@
// If they are asking for linking and didn't provide an output
// file then its an error (no way for us to "make up" a meaningful
// file name based on the various linker input files).
- if (finalPhase == LINKING && Output.is_empty())
+ if (finalPhase == LINKING && Output.isEmpty())
throw std::string(
"An output file name must be specified for linker output");
// If they are not asking for linking, provided an output file and
// there is more than one input file, its an error
- if (finalPhase != LINKING && !Output.is_empty() && InpList.size() > 1)
+ if (finalPhase != LINKING && !Output.isEmpty() && InpList.size() > 1)
throw std::string("An output file name cannot be specified ") +
"with more than one input file name when not linking";
@@ -581,19 +585,19 @@
// Initialize the input and output files
sys::Path InFile(I->first);
- sys::Path OutFile(I->first.get_basename());
+ sys::Path OutFile(I->first.getBasename());
// PRE-PROCESSING PHASE
Action& action = cd->PreProcessor;
// Get the preprocessing action, if needed, or error if appropriate
- if (!action.program.is_empty()) {
+ if (!action.program.isEmpty()) {
if (action.isSet(REQUIRED_FLAG) || finalPhase == PREPROCESSING) {
if (finalPhase == PREPROCESSING) {
- OutFile.append_suffix("E");
+ OutFile.appendSuffix("E");
actions.push_back(GetAction(cd,InFile,OutFile,PREPROCESSING));
} else {
- sys::Path TempFile(MakeTempFile(I->first.get_basename(),"E"));
+ sys::Path TempFile(MakeTempFile(I->first.getBasename(),"E"));
actions.push_back(GetAction(cd,InFile,TempFile,
PREPROCESSING));
InFile = TempFile;
@@ -614,13 +618,13 @@
action = cd->Translator;
// Get the translation action, if needed, or error if appropriate
- if (!action.program.is_empty()) {
+ if (!action.program.isEmpty()) {
if (action.isSet(REQUIRED_FLAG) || finalPhase == TRANSLATION) {
if (finalPhase == TRANSLATION) {
- OutFile.append_suffix("o");
+ OutFile.appendSuffix("o");
actions.push_back(GetAction(cd,InFile,OutFile,TRANSLATION));
} else {
- sys::Path TempFile(MakeTempFile(I->first.get_basename(),"trans"));
+ sys::Path TempFile(MakeTempFile(I->first.getBasename(),"trans"));
actions.push_back(GetAction(cd,InFile,TempFile,TRANSLATION));
InFile = TempFile;
}
@@ -630,10 +634,10 @@
/// The output of the translator is an LLVM Assembly program
/// We need to translate it to bytecode
Action* action = new Action();
- action->program.set_file("llvm-as");
+ action->program.setFile("llvm-as");
action->args.push_back(InFile.get());
action->args.push_back("-o");
- InFile.append_suffix("bc");
+ InFile.appendSuffix("bc");
action->args.push_back(InFile.get());
actions.push_back(action);
}
@@ -653,13 +657,13 @@
// Get the optimization action, if needed, or error if appropriate
if (!isSet(EMIT_RAW_FLAG)) {
- if (!action.program.is_empty()) {
+ if (!action.program.isEmpty()) {
if (action.isSet(REQUIRED_FLAG) || finalPhase == OPTIMIZATION) {
if (finalPhase == OPTIMIZATION) {
- OutFile.append_suffix("o");
+ OutFile.appendSuffix("o");
actions.push_back(GetAction(cd,InFile,OutFile,OPTIMIZATION));
} else {
- sys::Path TempFile(MakeTempFile(I->first.get_basename(),"opt"));
+ sys::Path TempFile(MakeTempFile(I->first.getBasename(),"opt"));
actions.push_back(GetAction(cd,InFile,TempFile,OPTIMIZATION));
InFile = TempFile;
}
@@ -668,11 +672,11 @@
/// The output of the optimizer is an LLVM Assembly program
/// We need to translate it to bytecode with llvm-as
Action* action = new Action();
- action->program.set_file("llvm-as");
+ action->program.setFile("llvm-as");
action->args.push_back(InFile.get());
action->args.push_back("-f");
action->args.push_back("-o");
- InFile.append_suffix("bc");
+ InFile.appendSuffix("bc");
action->args.push_back(InFile.get());
actions.push_back(action);
}
@@ -695,20 +699,20 @@
if (isSet(EMIT_NATIVE_FLAG)) {
// Use llc to get the native assembly file
Action* action = new Action();
- action->program.set_file("llc");
+ action->program.setFile("llc");
action->args.push_back(InFile.get());
action->args.push_back("-f");
action->args.push_back("-o");
- OutFile.append_suffix("s");
+ OutFile.appendSuffix("s");
action->args.push_back(OutFile.get());
} else {
// Just convert back to llvm assembly with llvm-dis
Action* action = new Action();
- action->program.set_file("llvm-dis");
+ action->program.setFile("llvm-dis");
action->args.push_back(InFile.get());
action->args.push_back("-f");
action->args.push_back("-o");
- OutFile.append_suffix("ll");
+ OutFile.appendSuffix("ll");
action->args.push_back(OutFile.get());
actions.push_back(action);
}
@@ -743,7 +747,7 @@
// Set up the linking action with llvm-ld
Action* link = new Action();
- link->program.set_file("llvm-ld");
+ link->program.setFile("llvm-ld");
// Add in the optimization level requested
switch (optLevel) {
@@ -834,6 +838,7 @@
std::string machine; ///< Target machine name
PathVector LibraryPaths; ///< -L options
PathVector IncludePaths; ///< -I options
+ PathVector ToolPaths; ///< -B options
StringVector Defines; ///< -D options
sys::Path TempDir; ///< Name of the temporary directory.
StringTable AdditionalArgs; ///< The -Txyz options
Index: llvm/tools/llvmc/CompilerDriver.h
diff -u llvm/tools/llvmc/CompilerDriver.h:1.13 llvm/tools/llvmc/CompilerDriver.h:1.14
--- llvm/tools/llvmc/CompilerDriver.h:1.13 Wed Oct 27 23:04:38 2004
+++ llvm/tools/llvmc/CompilerDriver.h Fri Nov 5 16:15:36 2004
@@ -161,7 +161,7 @@
/// @brief Set the output machine name.
virtual void setOutputMachine(const std::string& machineName) = 0;
- /// @brief Set Preprocessor specific options
+ /// @brief Set the options for a given phase.
virtual void setPhaseArgs(Phases phase, const StringVector& opts) = 0;
/// @brief Set Library Paths
@@ -173,10 +173,12 @@
/// @brief Set Library Paths
virtual void setLibraryPaths(const StringVector& paths) = 0;
- /// @brief Set the list of library paths to be searched for
- /// libraries.
+ /// @brief Add a path to the list of library paths
virtual void addLibraryPath( const sys::Path& libPath ) = 0;
+ /// @brief Add a path to the list of paths in which to find tools
+ virtual void addToolPath( const sys::Path& toolPath) = 0;
+
/// @brief Set the list of -f options to be passed through
virtual void setfPassThrough(const StringVector& fOpts) = 0;
Index: llvm/tools/llvmc/Configuration.cpp
diff -u llvm/tools/llvmc/Configuration.cpp:1.14 llvm/tools/llvmc/Configuration.cpp:1.15
--- llvm/tools/llvmc/Configuration.cpp:1.14 Wed Oct 27 23:04:38 2004
+++ llvm/tools/llvmc/Configuration.cpp Fri Nov 5 16:15:36 2004
@@ -233,7 +233,7 @@
action.args.clear();
} else {
if (token == STRING || token == OPTION) {
- action.program.set_file(ConfigLexerState.StringVal);
+ action.program.setFile(ConfigLexerState.StringVal);
} else {
error("Expecting a program name");
}
@@ -421,33 +421,33 @@
LLVMC_ConfigDataProvider::ReadConfigData(const std::string& ftype) {
CompilerDriver::ConfigData* result = 0;
sys::Path confFile;
- if (configDir.is_empty()) {
+ if (configDir.isEmpty()) {
// Try the environment variable
const char* conf = getenv("LLVM_CONFIG_DIR");
if (conf) {
- confFile.set_directory(conf);
- confFile.append_file(ftype);
+ confFile.setDirectory(conf);
+ confFile.appendFile(ftype);
if (!confFile.readable())
throw std::string("Configuration file for '") + ftype +
"' is not available.";
} else {
// Try the user's home directory
confFile = sys::Path::GetUserHomeDirectory();
- if (!confFile.is_empty()) {
- confFile.append_directory(".llvm");
- confFile.append_directory("etc");
- confFile.append_file(ftype);
+ if (!confFile.isEmpty()) {
+ confFile.appendDirectory(".llvm");
+ confFile.appendDirectory("etc");
+ confFile.appendFile(ftype);
if (!confFile.readable())
confFile.clear();
}
- if (!confFile.is_empty()) {
+ if (!confFile.isEmpty()) {
// Okay, try the LLVM installation directory
confFile = sys::Path::GetLLVMConfigDir();
- confFile.append_file(ftype);
+ confFile.appendFile(ftype);
if (!confFile.readable()) {
// Okay, try the "standard" place
confFile = sys::Path::GetLLVMDefaultConfigDir();
- confFile.append_file(ftype);
+ confFile.appendFile(ftype);
if (!confFile.readable()) {
throw std::string("Configuration file for '") + ftype +
"' is not available.";
@@ -457,7 +457,7 @@
}
} else {
confFile = configDir;
- confFile.append_file(ftype);
+ confFile.appendFile(ftype);
if (!confFile.readable())
throw std::string("Configuration file for '") + ftype +
"' is not available.";
Index: llvm/tools/llvmc/llvmc.cpp
diff -u llvm/tools/llvmc/llvmc.cpp:1.17 llvm/tools/llvmc/llvmc.cpp:1.18
--- llvm/tools/llvmc/llvmc.cpp:1.17 Wed Oct 27 22:56:16 2004
+++ llvm/tools/llvmc/llvmc.cpp Fri Nov 5 16:15:36 2004
@@ -111,6 +111,10 @@
cl::desc("Pass through -W options to compiler tools"),
cl::value_desc("warnings category"));
+cl::list<std::string> BOpt("B", cl::ZeroOrMore, cl::Prefix,
+ cl::desc("Indicate where llvmc sub-tools are installed"),
+ cl::value_desc("directory path containing bin and lib directories"));
+
//===------------------------------------------------------------------------===
//=== INPUT OPTIONS
//===------------------------------------------------------------------------===
More information about the llvm-commits
mailing list