ToyClangPlugin
Simple clang plugin. More details here
This plugin shows you a warning in case of class' name starts with lowercse letter and shows an error in case when class' name contains underscore (_
).
As a bonus it proposes you a FixIt hints
Installation
Build llvm
/clang
from sources
cd /opt
sudo mkdir llvm
sudo chown `whoami` llvm
cd llvm
export LLVM_HOME=`pwd`
git clone -b release_33 https://github.com/llvm-mirror/llvm.git llvm
git clone -b release_33 https://github.com/llvm-mirror/clang.git llvm/tools/clang
git clone -b release_33 https://github.com/llvm-mirror/clang-tools-extra.git llvm/tools/clang/tools/extra
git clone -b release_33 https://github.com/llvm-mirror/compiler-rt.git llvm/projects/compiler-rt
mkdir llvm_build
cd llvm_build
cmake ../llvm -DCMAKE_BUILD_TYPE:STRING=Release
make -j`sysctl -n hw.logicalcpu`
Get the plugin copy
cd $LLVM_HOME
git clone https://github.com/AlexDenisov/ToyClangPlugin.git
cd ToyClangPlugin
Build the plugin
mkdir build; cd build
cmake -G Xcode ..
open ToyClangPlugin.xcodeproj
Download this archive, unzip and run following commands
sudo mv HackedClang.xcplugin `xcode-select -print-path`/../PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins
sudo mv HackedBuildSystem.xcspec `xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications
Open your project and pudate build settings:
- Select custom compiler
- Disable modules
- Add
OTHER_CFLAGS
-Xclang -load -Xclang /opt/llvm/toy_clang_plugin/build/lib/Debug/ToyClangPlugin.dylib -Xclang -add-plugin -Xclang ToyClangPlugin
That's it. Build and run you project.