Skip to content

Commit

Permalink
Fix #39
Browse files Browse the repository at this point in the history
Background and solution identical to the previous patch.
  • Loading branch information
banach-space committed Jul 17, 2021
1 parent 5ed338e commit 1bbbdeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ to test **StaticCallCounter**:
```bash
export LLVM_DIR=<installation/dir/of/llvm/12>
# Generate an LLVM file to analyze
$LLVM_DIR/bin/clang -O1 -emit-llvm -c <source_dir>/inputs/input_for_cc.c -o input_for_cc.bc
$LLVM_DIR/bin/clang -emit-llvm -c <source_dir>/inputs/input_for_cc.c -o input_for_cc.bc
# Run the pass through opt - Legacy PM
$LLVM_DIR/bin/opt -load <build_dir>/lib/libStaticCallCounter.so -legacy-static-cc -analyze input_for_cc.bc
```
Expand Down
6 changes: 6 additions & 0 deletions include/StaticCallCounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ struct StaticCallCounter : public llvm::AnalysisInfoMixin<StaticCallCounter> {
using Result = ResultStaticCC;
Result run(llvm::Module &M, llvm::ModuleAnalysisManager &);
Result runOnModule(llvm::Module &M);
// Part of the official API:
// https://llvm.org/docs/WritingAnLLVMNewPMPass.html#required-passes
static bool isRequired() { return true; }

private:
// A special type used by analysis passes to provide an address that
Expand All @@ -46,6 +49,9 @@ class StaticCallCounterPrinter
explicit StaticCallCounterPrinter(llvm::raw_ostream &OutS) : OS(OutS) {}
llvm::PreservedAnalyses run(llvm::Module &M,
llvm::ModuleAnalysisManager &MAM);
// Part of the official API:
// https://llvm.org/docs/WritingAnLLVMNewPMPass.html#required-passes
static bool isRequired() { return true; }

private:
llvm::raw_ostream &OS;
Expand Down

0 comments on commit 1bbbdeb

Please sign in to comment.