I tried the Hello pass example on the "Writing LLVM Pass" web page . I followed the compilation instructions (with gcc-4.2) Hello.cpp, but I got compilation errors:
Hello.cpp: 20: error: expected identifier to string constant Hello.cpp: 20: error: expected identifier
',' or '...' to string constant
Hello.cpp: 20: error: expected constructor, destructor or type conversion before ';' Marker
which is the line INITIALIZE_PASS(Hello, "Hello", "Hello World Pass", false, false);in the program. Program:
#include "llvm/Pass.h"
#include "llvm/Function.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
namespace {
struct Hello : public FunctionPass {
static char ID;
Hello() : FunctionPass(&ID) {}
virtual bool runOnFunction(Function &F) {
errs() << "Hello: " << F.getName() << "\n";
return false;
}
};
char Hello::ID = 0;
INITIALIZE_PASS(Hello, "Hello", "Hello World Pass", false, false);
}
Can someone help me with this? Thank you very much!
Best
daniel