Skip to content

Commit

Permalink
Add LLVM 4.0 Build Continious Integration
Browse files Browse the repository at this point in the history
Fixes bug in vtable reconstruction
  • Loading branch information
fundamental committed May 28, 2017
1 parent 64be902 commit 737ab0b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 9 additions & 2 deletions src/llvm-passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,15 @@ struct ExtractVtables : public ModulePass {
tmp++;
*tmp = 0;

if(g.getNumOperands() && strlen(realname) > 11)
handleVtable(realname+11, dyn_cast<ConstantArray>(g.getOperand(0)));
ConstantArray *constarray = 0;
if(g.getNumOperands()) {
Constant *co = dyn_cast<Constant>(g.getOperand(0));
constarray = dyn_cast<ConstantArray>(co);
if(!constarray && co->getNumOperands())
constarray = dyn_cast<ConstantArray>(co->getAggregateElement((unsigned)0));
}
if(constarray && strlen(realname) > 11)
handleVtable(realname+11, constarray);
}
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion test/test-input.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define REALTIME __attribute__((annotate("realtime")))
#define NREALTIME __attribute__((annotate("!realtime")))
#include "test-input2.h"
void other_thing(void);

class TestClass
{
Expand Down

0 comments on commit 737ab0b

Please sign in to comment.