diff --git a/.travis.yml b/.travis.yml index ca0ec37..10d2fb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,31 @@ language: cpp compiler: - clang before_install: + - if [[ $NEW_LLVM == true ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi; + - if [[ $NEW_LLVM == true ]]; then sudo apt-get -qq update; fi; + - if [[ $NEW_LLVM == true ]]; then wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -; fi; + - if [[ $NEW_LLVM == true ]]; then echo "deb http://apt.llvm.org/precise/ llvm-toolchain-precise-4.0 main" | sudo tee -a /etc/apt/sources.list; fi; + - if [[ $NEW_LLVM == true ]]; then sudo apt-get -qq update; fi; - sudo apt-get install -qq llvm-dev + - if [[ $NEW_LLVM == true ]]; then sudo apt-get install clang-4.0 llvm-4.0-dev; fi; + - if [[ $NEW_LLVM == true ]]; then mkdir -p symlinks; fi; + - if [[ $NEW_LLVM == true ]]; then ln -s /usr/bin/g++-4.9 symlinks/g++; fi; + - if [[ $NEW_LLVM == true ]]; then ln -s /usr/bin/gcc-4.9 symlinks/gcc; fi; + - if [[ $NEW_LLVM == true ]]; then ln -s /usr/bin/gcov-4.9 symlinks/gcov; fi; + - if [[ $NEW_LLVM == true ]]; then ln -s /usr/bin/clang-4.0 symlinks/clang; fi; + - if [[ $NEW_LLVM == true ]]; then ln -s /usr/bin/clang++-4.0 symlinks/clang++; fi; + - if [[ $NEW_LLVM == true ]]; then ln -s /usr/bin/llvm-cov-4.0 symlinks/llvm-cov; fi; + - if [[ $NEW_LLVM == true ]]; then ln -s /usr/bin/llvm-config-4.0 symlinks/llvm-config; fi; + - if [[ $NEW_LLVM == true ]]; then ln -s /usr/bin/opt-4.0 symlinks/opt; fi; + - if [[ $NEW_LLVM == true ]]; then export PATH=$PWD/symlinks:$PATH; fi; script: - mkdir build - cd build + - llvm-config --version + - clang --version - cmake .. - make - ctest --output-on-failure +env: + - NEW_LLVM=true + - NEW_LLVM=false diff --git a/src/llvm-passes.cpp b/src/llvm-passes.cpp index 8adf86d..5e66586 100644 --- a/src/llvm-passes.cpp +++ b/src/llvm-passes.cpp @@ -636,8 +636,15 @@ struct ExtractVtables : public ModulePass { tmp++; *tmp = 0; - if(g.getNumOperands() && strlen(realname) > 11) - handleVtable(realname+11, dyn_cast(g.getOperand(0))); + ConstantArray *constarray = 0; + if(g.getNumOperands()) { + Constant *co = dyn_cast(g.getOperand(0)); + constarray = dyn_cast(co); + if(!constarray && co->getNumOperands()) + constarray = dyn_cast(co->getAggregateElement((unsigned)0)); + } + if(constarray && strlen(realname) > 11) + handleVtable(realname+11, constarray); } } return false; diff --git a/test/test-input.cpp b/test/test-input.cpp index 54477d7..5d7fa94 100644 --- a/test/test-input.cpp +++ b/test/test-input.cpp @@ -1,6 +1,6 @@ #define REALTIME __attribute__((annotate("realtime"))) #define NREALTIME __attribute__((annotate("!realtime"))) -#include "test-input2.h" +void other_thing(void); class TestClass {