clang

Is there some literal dictionary or array syntax in Objective-C?

拥有回忆 提交于 2019-12-27 12:20:45
问题 It's always been possible to create NSArrays (and NSDictionaries/NSNumber) with vararg method calls, like: [NSArray arrayWithObjects: @"a", @"b", @"c", nil]; Can these be created with in-line literals in a new improvement to LLVM and Clang? 回答1: With this change to the LLVM codebase, Apple has added a new syntax for literals in upcoming versions of the Clang compiler. Before, arrays were created using a C-based array and were converted on the fly into Objective-C objects, such as: NSArray*

Is there some literal dictionary or array syntax in Objective-C?

耗尽温柔 提交于 2019-12-27 12:18:53
问题 It's always been possible to create NSArrays (and NSDictionaries/NSNumber) with vararg method calls, like: [NSArray arrayWithObjects: @"a", @"b", @"c", nil]; Can these be created with in-line literals in a new improvement to LLVM and Clang? 回答1: With this change to the LLVM codebase, Apple has added a new syntax for literals in upcoming versions of the Clang compiler. Before, arrays were created using a C-based array and were converted on the fly into Objective-C objects, such as: NSArray*

clang static analyzer总结

不羁岁月 提交于 2019-12-26 01:06:37
总结 注:有一段时间没有接触csa,很多东西发生了变化,但本质的东西没有大的变动,这里再回顾一下。这里不会介绍太细节的东西, 搞技术搞的太细节了,会导致自己“过拟合”,从而缺少接受其他知识的泛化的能力 。 我在这里罗列这些东西,对于他人没有什么特别有价值的东西,我能读到的源码,别人也能读到,我能看到的论文,别人也能看到。这些内容唯一的价值是帮助我理思路 从源代码到程序真正运行下面几个阶段都可以做代码分析。 AST IR Binary 程序运行时 而clang static analyzer来说,它处在AST阶段,高层的语义信息都可以保存,例如对于C++来说,在llvm IR阶段lambda表达式本质上就是一个匿名类,在IR层面就脱去了lambda的语义信息,于此对应的一些可以检查的规则就比较难做了。但是后面做有后面做的好处,不需要紧跟语言的特性,处理的场景比较少。到了程序运行时,使用sanitizer等工具能够得到更精确的信息,但是会推出发现bug的时机,同时对程序本身有影响。就像ollvm混淆了代码,但是不可避免带了性能上的倒退。 虽然csa架在AST上,当然还是比clang-tidy层次更低些,clang-tidy就是使用AST matcher匹配一些特定的bug场景,这个类似于semmle QL,只是semmle QL针对多种编程语言,对用户更友好,不像clang

How to properly organize multiple .c and .h files in different directories, so it is includable as <foo.h> elsewhere?

老子叫甜甜 提交于 2019-12-25 18:22:13
问题 I asked this question a while back: How to make C library installable with angle brackets as <mylib.h> on Mac. I am trying to do the same sort of thing, but don't exactly remember all the details / I'm not sure if I'm doing it right. So I have a production example working, but it seems like things aren't organized right (even though it seems to be compiling and running properly). My question is, how can I clean this up and remove some duplication and remove anything unnecessary? So here is my

Undefined symbols for architecture x86_64 in clang

喜你入骨 提交于 2019-12-25 16:55:46
问题 I've checked more or less all the answers to this kind of problem wich seems quite usual when compiling with the new llvm package but I couldn't find any solution. MacBook-Air-di-Manfredo:SINGLE_TETRAMER manfredo$ clang++ -v -Wall -O3 -g -fpic -c -lm grbyinsertion.cpp -I/Users/manfredo/Desktop/tesi/codice_tesi/oxDNA/src/Observables Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix clang: warning: -lm: 'linker' input unused "

vscode 的settings.json

瘦欲@ 提交于 2019-12-25 10:51:18
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> angular { // Format js and ts files on save with `clang-format.executable` // If `clang-format.executable` is not being used, these two settings should be removed otherwise it will break existing formatting. // You can instead run `yarn gulp format` to manually format your code. "[javascript]": { "editor.formatOnSave": true, }, "[typescript]": { "editor.formatOnSave": true, }, // Please install https://marketplace.visualstudio.com/items?itemName=xaver.clang-format to take advantage of `clang-format` in VSCode. // (See https://clang.llvm.org/docs/ClangFormat

How to find move constructors in codebase using Clang AST tools?

旧街凉风 提交于 2019-12-25 07:38:31
问题 Following up a comment from this question: how can I find move constructors in C++ codebase using Clang AST tools? (find definitions / declarations only) 回答1: The Clang AST matcher now provides this functionality with the isMoveConstructor matcher. Here's an example program: #include <iostream> #include "clang/AST/AST.h" #include "clang/ASTMatchers/ASTMatchers.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/SourceLocation.h"

Clang's ASM output vs GCC's

和自甴很熟 提交于 2019-12-25 07:38:27
问题 (I don't know almost anything about assembly language yet). I'm trying to follow this tutorial. The problem is that his compiler, and my test setup (gcc on Linux 32 bit) produces completely different, and significantly less output than my main setup (clang on OSX 64 bit). Here are my outputs for int main() {} gcc on Linux 32 bit $ cat blank.c int main() {} $ gcc -S blank.c $ cat blank.s .file "blank.c" .text .globl main .type main, @function main: .LFB0: .cfi_startproc pushl %ebp .cfi_def_cfa

Xcode clang error when adding SDWebImage framework

只愿长相守 提交于 2019-12-25 07:01:02
问题 I am trying to compile an app that use SDWebImage, when I add the framework to xCode I keep getting the following error. I have attempted to add the framework by clone the git repo ld: framework not found SDWebImage clang: error: linker command failed with exit code 1 (use -v to see invocation) 回答1: Linking in Xcode requires a bit of work. We can tell what to do or suggest a better way. As I consider "dropping framework" solution a very bad habit, I'd strongly suggest a better way: Use

G++ and clang++ incompatibility with standard library when building shared libraries?

强颜欢笑 提交于 2019-12-25 06:37:06
问题 If I have a file clang.cpp containing: #include <map> void myfunc() { std::map<int, int> mymap; const int x = 20; myfoo[x] = 42; } and main.cpp containing: void myfunc(); int main() { myfunc(); } compiling clang++ -g clang.cpp -shared -fPIC -o libclang.so -stdlib=libstdc++ -std=c++11 and clang++ -g main.cpp -L -Wl.,-rpath=. -lclang -lstdc++ -o a.out -stdlib=libstc++ -std=c++11 will run fine. However, if I add gcc.cpp containing: #include <tuple> template std::pair<int const, int>::pair(std: