ToyClangPlugin Save

Playing with Clang plugin system

Project README

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

Warning FixItHint Error FixItHint

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:

  1. Select custom compiler

Custom compiler

  1. Disable modules

Disable modules

  1. Add OTHER_CFLAGS
-Xclang -load -Xclang /opt/llvm/toy_clang_plugin/build/lib/Debug/ToyClangPlugin.dylib -Xclang -add-plugin -Xclang ToyClangPlugin

Other C flags

That's it. Build and run you project.

Open Source Agenda is not affiliated with "ToyClangPlugin" Project. README Source: AlexDenisov/ToyClangPlugin
Stars
153
Open Issues
0
Last Commit
10 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating