clang

LLVM / Clang 8 Compilation of OpenMP Code in Windows

我怕爱的太早我们不能终老 提交于 2020-04-15 02:57:09
问题 I'm using the Windows version of Clang (LLVM) 8 under Windows. I'm compiling a code which uses OpenMP. Under the lib folder of Clang there are 2 files which are OpenMP related: libomp.lib . libiomp5md.dll . My questions are: When I compile the code I use the flags -Xclang -fopenmp for the compiler. In in GCC and ICC using the flags tell the compiler to link the OpenMP library automatically. What about Clang? Does it do it automatically or must I link with libomp.lib manually? Is there a way

How to set C++ standard in QtCreator with ClangCodeModel plugin?

纵饮孤独 提交于 2020-04-14 07:01:01
问题 Sorry if this is a dumb question, but I have already tried almost everything and am banging my head against a wall right now.. The problem is, QtCreator 4.8.0-beta for Windows with Clang Code Model plugin parses my project as C++98 whereas in fact it is C++17. However specifying the standard version explicitly in the settings dialog is not allowed ("Option "-std=c++17" is invalid"). So, how do I tell ClangCodeModel that it should parse code as C++17? I use CMake for building the project and

How to set C++ standard in QtCreator with ClangCodeModel plugin?

左心房为你撑大大i 提交于 2020-04-14 07:00:32
问题 Sorry if this is a dumb question, but I have already tried almost everything and am banging my head against a wall right now.. The problem is, QtCreator 4.8.0-beta for Windows with Clang Code Model plugin parses my project as C++98 whereas in fact it is C++17. However specifying the standard version explicitly in the settings dialog is not allowed ("Option "-std=c++17" is invalid"). So, how do I tell ClangCodeModel that it should parse code as C++17? I use CMake for building the project and

百度App iOS工程化实践: EasyBox破冰之旅

半腔热情 提交于 2020-04-13 17:32:36
【今日推荐】:为什么一到面试就懵逼!>>> 本文作者:yanxin1563 本文作者: Yunpeng-基础技术 前言 百度App从单一的搜索工具发展到今天以搜索和Feed流为双引擎的综合性内容消费服务平台,其复杂程度已然不可同日而语矣。 作为一个日活过亿的超级App,业务规模庞大,相关技术人员超过千人,客户端支持主流的移动技术,涉及近百业务方,技术形态复杂,各种组件近三百个,代码百万量级,由此带来的工程化问题是技术团队的一个极大挑战。 项目的膨胀导致了很多不起眼的小问题被无限放大,组件管理不规范、编译时间长、工程文件合并冲突、Xcode默认非彻底编译隔离等等问题,导致开发人员在开发环境上耗费了大量时间。目前业界较流行的工具对于大规模工程的支持力度相对较弱,实践起来总是有些掣肘,难以达到理想状态。 EasyBox的诞生,就是致力于为超级App量身打造一套现代、高效、优雅的研发工具链。 这篇文章的主要目的是 站在工具链的角度 上,分享一下我们在实践工程化过程中一些经验。 概述 EasyBox主体由工程组装器(Installer)、多仓库管理工具(MGit)、二进制管理工具(LFS)三部分构成,分别负责工作区的构建(组件依赖分析、工程的生成与组合)、源码仓库的管理以及二进制的管理。EasyBox架构图: 由多仓库管理工具克隆所需仓库源码,由二进制管理工具下载二进制包

Emacs窗口弹出式代码补全之ycmd

拟墨画扇 提交于 2020-04-12 20:06:54
1.下载ycmd server端 # git clone https://github.com/ycm-core/ycmd.git # git submodule update --init --recursive 2.配置支持的语言 # ./build.py --all //支持所有go语言报错,暂时无解 # ./build.py --clang-completer # --java-completer --system-libclang 3.安装emacs需要的插件 M-X package-install RET ycmd company-ycmd flycheck-ycmd 4.配置 ;;YCMD (require 'ycmd) ;;(add-hook 'c++-mode-hook 'company-mode) (add-hook 'c++-mode-hook 'ycmd-mode) ;;下载ycmd的路径 (set-variable 'ycmd-server-command '("python3" "/Users/xxx/github/ycmd")) (set-variable 'ycmd-global-config "/Users/xxx/github/ycmd/.ycm_extra_conf.py") (require 'company-ycmd) (company

technical legality of incompatible pointer assignments

*爱你&永不变心* 提交于 2020-04-12 09:38:29
问题 The C11 standard ISO/IEC 9899:2011 (E) states the following constraints for simple assignments in §6.5.16.1/1: One of the following shall hold: the left operand has atomic, qualified, or unqualified arithmetic type, and the right has arithmetic type; the left operand has an atomic, qualified, or unqualified version of a structure or union type compatible with the type of the right; the left operand has atomic, qualified, or unqualified pointer type, and (considering the type the left operand

clang try catch fails

帅比萌擦擦* 提交于 2020-04-10 07:58:09
问题 Here is the portion of code I speak about. try { std::cerr << "first try" << std::endl; po::store(po::parse_config_file(ifs, _configFileOptions, false), vm); } catch(...) { std::cerr << "second try" << std::endl; } Just for the seek of details , I m using boost program_options to parse a configuration file. An exception is raised by boost since I put an option in the file that is unrecognized. There is a problem with Clang not catching this exception. Basically I only see in the output first

Clang Static Analyzer doesn't find the most basic problems

点点圈 提交于 2020-04-10 07:56:46
问题 I wanted to try out the clang static analyzer. I'm on Windows and built clang with Visual Studio. It seems to work, but at the same time it seems to be extremely useless. I made an example file example.c int main(void) { int h = 0; return 1/h; } Calling scan-build gcc -c example.c finds no error. example.c int main(void) { int h; return 1/h; } Calling scan-build gcc -c example.c finds no error. example.c int main(void) { return 1/0; } Calling scan-build gcc -c example.c finds no error. If

How do I make an infinite empty loop that won't be optimized away?

落花浮王杯 提交于 2020-04-07 11:19:09
问题 The C11 standard appears to imply that iteration statements with constant controlling expressions should not be optimized out. I'm taking my advice from this answer, which specifically quotes section 6.8.5 from the draft standard: An iteration statement whose controlling expression is not a constant expression ... may be assumed by the implementation to terminate. In that answer it mentions that a loop like while(1) ; should not be subject to optimization. So...why does Clang/LLVM optimize

Is it useless to use the `register` keyword with modern compilers, when optimizing?

﹥>﹥吖頭↗ 提交于 2020-04-06 21:50:12
问题 The C register keyword gives the compiler a hint to prefer storing a variable in a register rather than, say, on the stack. A compiler may ignore it if it likes. I understand that it's mostly-useless these days when you compile with optimization turned on, but is it entirely useless? More specifically: For any combination of { gcc, clang, msvc } x { -Og, -O, -O2, -O3 }: Is register ignored when deciding whether to actually assign a register? And if not, are there cases in which it's useful