summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-06 20:13:21 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-06 20:13:21 +0000
commit7e7b6700743285c0af506ac6299ddf82ebd434b9 (patch)
tree578d2ea1868b77f3dff145df7f8f3fe73272c09e /tools
parent4b570baa7e867c652fa7d690585098278082fae9 (diff)
Diffstat (limited to 'tools')
-rw-r--r--tools/dsymutil/DwarfLinker.cpp12
-rw-r--r--tools/llc/llc.cpp3
-rw-r--r--tools/llvm-config/llvm-config.cpp10
3 files changed, 16 insertions, 9 deletions
diff --git a/tools/dsymutil/DwarfLinker.cpp b/tools/dsymutil/DwarfLinker.cpp
index 018d91d6c318..ecd631c1039c 100644
--- a/tools/dsymutil/DwarfLinker.cpp
+++ b/tools/dsymutil/DwarfLinker.cpp
@@ -1796,8 +1796,7 @@ static bool analyzeContextInfo(const DWARFDie &DIE,
Info.Prune = InImportedModule;
if (DIE.hasChildren())
- for (auto Child = DIE.getFirstChild(); Child && !Child.isNULL();
- Child = Child.getSibling())
+ for (auto Child: DIE.children())
Info.Prune &= analyzeContextInfo(Child, MyIdx, CU, CurrentDeclContext,
StringPool, Contexts, InImportedModule);
@@ -2294,8 +2293,7 @@ void DwarfLinker::lookForDIEsToKeep(RelocationManager &RelocMgr,
if (!Die.hasChildren() || (Flags & TF_ParentWalk))
return;
- for (auto Child = Die.getFirstChild(); Child && !Child.isNULL();
- Child = Child.getSibling())
+ for (auto Child: Die.children())
lookForDIEsToKeep(RelocMgr, Child, DMO, CU, Flags);
}
@@ -2814,8 +2812,7 @@ DIE *DwarfLinker::DIECloner::cloneDIE(
// Determine whether there are any children that we want to keep.
bool HasChildren = false;
- for (auto Child = InputDIE.getFirstChild(); Child && !Child.isNULL();
- Child = Child.getSibling()) {
+ for (auto Child: InputDIE.children()) {
unsigned Idx = U.getDIEIndex(Child);
if (Unit.getInfo(Idx).Keep) {
HasChildren = true;
@@ -2840,8 +2837,7 @@ DIE *DwarfLinker::DIECloner::cloneDIE(
}
// Recursively clone children.
- for (auto Child = InputDIE.getFirstChild(); Child && !Child.isNULL();
- Child = Child.getSibling()) {
+ for (auto Child: InputDIE.children()) {
if (DIE *Clone = cloneDIE(Child, Unit, PCOffset, OutOffset, Flags)) {
Die->addChild(Clone);
OutOffset = Clone->getOffset() + Clone->getSize();
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index aa0beb45b4e9..a76d3249674f 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -134,6 +134,8 @@ static cl::opt<std::string> StartAfter("start-after",
cl::desc("Resume compilation after a specific pass"),
cl::value_desc("pass-name"), cl::init(""));
+static cl::list<std::string> IncludeDirs("I", cl::desc("include search path"));
+
namespace {
static ManagedStatic<std::vector<std::string>> RunPassNames;
@@ -398,6 +400,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
Options.MCOptions.AsmVerbose = AsmVerbose;
Options.MCOptions.PreserveAsmComments = PreserveComments;
+ Options.MCOptions.IASSearchPaths = IncludeDirs;
std::unique_ptr<TargetMachine> Target(
TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, FeaturesStr,
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index d780094861c6..58571cc59b79 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -196,6 +196,7 @@ Options:\n\
--bindir Directory containing LLVM executables.\n\
--includedir Directory containing LLVM headers.\n\
--libdir Directory containing LLVM libraries.\n\
+ --cmakedir Directory containing LLVM cmake modules.\n\
--cppflags C preprocessor flags for files that include LLVM headers.\n\
--cflags C compiler flags for files that include LLVM headers.\n\
--cxxflags C++ compiler flags for files that include LLVM headers.\n\
@@ -302,7 +303,8 @@ int main(int argc, char **argv) {
// Compute various directory locations based on the derived location
// information.
- std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir;
+ std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir,
+ ActiveCMakeDir;
std::string ActiveIncludeOption;
if (IsInDevelopmentTree) {
ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
@@ -314,12 +316,14 @@ int main(int argc, char **argv) {
case CMakeStyle:
ActiveBinDir = ActiveObjRoot + "/bin";
ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
+ ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
break;
case CMakeBuildModeStyle:
ActivePrefix = ActiveObjRoot;
ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
ActiveLibDir =
ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
+ ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
break;
}
@@ -331,6 +335,7 @@ int main(int argc, char **argv) {
ActiveIncludeDir = ActivePrefix + "/include";
ActiveBinDir = ActivePrefix + "/bin";
ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+ ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
@@ -357,6 +362,7 @@ int main(int argc, char **argv) {
std::replace(ActivePrefix.begin(), ActivePrefix.end(), '/', '\\');
std::replace(ActiveBinDir.begin(), ActiveBinDir.end(), '/', '\\');
std::replace(ActiveLibDir.begin(), ActiveLibDir.end(), '/', '\\');
+ std::replace(ActiveCMakeDir.begin(), ActiveCMakeDir.end(), '/', '\\');
std::replace(ActiveIncludeOption.begin(), ActiveIncludeOption.end(), '/',
'\\');
}
@@ -475,6 +481,8 @@ int main(int argc, char **argv) {
OS << ActiveIncludeDir << '\n';
} else if (Arg == "--libdir") {
OS << ActiveLibDir << '\n';
+ } else if (Arg == "--cmakedir") {
+ OS << ActiveCMakeDir << '\n';
} else if (Arg == "--cppflags") {
OS << ActiveIncludeOption << ' ' << LLVM_CPPFLAGS << '\n';
} else if (Arg == "--cflags") {