aboutsummaryrefslogtreecommitdiff
path: root/gold/dirsearch.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-10-04 05:49:04 +0000
committerIan Lance Taylor <iant@google.com>2007-10-04 05:49:04 +0000
commitad2d6943a49fa11ba1e23749973c75feb12dcf6b (patch)
treebc02409b029014fba4f735d3dea15217bbb58c9b /gold/dirsearch.cc
parent4638dbaa96a30d93647bb737b9a49ee1ca878a7d (diff)
downloadgdb-ad2d6943a49fa11ba1e23749973c75feb12dcf6b.zip
gdb-ad2d6943a49fa11ba1e23749973c75feb12dcf6b.tar.gz
gdb-ad2d6943a49fa11ba1e23749973c75feb12dcf6b.tar.bz2
Full support for --sysroot.
Diffstat (limited to 'gold/dirsearch.cc')
-rw-r--r--gold/dirsearch.cc46
1 files changed, 23 insertions, 23 deletions
diff --git a/gold/dirsearch.cc b/gold/dirsearch.cc
index 8965903..6dea53d 100644
--- a/gold/dirsearch.cc
+++ b/gold/dirsearch.cc
@@ -211,43 +211,43 @@ Dir_cache_task::run(gold::Workqueue*)
namespace gold
{
-Dirsearch::Dirsearch()
- : directories_(), token_()
-{
-}
-
void
-Dirsearch::add(Workqueue* workqueue, const char* d)
+Dirsearch::initialize(Workqueue* workqueue,
+ const General_options::Dir_list* directories)
{
- this->directories_.push_back(d);
- this->token_.add_blocker();
- workqueue->queue(new Dir_cache_task(d, this->token_));
-}
-
-void
-Dirsearch::add(Workqueue* workqueue, const General_options::Dir_list& list)
-{
- for (General_options::Dir_list::const_iterator p = list.begin();
- p != list.end();
+ this->directories_ = directories;
+ for (General_options::Dir_list::const_iterator p = directories->begin();
+ p != directories->end();
++p)
- this->add(workqueue, *p);
+ {
+ this->token_.add_blocker();
+ workqueue->queue(new Dir_cache_task(p->name().c_str(), this->token_));
+ }
}
std::string
-Dirsearch::find(const std::string& n1, const std::string& n2) const
+Dirsearch::find(const std::string& n1, const std::string& n2,
+ bool *is_in_sysroot) const
{
gold_assert(!this->token_.is_blocked());
- for (std::list<const char*>::const_iterator p = this->directories_.begin();
- p != this->directories_.end();
+ for (General_options::Dir_list::const_iterator p =
+ this->directories_->begin();
+ p != this->directories_->end();
++p)
{
- Dir_cache* pdc = caches.lookup(*p);
+ Dir_cache* pdc = caches.lookup(p->name().c_str());
gold_assert(pdc != NULL);
if (pdc->find(n1))
- return std::string(*p) + '/' + n1;
+ {
+ *is_in_sysroot = p->is_in_sysroot();
+ return p->name() + '/' + n1;
+ }
if (!n2.empty() && pdc->find(n2))
- return std::string(*p) + '/' + n2;
+ {
+ *is_in_sysroot = p->is_in_sysroot();
+ return p->name() + '/' + n2;
+ }
}
return std::string();