diff options
Diffstat (limited to 'lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp')
-rw-r--r-- | lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp b/lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp index f36deeebf906..e3522f2c7b2d 100644 --- a/lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp +++ b/lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp @@ -35,8 +35,9 @@ static void emitProperty(Record *Property, raw_ostream &OS) { OS << ", "; // Emit the property type. + llvm::StringRef type = Property->getValueAsString("Type"); OS << "OptionValue::eType"; - OS << Property->getValueAsString("Type"); + OS << type; OS << ", "; // Emit the property's global value. @@ -46,11 +47,12 @@ static void emitProperty(Record *Property, raw_ostream &OS) { bool hasDefaultUnsignedValue = Property->getValue("HasDefaultUnsignedValue"); bool hasDefaultEnumValue = Property->getValue("HasDefaultEnumValue"); bool hasDefaultStringValue = Property->getValue("HasDefaultStringValue"); + bool hasElementType = Property->getValue("HasElementType"); // Guarantee that every property has a default value. assert((hasDefaultUnsignedValue || hasDefaultEnumValue || - hasDefaultStringValue) && - "Property must have a default value"); + hasDefaultStringValue || hasElementType) && + "Property must have a default value or an element type"); // Guarantee that no property has both a default unsigned value and a default // enum value, since they're bothed stored in the same field. @@ -72,11 +74,18 @@ static void emitProperty(Record *Property, raw_ostream &OS) { !(Property->getValueAsString("Type") == "Enum" && !hasDefaultEnumValue) && "Enum property must have a enum default value."); + // Guarantee that only arrays and dictionaries have an element type; + assert(((type != "Array" && type != "Dictionary") || hasElementType) && + "Only dictionaries and arrays can have an element type."); + // Emit the default uint value. if (hasDefaultUnsignedValue) { OS << std::to_string(Property->getValueAsInt("DefaultUnsignedValue")); } else if (hasDefaultEnumValue) { OS << Property->getValueAsString("DefaultEnumValue"); + } else if (hasElementType) { + OS << "OptionValue::eType"; + OS << Property->getValueAsString("ElementType"); } else { OS << "0"; } |