mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-10 12:59:21 +03:00
Config file: Treat section names as target triple regexps (#2718)
This commit is contained in:
parent
7816e7730a
commit
ddbd77c009
10 changed files with 109 additions and 72 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/Regex.h"
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
@ -172,7 +173,7 @@ bool ConfigFile::locate(std::string &pathstr) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ConfigFile::read(const char *explicitConfFile, const char *section) {
|
||||
bool ConfigFile::read(const char *explicitConfFile, const char *triple) {
|
||||
std::string pathstr;
|
||||
// explicitly provided by user in command line?
|
||||
if (explicitConfFile) {
|
||||
|
@ -201,7 +202,7 @@ bool ConfigFile::read(const char *explicitConfFile, const char *section) {
|
|||
pathcstr = strdup(pathstr.c_str());
|
||||
auto binpath = exe_path::getBinDir();
|
||||
|
||||
return readConfig(pathcstr, section, binpath.c_str());
|
||||
return readConfig(pathcstr, triple, binpath.c_str());
|
||||
}
|
||||
|
||||
void ConfigFile::extendCommandLine(llvm::SmallVectorImpl<const char *> &args) {
|
||||
|
@ -219,3 +220,7 @@ void ConfigFile::extendCommandLine(llvm::SmallVectorImpl<const char *> &args) {
|
|||
args.insert(runIndex == 0 ? args.end() : args.begin() + runIndex,
|
||||
postSwitches.begin(), postSwitches.end());
|
||||
}
|
||||
|
||||
bool ConfigFile::sectionMatches(const char *section, const char *triple) {
|
||||
return llvm::Regex(section).match(triple);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue