Commit 09cb61ef authored by Nikola Dinev's avatar Nikola Dinev
Browse files

Support building of bindings generator with LLVM 13

- use APSInt::toString(llvm::SmallString) everywhere
- create() instead of construct options parser for LLVM>=13
parent 061d4848
......@@ -79,9 +79,11 @@ protected:
for (std::size_t i = 0; i < ctsd->getTemplateArgs().size(); i++) {
const auto& tmpArg = ctsd->getTemplateArgs()[i];
llvm::SmallString<1024> nameSmallStr(namespaceStrippedName);
switch (tmpArg.getKind()) {
case TemplateArgument::ArgKind::Integral:
namespaceStrippedName += tmpArg.getAsIntegral().toString(10);
tmpArg.getAsIntegral().toString(nameSmallStr);
namespaceStrippedName = nameSmallStr.c_str();
break;
case TemplateArgument::ArgKind::Type:
......@@ -271,7 +273,9 @@ public:
e->namespaceStrippedName = getNamespaceStrippedName(declaration);
e->isScoped = declaration->isScoped();
for (auto enumerator : declaration->enumerators()) {
e->values.emplace(enumerator->getNameAsString(), enumerator->getInitVal().toString(10));
llvm::SmallString<32> valueAsStr;
enumerator->getInitVal().toString(valueAsStr);
e->values.emplace(enumerator->getNameAsString(), valueAsStr.c_str());
}
m.enums.push_back(std::move(e));
......@@ -779,7 +783,14 @@ int main(int argc, const char** argv)
{
noModule.setInitialValue(false);
#if LLVM_VERSION_MAJOR < 13
CommonOptionsParser optionsParser(argc, argv, bindingsOptions);
#else
auto optionsParserExp = CommonOptionsParser::create(argc, argv, bindingsOptions);
assert((optionsParserExp) && "Failed to parse command line arguments");
auto& optionsParser = optionsParserExp.get();
#endif
assert((!moduleName.empty() || !pythonModuleName.empty())
&& "-name or -pyname should be specified");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment