llvm

How to switch off LLVM's integrated assembler?

孤街浪徒 提交于 2019-11-27 23:35:10
I have a project involving hand-written assembly—AT&T syntax, works fine with GCC, but not done by me plus I know very little about assembly—which exhibits a weird problem when trying to build it with Clang. LLVM documentation mentions that "most X86 targets" use LLVM's integrated assembler as opposed to the system assembler; as a possible workaround I would like to explicitly use the latter. I (well, Google) haven't been successful in finding information on how to do this. Question: Is there a way to ask or rather force Clang / LLVM to use the system assembler instead of the integrated one?

How I'm supposed to use the sanitizer in clang?

无人久伴 提交于 2019-11-27 23:34:28
I'm sorry if this is a uber-easy concept, but I find hard to acquire the right mindset in order to correctly use the sanitizer provided by clang . float foo(float f) { return (f / 0); } I compile this small snippet with clang++ -fsanitize=float-divide-by-zero -std=c++11 -stdlib=libc++ -c source.cpp -o osan and I also compile a "normal" version of my object without using the sanitizer clang++ -std=c++11 -stdlib=libc++ -c source.cpp -o onorm I was expecting some verbose output, or some error from the console, but when inspecting the file with nm I only found 1 difference nm o* --demangle onorm:

How can I force Xcode to use a custom compiler?

守給你的承諾、 提交于 2019-11-27 23:21:24
I want to force Xcode to use a custom compiler ('clang-llvm' build from the src) so I can use the clang plugin. My Xcode version is 7.3.1. People say it is possible with custom toolchains. I didn't make a research on them because easier solution worked well for me: It is also possible to run frontend plugins directly by setting appropriate "build settings" of Xcode. (Several ways to do this, you can set them on the command line for instance: xcodebuild build FOO=bla.) Here are a few build settings that I found useful to inject C flags: OTHER_CFLAGS, OTHER_CPLUSPLUSFLAGS or to replace the

if(self = [super init]) - LLVM warning! How are you dealing with it?

别来无恙 提交于 2019-11-27 23:01:10
Prior to Xcode 4 with LLVM this passed the compiler unnoticed. Assignment within the conditional is perfectly intentional and a Cocoa idiom. Xcode 4 with LLVM compiler selected never fails to complain, and not just at compile time, as soon as you type it the yellow warning icon appears. Turning off warnings as errors and just ignoring the warning doesn't seem like a good idea. Moving the assignment out of the parentheses wastes space. Having to turn off this warning with a pragma for every new project will become tedious. How are you dealing with it? What's the new idiom going to be? This is

Passing a gcc flag through makefile

会有一股神秘感。 提交于 2019-11-27 21:20:17
I am trying to build a pass using llvm and I have finished building llvm and its associated components. However, when I run make after following all the steps to build a pass including the makefile , I get the following relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC After tyring to find a fix by googling the error message, I came to know that this is not specific to llvm. A few solutions suggested that I should use "--enable-shared" while running configure but that didn't help my case. Now I want to re-build llvm using fPIC ,

If a subclass refers to a superclass ivar, synthesizing an unrelated property fails

你说的曾经没有我的故事 提交于 2019-11-27 21:12:56
问题 Edit: I just noticed this other Stack Overflow question asking much the same thing: Why does a subclass @property with no corresponding ivar hide superclass ivars? This is some interesting behavior that I cannot find documented in anything official or unofficial (blog, tweet, SO question, etc). I have boiled it down to its essence and tested this in a fresh Xcode project, but I can't explain it. MyBaseClass has an instance variable: @interface MyBaseClass : NSObject { NSObject *fooInstanceVar

Building with LLVM and any optimization causes app to crash on startup

烂漫一生 提交于 2019-11-27 20:49:25
When I try to build my app with LLVM 2.0 in XCode 4.0.1 and any level or optimization that is not none (anything but -O0), the app crashes after i launch it on the device (simulator is ok). I can't seem to debug the crash as it does not happen when i build in xcode and attach via GDB/LLDB. Also, the crash only happens when i build the app on the command line with xcodebuild; building via the XCode IDE doesn't crash even with the exact same project settings. I can't see any useful information in the crash logs, as the crash happens outside my code: Exception Type: EXC_BAD_ACCESS (SIGBUS)

How to generate machine code with llvm

随声附和 提交于 2019-11-27 19:45:59
I'm currently working on a compiler project using llvm. I have followed various tutorials to the point where I have a parser to create a syntax tree and then the tree is converted into an llvm Module using the provided IRBuilder. My goal is to create an executable, and I am confused as what to do next. All the tutorials I've found just create the llvm module and print out the assembly using Module.dump(). Additionally, the only documentation I can find is for llvm developers, and not end users of the project. If I want to generate machine code, what are the next steps? The llvm-mc project

warning: duplicate protocol definition of '…' is ignored

血红的双手。 提交于 2019-11-27 18:30:03
问题 How should I respond to this warning? warning: duplicate protocol definition of '...' is ignored My protocol declaration is in its own .h file, and it is #import'ed in a few other files in my project. Well, just in case, here's the entire header file with the protocol declaration: #import <Foundation/Foundation.h> @class Wrapper; @protocol WrapperDelegate @required - (void)wrapper:(Wrapper *)wrapper didRetrieveData:(NSData *)data; @optional - (void)wrapperHasBadCredentials:(Wrapper *)wrapper;

How is LLVM isa<> implemented?

馋奶兔 提交于 2019-11-27 17:53:11
From http://llvm.org/docs/CodingStandards.html#ci_rtti_exceptions LLVM does make extensive use of a hand-rolled form of RTTI that use templates like isa<>, cast<>, and dyn_cast<>. This form of RTTI is opt-in and can be added to any class. It is also substantially more efficient than dynamic_cast<>. How is isa and the others implemented? Matthieu M. First of all, the LLVM system is extremely specific and not at all a drop-in replacement for the RTTI system. Premises For most classes, it is unnecessary to generate RTTI information When it is required, the information only makes sense within a