llvm

LLVM bitcode cross-platform

好久不见. 提交于 2019-11-26 18:25:58
问题 Just to be sure: Is LLVM bitcode cross-platform? By which I mean, can the generated IR (".bc") file be distrubuted and interpreted/JITed over various platforms? If so, how does Clang convert C++ into platform independend code? While in the C++ language itself, preprocessors for determining it's target platform are used before it actually compiles. 回答1: LLVM IR can be cross-platform, with the obvious exceptions others have listed. However, that does not mean Clang generates cross-platform code

How to use clang with mingw-w64 headers on windows

ⅰ亾dé卋堺 提交于 2019-11-26 18:18:32
问题 I have clang 3.9 from http://llvm.org/releases/3.9.0/LLVM-3.9.0-win32.exe clang version 3.9.0 (branches/release_39) Target: i686-pc-windows-msvc Thread model: posix InstalledDir: C:\Program Files\LLVM\bin And gcc 6.2.0 (Mingw-w64) gcc (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 6.2.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I

What can make C++ RTTI undesirable to use?

偶尔善良 提交于 2019-11-26 17:57:55
问题 Looking at the LLVM documentation, they mention that they use "a custom form of RTTI", and this is the reason they have isa<> , cast<> and dyn_cast<> templated functions. Usually, reading that a library reimplements some basic functionality of a language is a terrible code smell and just invites to run. However, this is LLVM we're talking of: the guys are working on a C++ compiler and a C++ runtime. If they don't know what they're doing, I'm pretty much screwed because I prefer clang to the

Under what conditions is @synthesize automatic in Objective-c?

痞子三分冷 提交于 2019-11-26 17:47:47
问题 Under what conditions is @synthesize automatic in Objective-c? Perhaps when using LLVM 3.0 and up? From reading around the net it seems like @synthesize is unnecessary starting with Xcode 4. However I'm using Xcode 4 and receiving warnings when I don't @synthesize a property. Some of the responses to Why don't properties get automatically synthesized seem to imply @synthesize can be omitted at some point under some circumstances. Another (old) reference hinting that @synthesize might be

Enable OpenMP support in clang in Mac OS X (sierra & Mojave)

北慕城南 提交于 2019-11-26 12:46:02
问题 I am using Mac OS X Sierra, and I found that clang (LLVM version 8.1.0 (clang-802.0.38)) does not support OpenMP: when I run clang -fopenmp program_name.c , I got the following error: clang: error: unsupported option \'-fopenmp\' It seems that clang does not support -fopenmp flag. I could not find any openmp library in homebrew. According to LLVM website, LLVM already supports OpenMP. But I could not find a way to enable it during compiling. Does this mean that the default clang in Mac does

Translation of machinecode into LLVM IR (disassembly / reassembly of X86_64. X86. ARM into LLVM bitcode)

元气小坏坏 提交于 2019-11-26 11:57:03
问题 I would like to translate X86_64, x86, ARM executables into LLVM IR (disassembly). What solution do you suggest ? 回答1: mcsema is a production-quality binary lifter. It takes x86 and x86-64 and statically "lifts" it to LLVM IR. It's actively maintained, BSD licensed, and has extensive tests and documentation. https://github.com/trailofbits/mcsema 回答2: Consider using RevGen tool developed within the S2E project. It allows converting x86 binaries to LLVM IR. The source code could be checked out

View array in LLDB: equivalent of GDB&#39;s &#39;@&#39; operator in Xcode 4.1

守給你的承諾、 提交于 2019-11-26 11:47:59
问题 I would like to view an array of elements pointed to by a pointer. In GDB this can be done by treating the pointed memory as an artificial array of a given length using the operator \'@\' as *pointer @ length where length is the number of elements I want to view. The above syntax does not work in LLDB supplied with Xcode 4.1. Is there any way how to accomplish the above in LLDB? 回答1: Actually there is a simple way to do it, by casting the pointer to a pointer-to-array. For example, if you

Dynamic forwarding: suppress Incomplete Implementation warning

╄→尐↘猪︶ㄣ 提交于 2019-11-26 09:18:36
问题 I have a class exposing some methods, whose implementation is provided by an inner object. I\'m using forward invocation to dispatch at runtime the method calls to the inner object, but XCode is complaining since it cannot find an implementation of the declared methods. I found some other similar questions on SO, but all of them were solved with a design change. I don\'t mean to have a discussion about the design here, but if anybody has some suggestion about it I have an open question on

Does the C++ standard allow for an uninitialized bool to crash a program?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 05:56:59
问题 I know that an \"undefined behaviour\" in C++ can pretty much allow the compiler to do anything it wants. However, I had a crash that surprised me, as I assumed that the code was safe enough. In this case, the real problem happened only on a specific platform using a specific compiler, and only if optimization was enabled. I tried several things in order to reproduce the problem and simplify it to the maximum. Here\'s an extract of a function called Serialize , that would take a bool