Displaying 2 results from an estimated 2 matches for "filenameinit".
2020 Sep 30
2
Creating a global variable for a struct array
Let me clarify my question.
I have a struct array h1 as follows:
dhash h1[10];
I want to get a Constant* to variable h1. It looks like I can use ConstantStruct::get(StructType*, ArrayRef<Constant *>) to do this.
My question is how to get the second argument of type ArrayRef<Constant *> from the above variable h1.
Thanks,
Chaitra
________________________________
From: Tim Northover
2020 Oct 01
2
Creating a global variable for a struct array
...need a whole ContantArray of them.
> My question is how to get the second argument of type ArrayRef<Constant *> from the above variable h1.
In the second example I gave above you'd write something like
// First create a global variable to hold the filename string.
Constant *FileNameInit = ConstantDataArray::getString("myfile.txt");
Constant *FileName = new GlobalVariable(Module,
FileNameInit->getType(), true, GlobalValue::PrivateLinkage,
FileNameInit, ".str");
FileName = ConstantExpr::getBitCast(FileName, Int8PtrTy);
// Look up the previously cr...