aboutsummaryrefslogtreecommitdiff
path: root/build2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-19 12:45:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-01-19 12:45:04 +0200
commit5607313a91e5ca0113b1f8b9acfd02c1fb105346 (patch)
treeb14fd2737b88f90e9d142d8e6eff36876e0f8b5a /build2/cc
parent8ecc2d18bf86b1021a31a2e5d01e71afbaa1efd0 (diff)
Get rid of project_name_pool
With small string optimizations this is most likely a hindrance rather that an optimization.
Diffstat (limited to 'build2/cc')
-rw-r--r--build2/cc/common2
-rw-r--r--build2/cc/compile.cxx2
-rw-r--r--build2/cc/link.cxx7
-rw-r--r--build2/cc/pkgconfig.cxx8
-rw-r--r--build2/cc/utility.cxx2
5 files changed, 12 insertions, 9 deletions
diff --git a/build2/cc/common b/build2/cc/common
index 2c79fa6..f0476f9 100644
--- a/build2/cc/common
+++ b/build2/cc/common
@@ -229,7 +229,7 @@ namespace build2
bin::lib&,
bin::liba*,
bin::libs*,
- const string*,
+ const optional<string>&,
const string&,
const dir_path&,
const dir_paths&) const; // pkgconfig.cxx
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index 3318f21..23499ad 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -277,7 +277,7 @@ namespace build2
// we don't need to do match() in order to get options (if
// any, they would be set by search_library()).
//
- if (p.proj () == nullptr ||
+ if (!p.proj () ||
search_library (
sys_lib_dirs, usr_lib_dirs, p.prerequisite) == nullptr)
{
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index a6b67d5..8010598 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -153,7 +153,7 @@ namespace build2
// Handle imported libraries.
//
- if (p.proj () != nullptr)
+ if (p.proj ())
pt = search_library (sys_lib_dirs, usr_lib_dirs, p.prerequisite);
if (pt == nullptr)
@@ -437,7 +437,10 @@ namespace build2
{
// Handle imported libraries.
//
- if (p.proj () != nullptr)
+ // Note that since the search is rule-specific, we don't cache the
+ // target in the prerequisite.
+ //
+ if (p.proj ())
pt = search_library (sys_lib_dirs, usr_lib_dirs, p.prerequisite);
// The rest is the same basic logic as in search_and_match().
diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx
index 1b14960..f8d35af 100644
--- a/build2/cc/pkgconfig.cxx
+++ b/build2/cc/pkgconfig.cxx
@@ -41,7 +41,7 @@ namespace build2
lib& lt,
liba* at,
libs* st,
- const string* proj,
+ const optional<string>& proj,
const string& stem,
const dir_path& libd,
const dir_paths& sysd) const
@@ -56,7 +56,7 @@ namespace build2
// names).
//
path f;
- auto search = [&f, proj, &stem, &libd] (const dir_path& dir) -> bool
+ auto search = [&f, &proj, &stem, &libd] (const dir_path& dir) -> bool
{
// Check if we have this directory inrelative to this library's
// directory.
@@ -93,7 +93,7 @@ namespace build2
if (exists (f))
return true;
- if (proj != nullptr)
+ if (proj)
{
f = pkgd;
f /= *proj;
@@ -420,7 +420,7 @@ namespace build2
const string* ext (nullptr);
prerequisite_key pk {
- nullptr, {&lib::static_type, &out, &out, &name, ext}, &s};
+ nullopt, {&lib::static_type, &out, &out, &name, ext}, &s};
if (lib* lt = static_cast<lib*> (search_library (sysd, usrd, pk)))
{
diff --git a/build2/cc/utility.cxx b/build2/cc/utility.cxx
index b786d11..f8a0afc 100644
--- a/build2/cc/utility.cxx
+++ b/build2/cc/utility.cxx
@@ -67,7 +67,7 @@ namespace build2
if (r == nullptr)
r = &search (ls ? libs::static_type : liba::static_type,
- prerequisite_key {nullptr, l.key (), nullptr});
+ prerequisite_key {nullopt, l.key (), nullptr});
return *r;
}