clang

Swift and Objective-c framework exposes its internals

独自空忆成欢 提交于 2020-01-02 01:10:15
问题 I’m trying to integrate Swift into an existing objective-c framework that has public, private and project files. In order for swift to access the project files, I added a modulemap that defines a new module (e.g MyFramework_Internal ) by including all the project headers as explained here: http://nsomar.com/project-and-private-headers-in-a-swift-and-objective-c-framework/ That setup is sort of working but one thing I was surprised to see is that now a client can access the internal classes by

Getting fatal error: 'type_traits' file not found #include <type_traits>, while building clang example

对着背影说爱祢 提交于 2020-01-01 18:54:33
问题 I am trying to build the PrintFunctionNames example from clang. However I get the following error: [mac-osx:clang/examples/PrintFunctionNames] osx% clang++ -std=c++0x PrintFunctionNames.cpp In file included from PrintFunctionNames.cpp:15: In file included from /usr/local/include/clang/Frontend/FrontendPluginRegistry.h:13: In file included from /usr/local/include/clang/Frontend/FrontendAction.h:22: In file included from /usr/local/include/clang/Basic/LLVM.h:22: In file included from /usr/local

Getting fatal error: 'type_traits' file not found #include <type_traits>, while building clang example

橙三吉。 提交于 2020-01-01 18:54:32
问题 I am trying to build the PrintFunctionNames example from clang. However I get the following error: [mac-osx:clang/examples/PrintFunctionNames] osx% clang++ -std=c++0x PrintFunctionNames.cpp In file included from PrintFunctionNames.cpp:15: In file included from /usr/local/include/clang/Frontend/FrontendPluginRegistry.h:13: In file included from /usr/local/include/clang/Frontend/FrontendAction.h:22: In file included from /usr/local/include/clang/Basic/LLVM.h:22: In file included from /usr/local

CLang libc, libc++ on Windows with debugging symbols compatible with Visual Studio

老子叫甜甜 提交于 2020-01-01 14:20:18
问题 I'm trying to find info and I don't see it on clang web site. I'm thinking to try to use it on windows, but I have no clue if it has it's own libc or it uses broken libc from MS? another question: if i compile code with clang, will I be able to use visual studio as a debugger, e.g. is clang capable of emitting debugging symbols in MS format (this is the reason I don't want to use gcc; and this is something that intel compiler can do, but it uses MS's libc). In short, I'd like to be able to

Set as default C++11 in Clang

会有一股神秘感。 提交于 2020-01-01 09:59:10
问题 The LLVM C++ compiler has full support for C++11 standard. Is there a way to set C++11 as the default standard without adding -std=c++11 compiler flag every time? I tried setting CCXFLAGS environment variable to -std=c++11 , but with no luck. 回答1: Use clang 6.0.0 or higher. The default C++ dialect is now C++14. http://releases.llvm.org/6.0.1/tools/clang/docs/ReleaseNotes.html#c-language-changes-in-clang 来源: https://stackoverflow.com/questions/21581838/set-as-default-c11-in-clang

How can I find all member field read/writes using Clang?

ぃ、小莉子 提交于 2020-01-01 05:18:09
问题 Given a C++ source code, I want to find the class fields that every function writes and reads. What is the best way of doing this using the Clang frontend? (I'm not asking for a detailed explanation of all the steps; however a starting point for an efficient solution would be great.) So far I tried parsing statements using the RecursiveASTVisitor, but keeping track of node connections is difficult. Also, I cannot figure out how to keep track of something like below: int& x = m_int_field; x++;

What is clang's equivalent to --no-undefined gcc flag?

三世轮回 提交于 2020-01-01 05:03:11
问题 I am trying to build a project on Mac OS X using clang and it fails on linking step with ld: unknown option: --no-undefined , which is meant to built with gcc. What's the clang equivalent for this option? (Please, don't advise to use gcc instead of clang.) Also, a more generic question, is there any resource where one can find some kind of a "mapping" between gcc and clang (linker) options differences? Thank you. 回答1: OS X uses a different linker. As @rubenvb points out, it's probably the one

SIGFPE when accessing unordered_map

本秂侑毒 提交于 2020-01-01 04:49:08
问题 I have an unordered_map<Block, int> with Block being a simple struct defined as follows: struct Block { size_t start; size_t end; bool operator==(const Block& b) const { return start == b.start && end == b.end; } }; namespace std { template<> struct hash<Block> { size_t operator()(const Block& b) const { return b.start; } }; } When trying to access the map, I do get the following error message in gdb (same for both g++ 4.7.1 as well as clang++ 3.1): Program received signal SIGFPE, Arithmetic

Does compiling with -g, in itself, degrade performance? [duplicate]

和自甴很熟 提交于 2020-01-01 04:10:50
问题 This question already has answers here : How do debug symbols affect performance of a Linux executable compiled by GCC? (2 answers) Closed 3 years ago . (This is a question about gcc and clang, but might apply to other compilers.) If I compile my C or C++ code, and generate debug info using the -g switch, does this in itself degrade performance of the compiled program in any way... (1.) With minimum optimization ( -O0 )? (2.) With maximum optimization ( -O3 )? Note: I don't mean the

Proper way to enable SSE4 on a per-function / per-block of code basis?

不打扰是莪最后的温柔 提交于 2020-01-01 03:16:09
问题 For one of my OS X programs, I have a few optimized cases which use SSE4.1 instructions. On SSE3-only machines, the non-optimized branch is ran: // SupportsSSE4_1 returns true on CPUs that support SSE4.1, false otherwise if (SupportsSSE4_1()) { // Code that uses _mm_dp_ps, an SSE4 instruction ... __m128 hDelta = _mm_sub_ps(here128, right128); __m128 vDelta = _mm_sub_ps(here128, down128); hDelta = _mm_sqrt_ss(_mm_dp_ps(hDelta, hDelta, 0x71)); vDelta = _mm_sqrt_ss(_mm_dp_ps(vDelta, vDelta, 0x71