mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
* Adjust the options to make them either accept multiple occurrences or be
optional so that compatibility with GCC is accomplished. * Implement the -print-file-name option in an attempt to provide the same functionality as GCC. Unfortunately, without loading the cpp or c config files, this option won't help much. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0b3c7d084c
commit
65bc4e0bc4
@ -27,7 +27,7 @@ namespace {
|
|||||||
//===------------------------------------------------------------------------===
|
//===------------------------------------------------------------------------===
|
||||||
//=== PHASE OPTIONS
|
//=== PHASE OPTIONS
|
||||||
//===------------------------------------------------------------------------===
|
//===------------------------------------------------------------------------===
|
||||||
cl::opt<CompilerDriver::Phases> FinalPhase(
|
cl::opt<CompilerDriver::Phases> FinalPhase(cl::Optional,
|
||||||
cl::desc("Choose final phase of compilation:"),
|
cl::desc("Choose final phase of compilation:"),
|
||||||
cl::init(CompilerDriver::LINKING),
|
cl::init(CompilerDriver::LINKING),
|
||||||
cl::values(
|
cl::values(
|
||||||
@ -46,7 +46,7 @@ cl::opt<CompilerDriver::Phases> FinalPhase(
|
|||||||
//===------------------------------------------------------------------------===
|
//===------------------------------------------------------------------------===
|
||||||
//=== OPTIMIZATION OPTIONS
|
//=== OPTIMIZATION OPTIONS
|
||||||
//===------------------------------------------------------------------------===
|
//===------------------------------------------------------------------------===
|
||||||
cl::opt<CompilerDriver::OptimizationLevels> OptLevel(
|
cl::opt<CompilerDriver::OptimizationLevels> OptLevel(cl::ZeroOrMore,
|
||||||
cl::desc("Choose level of optimization to apply:"),
|
cl::desc("Choose level of optimization to apply:"),
|
||||||
cl::init(CompilerDriver::OPT_FAST_COMPILE),
|
cl::init(CompilerDriver::OPT_FAST_COMPILE),
|
||||||
cl::values(
|
cl::values(
|
||||||
@ -152,6 +152,10 @@ cl::opt<bool> DebugOutput("g", cl::init(false),
|
|||||||
cl::opt<bool> StripOutput("strip", cl::init(false),
|
cl::opt<bool> StripOutput("strip", cl::init(false),
|
||||||
cl::desc("Strip all symbols from linked output file"));
|
cl::desc("Strip all symbols from linked output file"));
|
||||||
|
|
||||||
|
cl::opt<std::string> PrintFileName("print-file-name", cl::Optional,
|
||||||
|
cl::value_desc("filename"),
|
||||||
|
cl::desc("Print the full path for the option's value"));
|
||||||
|
|
||||||
//===------------------------------------------------------------------------===
|
//===------------------------------------------------------------------------===
|
||||||
//=== INFORMATION OPTIONS
|
//=== INFORMATION OPTIONS
|
||||||
//===------------------------------------------------------------------------===
|
//===------------------------------------------------------------------------===
|
||||||
@ -201,7 +205,7 @@ static cl::opt<bool> KeepTemps("keep-temps", cl::Optional,
|
|||||||
//=== POSITIONAL OPTIONS
|
//=== POSITIONAL OPTIONS
|
||||||
//===------------------------------------------------------------------------===
|
//===------------------------------------------------------------------------===
|
||||||
|
|
||||||
static cl::list<std::string> Files(cl::Positional, cl::OneOrMore,
|
static cl::list<std::string> Files(cl::Positional, cl::ZeroOrMore,
|
||||||
cl::desc("[Sources/objects/libraries]"));
|
cl::desc("[Sources/objects/libraries]"));
|
||||||
|
|
||||||
static cl::list<std::string> Languages("x", cl::ZeroOrMore,
|
static cl::list<std::string> Languages("x", cl::ZeroOrMore,
|
||||||
@ -234,6 +238,17 @@ const std::string GetFileType(const std::string& fname, unsigned pos ) {
|
|||||||
|
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
void handleTerminatingOptions(CompilerDriver* CD) {
|
||||||
|
if (!PrintFileName.empty()) {
|
||||||
|
sys::Path path = CD->GetPathForLinkageItem(PrintFileName,false);
|
||||||
|
std::string p = path.get();
|
||||||
|
if (p.empty())
|
||||||
|
std::cout << "Can't locate '" << PrintFileName << "'.\n";
|
||||||
|
else
|
||||||
|
std::cout << p << "\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief The main program for llvmc
|
/// @brief The main program for llvmc
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@ -256,8 +271,6 @@ int main(int argc, char **argv) {
|
|||||||
if (OutputFilename.empty())
|
if (OutputFilename.empty())
|
||||||
if (OptLevel == CompilerDriver::LINKING)
|
if (OptLevel == CompilerDriver::LINKING)
|
||||||
OutputFilename = "a.out";
|
OutputFilename = "a.out";
|
||||||
else
|
|
||||||
throw std::string("An output file must be specified. Please use the -o option");
|
|
||||||
|
|
||||||
// Construct the ConfigDataProvider object
|
// Construct the ConfigDataProvider object
|
||||||
LLVMC_ConfigDataProvider Provider;
|
LLVMC_ConfigDataProvider Provider;
|
||||||
@ -309,6 +322,10 @@ int main(int argc, char **argv) {
|
|||||||
if (!LinkerToolOpts.empty())
|
if (!LinkerToolOpts.empty())
|
||||||
CD->setPhaseArgs(CompilerDriver::LINKING, LinkerToolOpts);
|
CD->setPhaseArgs(CompilerDriver::LINKING, LinkerToolOpts);
|
||||||
|
|
||||||
|
// Check for options that cause us to terminate before any significant work
|
||||||
|
// is done.
|
||||||
|
handleTerminatingOptions(CD);
|
||||||
|
|
||||||
// Prepare the list of files to be compiled by the CompilerDriver.
|
// Prepare the list of files to be compiled by the CompilerDriver.
|
||||||
CompilerDriver::InputList InpList;
|
CompilerDriver::InputList InpList;
|
||||||
std::vector<std::string>::iterator fileIt = Files.begin();
|
std::vector<std::string>::iterator fileIt = Files.begin();
|
||||||
|
Loading…
Reference in New Issue
Block a user