public:
static MDString *get(LLVMContext &Context, StringRef Str);
- static MDString *get(LLVMContext &Context, const char *Str);
-
+ static MDString *get(LLVMContext &Context, const char *Str) {
+ return get(Context, Str ? StringRef(Str) : StringRef());
+ }
+
StringRef getString() const { return Str; }
unsigned getLength() const { return (unsigned)Str.size(); }
FunctionLocalBit = 1 << 0,
/// NotUniquedBit - This is set on MDNodes that are not uniqued because they
- /// have a null perand.
+ /// have a null operand.
NotUniquedBit = 1 << 1,
/// DestroyFlag - This bit is set by destroy() so the destructor can assert
/// node with T.
void replaceOperand(MDNodeOperand *Op, Value *NewVal);
~MDNode();
- /// replaceAllOperandsWithNull - This is used while destroying llvm context to
- /// gracefully delete all nodes. This method replaces all operands with null.
- void replaceAllOperandsWithNull();
protected:
explicit MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
bool isNotUniqued() const {
return (getSubclassDataFromValue() & NotUniquedBit) != 0;
}
- void setIsNotUniqued() {
- setValueSubclassData(getSubclassDataFromValue() | NotUniquedBit);
- }
+ void setIsNotUniqued();
// Shadow Value::setValueSubclassData with a private forwarding method so that
// any future subclasses cannot accidentally use it.
std::string Name;
Module *Parent;
- void *Operands; // SmallVector<WeakVH<MDNode>, 4>
+ void *Operands; // SmallVector<TrackingVH<MDNode>, 4>
void setParent(Module *M) { Parent = M; }
protected: