-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllvm-deactivate
More file actions
executable file
·49 lines (40 loc) · 1 KB
/
llvm-deactivate
File metadata and controls
executable file
·49 lines (40 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# llvm-deactivate: Deactivates the currently active LLVM version.
# Usage:
# source llvm-deactivate
# Check if script is being sourced
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "Error: This script must be sourced, not executed directly."
echo "Usage: source llvm-deactivate"
exit 1
fi
# Check if any version is active
if [ -z "$_ACTIVE_LLVM" ]; then
echo "No LLVM version is currently active."
return 0
fi
# Restore environment variables
if [ -n "$_OLD_PATH" ]; then
export PATH="$_OLD_PATH"
unset _OLD_PATH
fi
if [ -n "$_OLD_CC" ]; then
export CC="$_OLD_CC"
unset _OLD_CC
fi
if [ -n "$_OLD_CXX" ]; then
export CXX="$_OLD_CXX"
unset _OLD_CXX
fi
if [ -n "$_OLD_LD" ]; then
export LD="$_OLD_LD"
unset _OLD_LD
fi
if [ -n "$_OLD_PS1" ]; then
export PS1="$_OLD_PS1"
unset _OLD_PS1
fi
# Clear the active version indicator
unset _ACTIVE_LLVM
unset _ACTIVE_LLVM_PATH
echo "LLVM version deactivated. Environment variables have been restored."