All Questions
1,730
questions
0
votes
0
answers
26
views
Standard library not detected in my custom Clang Tool
I have the following code (Want to Develop a CXX refactoring tool)
using namespace clang;
int main(int argc, const char **argv) {
static llvm::cl::OptionCategory KsaiToolOptions("my_tool ...
0
votes
0
answers
22
views
Break basic blocks in llvm over function calls
I have a C function that invokes bar()
void foo(int x) {
bar(x);
bar(x + 1);
}
Its LLVM IR looks like
define dso_local void @foo(i32 noundef %0) #0 {
entry:
%2 = alloca i32, align 4
...
0
votes
0
answers
32
views
Address Sanitizer do not show nothing and lsan_is_turned_off
I'm trying to use address sanitizer in my main.cpp on Windows.
Makefile:
default:
clang++ main.cpp -o app.exe -fsanitize=address -g
set ASAN_OPTIONS=detect_leaks=1
./app.exe
main.cpp
#...
0
votes
1
answer
25
views
LLVM linker does not work on MacOS while trying to develop on-chain Solana app (C++)
this is the error i get:
./account_logger.so ()
dyld[61282]: Library not loaded: @rpath/libLLVM.dylib
Referenced from: <A9E4BE2A-BF8D-3956-BCA9-E3BC5A6C9F9C> /Users/myusername/.local/share/...
0
votes
1
answer
27
views
Finding the dominating definition location from a use location using llvm
I am trying to find the defining locations that can reach a use location in llvm. For example, I have a CFG that looks like
a (def)
/ \
b c (def)
\ /
d (use)
So, both instructions a and c ...
4
votes
1
answer
156
views
std::optional<std::unique_ptr<int>> is not constexpr?
Why is the following method not constexpr?
constexpr std::optional<std::unique_ptr<int>> test2(void) {
return std::nullopt;
}
Clang gives me the following error:
[build] /.../<>....
0
votes
0
answers
29
views
LLVM invalid cast opcode for cast from 'i64' to 'i64'
I'm trying to use LLVM Create and replaceAllUsesWith to modify the (A+B+C) calculation to (A*B)-C
The ReplaceInst.cpp code I wrote is this,
// Traverse Instructions in TheModule
void TraverseModule(...
0
votes
1
answer
89
views
Can clang-format arrange each function entirely on one line?
I'd like to format a set of C++ files so that each function or function template is defined entirely on one line. With input such as:
template <typename T>
void foo(int i)
{
return;
}
...
-2
votes
1
answer
132
views
What is the Microsoft goto extension? [closed]
I am writing a C++ generator, that needs to use the goto statement. I am compiling my code with clang++ and get the warning [-Wmicrosoft-goto] on some of my gotos. All of my gotos only jump around ...
0
votes
0
answers
74
views
Is it possible to webassembly a C++ Windows application using emscripten:
I have a complex windows application that uses MFC and some OpenGL.
I'd like to use Webassembly https://github.com/emscripten-core/emscripten
to use emscripten to convert the c++ application to web.
...
0
votes
1
answer
84
views
llvm/IR/Attributes.inc: No such file or directory when write toy compiler using LLVM
I want to use flex bison and llvm to generate IR,in my project, I use Clion as ide, and I correctly include all the header files that llvm needs.
cmake_minimum_required(VERSION 3.28)
project(Compiler)...
-1
votes
1
answer
39
views
llvm-cov ignore file regex does not work on windows
I have a large c++ Project which contains serveral shared objects using cmake. I am using gtest and gmock for unit tests and in addition I am using a code coverage extension from here https://github....
0
votes
0
answers
39
views
Obtain LLVM IR after linking with C++ STD library?
I am trying to analyse instruction count of a C++ program using LLVM passes. Issue is the when i use function from standard library like sqrt() from cmath, the LLVM IR does not contain the ...
2
votes
2
answers
60
views
Using libclang, is there a way to know if a closure type was introduced in the context of the initialization of a inline variable?
Given the following C++ code:
inline auto v = []{ return 1; }();
The context of the closure type is the initializer of an inline variable. This leads to a special mangling rule in the Itanium ABI (...
0
votes
0
answers
38
views
Allocating complex data (btVector3) on the stack in LLVM IR
I want to use LLVM to JIT compile some code in my game using the LLVM C/C++ API. The JIT compiled functions should be able to effect the physics of the world, which is handled by bullet3.
To do so I ...