aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/common.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-10-04 10:52:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-10-04 10:52:15 +0200
commit3d224bcb822081c4aa54a82d514bea07f7c459fe (patch)
tree66408aa900018ae81defb1f25ba08e9f615cacf4 /libbuild2/cc/common.ixx
parente1a1d978d364c723935acfc7b56fae8b8253d054 (diff)
Optimize internal scope implementation
Diffstat (limited to 'libbuild2/cc/common.ixx')
-rw-r--r--libbuild2/cc/common.ixx33
1 files changed, 13 insertions, 20 deletions
diff --git a/libbuild2/cc/common.ixx b/libbuild2/cc/common.ixx
index ce28890..417efbd 100644
--- a/libbuild2/cc/common.ixx
+++ b/libbuild2/cc/common.ixx
@@ -6,29 +6,22 @@ namespace build2
namespace cc
{
inline const scope* data::
- effective_internal_scope (const scope& bs) const
+ effective_iscope (const scope& bs) const
{
- if (internal_scope == nullptr)
- return nullptr;
- else
+ if (iscope)
{
- const string& s (*internal_scope);
-
- if (s == "current")
- return internal_scope_current;
- else if (s == "base")
- return &bs;
- else if (s == "root")
- return bs.root_scope ();
- else if (s == "bundle")
- return bs.bundle_scope ();
- else if (s == "strong")
- return bs.strong_scope ();
- else if (s == "weak")
- return bs.weak_scope ();
- else
- return nullptr;
+ switch (*iscope)
+ {
+ case internal_scope::current: return iscope_current;
+ case internal_scope::base: return &bs;
+ case internal_scope::root: return bs.root_scope ();
+ case internal_scope::bundle: return bs.bundle_scope ();
+ case internal_scope::strong: return bs.strong_scope ();
+ case internal_scope::weak: return bs.weak_scope ();
+ }
}
+
+ return nullptr;
}
}
}