Skip to content

Commit b1957f2

Browse files
committed
Add installation section and install script to README
- Add prominent link to interactive playground at top of README - Add comprehensive Installation section with: - Quick install script (curl | sh) - Manual download instructions for Linux/macOS/Windows - IDE integration examples (VSCode, Neovim) - Create install.sh script that: - Auto-detects Linux/macOS platform - Downloads and extracts latest release - Provides clear PATH setup instructions - Includes link to playground Makes it much easier for users to get started with Null-Safe Clang!
1 parent f5351a7 commit b1957f2

File tree

2 files changed

+126
-0
lines changed

2 files changed

+126
-0
lines changed

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
An experimental Clang fork that adds flow-sensitive null safety to C and C++, inspired by modern languages like TypeScript, Kotlin, and Rust.
44

5+
**Try it online:** [Interactive Playground](https://cs01.github.io/llvm-project/) - See null-safety warnings in real-time in your browser!
6+
57
## What This Adds
68

79
This compiler adds two key features to prevent null pointer crashes:
@@ -32,6 +34,65 @@ This experimental fork of Clang adds flow-sensitive nullability analysis while r
3234
3335
By default, strict nullability is enabled and issues warnings. You can promote warnings to errors with `-Werror=nullability`, or disable the feature entirely with `-fno-strict-nullability`.
3436
37+
## Installation
38+
39+
### Quick Install (Linux/macOS)
40+
41+
Download and extract the latest release for your platform:
42+
43+
```bash
44+
# Auto-detect your platform and install
45+
curl -fsSL https://raw.githubusercontent.com/cs01/llvm-project/null-safe-c-dev/install.sh | sh
46+
47+
# Or manually download:
48+
# Linux x86_64:
49+
curl -L https://github.com/cs01/llvm-project/releases/latest/download/clang-nullsafe-linux-x86_64.tar.gz | tar xz
50+
51+
# macOS (Intel/Apple Silicon):
52+
curl -L https://github.com/cs01/llvm-project/releases/latest/download/clang-nullsafe-macos-universal.tar.gz | tar xz
53+
54+
# Add to PATH
55+
export PATH="$PWD/bin:$PATH"
56+
clang --version
57+
```
58+
59+
### Windows
60+
61+
Download the Windows release:
62+
```bash
63+
curl -L https://github.com/cs01/llvm-project/releases/latest/download/clang-nullsafe-windows-x86_64.tar.gz -o clang-nullsafe.tar.gz
64+
tar -xzf clang-nullsafe.tar.gz
65+
# Add bin\ directory to your PATH
66+
clang --version
67+
```
68+
69+
### What's Included
70+
71+
Each release includes:
72+
- **`clang`** - The Null-Safe C compiler with flow-sensitive null checking
73+
- **`clangd`** - Language server for IDE integration (VSCode, vim, Neovim, Emacs, etc.)
74+
75+
### IDE Integration
76+
77+
Once installed, configure your editor to use the null-safe `clangd`:
78+
79+
**VSCode:**
80+
```json
81+
// settings.json
82+
{
83+
"clangd.path": "/path/to/null-safe-clang/bin/clangd"
84+
}
85+
```
86+
87+
**Neovim/vim:**
88+
```lua
89+
require('lspconfig').clangd.setup({
90+
cmd = { '/path/to/null-safe-clang/bin/clangd' }
91+
})
92+
```
93+
94+
This gives you real-time null-safety warnings as you type!
95+
3596

3697
## Memory Safety in General
3798

install.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
# Null-Safe Clang installer
3+
# Auto-detects your platform and installs the latest release
4+
5+
set -e
6+
7+
REPO="cs01/llvm-project"
8+
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/null-safe-clang}"
9+
10+
echo "🔍 Detecting platform..."
11+
OS=$(uname -s)
12+
ARCH=$(uname -m)
13+
14+
# Determine the correct release file
15+
if [ "$OS" = "Linux" ] && [ "$ARCH" = "x86_64" ]; then
16+
RELEASE_FILE="clang-nullsafe-linux-x86_64.tar.gz"
17+
echo "✓ Detected: Linux x86_64"
18+
elif [ "$OS" = "Darwin" ]; then
19+
RELEASE_FILE="clang-nullsafe-macos-universal.tar.gz"
20+
echo "✓ Detected: macOS (Universal)"
21+
else
22+
echo "❌ Unsupported platform: $OS $ARCH"
23+
echo "Please download manually from:"
24+
echo "https://github.com/$REPO/releases/latest"
25+
exit 1
26+
fi
27+
28+
# Download URL
29+
URL="https://github.com/$REPO/releases/latest/download/$RELEASE_FILE"
30+
31+
echo "📦 Downloading Null-Safe Clang..."
32+
echo " $URL"
33+
34+
# Create install directory
35+
mkdir -p "$INSTALL_DIR"
36+
cd "$INSTALL_DIR"
37+
38+
# Download and extract
39+
if command -v curl >/dev/null 2>&1; then
40+
curl -L "$URL" | tar xz --strip-components=0
41+
elif command -v wget >/dev/null 2>&1; then
42+
wget -O - "$URL" | tar xz --strip-components=0
43+
else
44+
echo "❌ Neither curl nor wget found. Please install one of them."
45+
exit 1
46+
fi
47+
48+
echo "✓ Installed to: $INSTALL_DIR"
49+
echo ""
50+
echo "📝 To use Null-Safe Clang, add this to your shell profile (~/.bashrc, ~/.zshrc, etc.):"
51+
echo ""
52+
echo " export PATH=\"$INSTALL_DIR/bin:\$PATH\""
53+
echo ""
54+
echo "Then reload your shell or run:"
55+
echo ""
56+
echo " source ~/.bashrc # or ~/.zshrc"
57+
echo ""
58+
echo "Verify installation:"
59+
echo " clang --version"
60+
echo ""
61+
echo "Try it out:"
62+
echo " echo 'void f(int* p) { *p = 42; }' | clang -x c - -fsyntax-only"
63+
echo ""
64+
echo "🎮 Try the interactive playground:"
65+
echo " https://cs01.github.io/llvm-project/"

0 commit comments

Comments
 (0)