LLVM instrumentation

Hello everyone,

I want to use LLVM to perform instrumentation on existing bitcode file. I
want to declare a global variable using cpp standard library, say
vector<int> glVector(3);

So I need to get the LLVM Type* of the global variable and then the initial
value Constant* of the global variable. However, the type of vector is not
the primitive type but defined in the vector.h of C++ standard library. Is
there a easy way to perform the instrumentation as if the original bitcode
file has include <vector>?

I create a quite simple cpp file as followed and compile it into a llvm
bitcode file. The bitcode file has 800 lines of code. I suppose the naive
way of instrumenting the declaration of everything of the vector.h is not
practical. Any suggestion is welcome.

#include <iostream>
#include <vector>
using namespace std;

vector<int> abc(3);
int main() {
        cout<<"abc[1]: " << abc[1] << endl;
        return 0;

Thomas Yang