summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/utils/lit/lit/llvm/config.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index cd1f8eea750..d1f368d0d83 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -106,7 +106,10 @@ class LLVMConfig(object):
current_paths = self.config.environment.get(variable, "")
current_paths = current_paths.split(os.path.pathsep)
paths = [norm(p) for p in current_paths]
- for p in paths_to_add:
+ # If we are passed a list [a b c], then iterating this list forwards
+ # and adding each to the beginning would result in b c a. So we
+ # need to iterate in reverse to end up with the original ordering.
+ for p in reversed(paths_to_add):
# Move it to the front if it already exists, otherwise insert it at the
# beginning.
p = norm(p)
OpenPOWER on IntegriCloud