Skip to content

Commit

Permalink
Add missing header needed in findJSON compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
sletz committed Apr 1, 2024
1 parent f841d4f commit c7a89bf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions compiler/generator/llvm/llvm_dynamic_dsp_aux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <llvm/IR/LegacyPassNameParser.h>
#include <llvm/IR/Verifier.h>
#include <llvm/IR/PassManager.h>
#include <llvm/IR/Constants.h>
#include <llvm/IRReader/IRReader.h>
#include <llvm/Linker/Linker.h>
#include <llvm/Support/FileSystem.h>
Expand Down Expand Up @@ -100,14 +101,12 @@ using namespace std;
// Assuming there is a single JSON string in the module
std::string llvm_dsp_factory_aux::findJSON(llvm::Module* module)
{
#if LLVM_VERSION_MAJOR >= 16
for (const auto& global : module->globals()) {
auto* initializer = global.getInitializer();
if (auto* array = llvm::dyn_cast<llvm::ConstantDataArray>(initializer)) {
if (array->isString()) return array->getAsString().str();
}
}
#endif
return "";
}

Expand Down

0 comments on commit c7a89bf

Please sign in to comment.