]> granicus.if.org Git - llvm/commitdiff
[Path] Sink predicate computations to their uses. NFCI.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 9 Aug 2017 22:06:32 +0000 (22:06 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 9 Aug 2017 22:06:32 +0000 (22:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310531 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Path.cpp

index ea59ba62d7bdf4fbc72f784d5c9267c582675666..f30e8a8b0cb70499994853a4464ea8f84990fb39 100644 (file)
@@ -439,10 +439,6 @@ void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
   for (auto &component : components) {
     bool path_has_sep =
         !path.empty() && is_separator(path[path.size() - 1], style);
-    bool component_has_sep =
-        !component.empty() && is_separator(component[0], style);
-    bool is_root_name = has_root_name(component, style);
-
     if (path_has_sep) {
       // Strip separators from beginning of component.
       size_t loc = component.find_first_not_of(separators(style));
@@ -453,7 +449,10 @@ void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
       continue;
     }
 
-    if (!component_has_sep && !(path.empty() || is_root_name)) {
+    bool component_has_sep =
+        !component.empty() && is_separator(component[0], style);
+    if (!component_has_sep &&
+        !(path.empty() || has_root_name(component, style))) {
       // Add a separator.
       path.push_back(preferred_separator(style));
     }