llvm-clang

tgmath.h doesn't work if modules are enabled

好久不见. 提交于 2019-11-29 19:47:43
I looked into using tgmath.h to deal with the CGFloat typedef float/double mess when dealing with arm64. This answer has a pretty good description of how to use it, except that it didn't work at all for me. No matter what, my code was still calling the math.h functions. After spending some time looking at all of the project compiler settings, I found that disabling the "Modules" feature ( @import vs #import - iOS 7 ) makes it all work. More specifically, the option in the project settings is called Enable Modules(C and Objective-C) in the Apple LLVM 5.1 - Language - Modules dropdown. To see a

Application crashes if a property name starts with new

廉价感情. 提交于 2019-11-29 15:22:10
问题 In my project I'm using coredata. One of the entity has an attribute named newTotal , in its corresponding NSManagedObject class the property declaration is like @property (nonatomic, strong) NSString *newTotal; If I add a property like this in an NSObject subclass the XCode will show an error like error: property's synthesized getter follows Cocoa naming convention for returning 'owned' objects But in NSManaged object subclasses it's not showing the error but the application crashes when the

No type named 'unique_ptr' in namespace 'std' when compiling under LLVM/Clang

一曲冷凌霜 提交于 2019-11-29 08:37:40
I'm catching a compile error when attempting to use unique_ptr on Apple platforms with -std=c++11 : $ make c++ -std=c++11 -DNDEBUG -g2 -O3 -fPIC -march=native -Wall -Wextra -pipe -c 3way.cpp In file included ... ./smartptr.h:23:27: error: no type named 'unique_ptr' in namespace 'std' using auto_ptr = std::unique_ptr<T>; ~~~~~^ ./smartptr.h:23:37: error: expected ';' after alias declaration using auto_ptr = std::unique_ptr<T>; According to Marshall Clow, who I consider an expert on the C++ Standard Library with Clang and Apple : Technical Report #1 (TR1) was a set of library additions to the C+

Adding a function call in my IR code in llvm

岁酱吖の 提交于 2019-11-28 22:34:23
问题 Can you give me an example ,how to add a simple call of a function foo(x); on my IR code with my pass in llvm? 回答1: A simple way is to learn is to use ELLCC with Output Options as LLVM C++ API Code . Two key notes: Make sure foo 's definition is available; otherwise you need to define it firstly. Typically you need to get the prototype by using getOrInsertFunction and then use IRBuilder to insert the body for the function. Create the CallInst , an easy way is to use CallInst*IRBuilder:

Compile protobuf with xCode 5

人走茶凉 提交于 2019-11-28 22:05:00
I want to use protobuf( https://code.google.com/p/protobuf/ ) in my project Did you successfully compile protobuf with xCode 5, Please help to share your experience? Thanks. If you don't mind building Google Protobuf yourself then a good alternative to using Cocoapods is to run the bash script here. https://gist.github.com/BennettSmith/7150245 This script will produce a proper build of Google Protobuf that supports the i386, armv7, armv7s, arm64 and x86_64 architectures. It will produce a static library that is universal. It will also produce the protoc compiler for use on OS X. You can add

Get Apple clang version and corresponding upstream LLVM version

柔情痞子 提交于 2019-11-28 21:00:25
I want to understand which version of clang Apple installed in my macbook, to see with c++11 and/or c++14 features are available. I typed this command: clang --version //----response Apple LLVM version 7.0.0 (clang-700.1.76) Target: x86_64-apple-darwin15.0.0 Thread model: posix But I am not able to understand what (clang-700.1.76) mean. How can I convert this code to a clang version? This is the site where you could check c++ features available in clang version http://clang.llvm.org/cxx_status.html Daniel Frey The (Apple) version number of the compiler is mostly useless, since you also need to

tgmath.h doesn't work if modules are enabled

▼魔方 西西 提交于 2019-11-28 16:17:19
问题 I looked into using tgmath.h to deal with the CGFloat typedef float/double mess when dealing with arm64. This answer has a pretty good description of how to use it, except that it didn't work at all for me. No matter what, my code was still calling the math.h functions. After spending some time looking at all of the project compiler settings, I found that disabling the "Modules" feature (@import vs #import - iOS 7) makes it all work. More specifically, the option in the project settings is

Objective-C naming conventions with ARC and possible caveats

為{幸葍}努か 提交于 2019-11-28 11:14:42
I have experience with pure ARC coding. As a compiler feature it honors Objctive-C method family putting right retain/release calls whenever neeeded. All methods that start with alloc , mutableCopy , copy and new create a new object. They increase the retain count. As a consequence, ARC will release any pointer (and hence the object associated with it) when I no longer need it. I think that problems could arise when I write methods that do not follow naming conventions. For example, if I write a method like newCustomer that in a first version returns an autoreleased object while in a second

Integrate LLVM Clang 4.x.x / 5.x.x / 6.x.x into Visual Studio 2017

徘徊边缘 提交于 2019-11-28 04:47:41
The official LLVM 4.0 build for Windows integrates with Visual Studio up to Visual Studio 2015. Unfortunately it still doesn't support Visual Studio 2017. When you try to set the Platform Toolset of a project to LLVM-vs2014 , it pops up an error. Do you know any way to make it work? Update In 2018, LLVM 6.0 officially still doesn't support integration with Visual Studio 2017 (version 15.X.X), only with the Visual Studio 2015 (version 14.X.X) toolset. It requires some msbuild targets that only ship with the C++ v140 toolset, and VS 2017 only installs the v141 toolset by default. If you open the

Clang doesn't see basic headers

拟墨画扇 提交于 2019-11-27 21:00:34
I've tried to compile simple hello world on Fedora 20 with Clang, and I get the following output: d.cpp:1:10: fatal error: 'iostream' file not found #include <iostream> I don't have any idea how to resolve it. user4823890 Point 3 solved the problem for me. 1. Had the same issue, fedora 21::clang 3.5.0: clang++ -std=c++14 -pedantic -Wall test_01.cpp -o test_01 -v 2. ignoring nonexistent directory "/usr/lib/gcc/i686-redhat-linux/4.9.2/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/bin/../lib/clang/3.5.0/include /usr/include End of search