How to read String value of GlobalVariable?

Hi

I have IR Code like

@path = private constant [6xi8] c"abcde\00"

— Code from Pass —

GlobalVariable * GVPath = … // contains @path

I want to convert “abcde” to StringRef. Can you help me with GlobalVariable API?

GlobalVariable::getInitializer() → Constant* // How to get exact value äbcde from here?

~mahesh

if(GVPath->hasInitializer()){
if(ConstantDataArray* CDA=dyn_cast<ConstantDataArray>(GVPath->getInitializer())){
StringRef str=CDA->getAsString();
}
}