Hello everyone !<br><br>I followed <a href="http://stackoverflow.com/questions/4976298/modern-equivalent-of-llvm-annotationmanager">http://stackoverflow.com/questions/4976298/modern-equivalent-of-llvm-annotationmanager</a> in order to get annotations from my target bytecode. All the examples that I give in the following is related to the code from that link. I have `__attribute__((annotate("DS"))) int f=0;` into the target C++ program and the related IR code:<br>
<br>    @.str = private unnamed_addr constant [3 x i8] c"DS\00", section "llvm.metadata"<br>    @llvm.global.annotations = appending global [1 x { i8*, i8*, i8*, i32 }] [{ i8*, i8*, i8*, i32 } { i8* bitcast (i32* @f to i8*), i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @.str1, i32 0, i32 0), i32 18 }], section "llvm.metadata"<br>
<br>I have two problems following the examples from <a href="http://stackoverflow.com/questions/4976298/modern-equivalent-of-llvm-annotationmanager">http://stackoverflow.com/questions/4976298/modern-equivalent-of-llvm-annotationmanager</a> :<br>
<br>1. Cannot use `annotatedValue->getUnderlyingObject()` since Value class has not this method. Instead, I found in LLVM the following methods: `llvm::GetUnderlyingObject()`,`getUnderlyingObjectFromInt(), getUnderlyingObjects()`.  <br>
<br> I hacked the method `llvm::GetUnderlyingObject()`...that is with Capital G (different from `getUnderlyingObject()`) and call `myGetUnderlyingObject(annotatedValue,0,6)` as mentioned at <a href="http://llvm.org/docs/doxygen/html/namespacellvm.html#ace6c957db39858291c6ce01c38e78480">http://llvm.org/docs/doxygen/html/namespacellvm.html#ace6c957db39858291c6ce01c38e78480</a> .<br>
<br>2. Since I write my code into runOnFunction(), I have problems with `getGlobalVariableString(std::string name)` function from the stackoverflow link. So I have to integrate the following part of code into runOnFunction():<br>
<br>    std::string name = gv->getName().str();<br><br>// assumption: the zeroth operand of a Value::GlobalVariableVal is the actual Value<br><br>    //Module* module = ; //can I use Module& llvm::CallGraph::getModule() ?<br>
    Value *v = module->getNamedValue(name)->getOperand(0);<br>    if(v->getValueID() == Value::ConstantArrayVal)<br>    {<br>        ConstantArray *ca = (ConstantArray *)v;    <br>        std::cout << "    argument " << a->getType()->getDescription() << " "<<a->getName().str()<br>
            << " has annotation \"" << ca->getAsString() << "\"\n";<br>    }<br><br><br>Is there an easier way to get the simple DS annotation of @f ? <br><br>Thank you for any suggestion!