草庐IT

clang_analyzer

全部标签

C++ clang UBsan 抑制标志名称

使用clang的ubsan运行来自boost版本1.64的gzip.hpp代码会给出以下消息:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp:674:16:runtimeerror:implicitconversionfromtype'int'ofvalue139(32-bit,signed)totype'char'changedthevalueto-117(8-bit,signed)#00x7fed40b77bc2inboost::iostreams::basic_gzip_compressor>::basic

c++ - llvm/clang 自身重新编译

在阅读了这里的许多问题后,我决定试试clang,并在Ubuntu12.04(64位)上安装了svn版本。我原以为会出现问题,但编译顺利,没有任何警告。我注意到当重新运行配置脚本时,如果clang/clang++在你的路径中,它会选择这个而不是gcc/g++来进行自己的编译。用自己重新编译llvm/clang是个好主意吗?我知道这绝对是gcc的标准,但我读到clang的C++实现还不够好(也许这是过时的信息...)。 最佳答案 Clang已经self托管了几年。失去这种能力将是一种严重的倒退。Clang目前对C++的支持相当不错。甚至

c++ - Clang 错误,没有可行的转换

我正面临clang3.1的问题。GCC4.2不会出现此特定问题。以下是发生错误的示例:#include#include#include#includetypedefunsignedshortchar16_t;typedefchar16_tTCHAR;typedefstd::basic_string,std::allocator>wstringT;templateinlinewstringTMyTestFunction(constT&source){std::wstringstreamout;out错误信息指出:Noviableconversionfrom'__string_type'(

C++11,枚举类,g++ 的 undefined reference ,与 clang++ 一起工作

我使用了新的C++11“枚举类”类型,并在使用g++时观察到“undefinedreference”问题。这个问题不会发生在clang++中。我不知道是我做错了什么还是g++错误。重现问题的代码是:(4个文件:enum.hpp、enum.cpp、main.cpp和Makefile)//file:enum.hppenumclassMyEnum{val_1,val_2};templatestructFoo{staticconstMyEnumvalue=MyEnum::val_1;};templatestructFoo{staticconstMyEnumvalue=MyEnum::val_2

c++ - 如何让 Clang 颜色在 boost-bjam 中工作?

b2releaselink=statictoolset=clang有效,但它没有显示我认为在clang的输出中有用的漂亮颜色。 最佳答案 免责声明:这不是解决您问题的答案,但将其放在评论中会占用太多空间。这是一个简短的Holmesian消除过程。一、根据Clangdocumentation,color仅在检测到具有颜色功能的终端时才启用。其次,根据Boost.Jamdocumentation,所有环境变量都会自动导入到其内置的.ENVIRON模块中。最后,您确实有一个支持颜色的终端。然而它不起作用。甚至使用显式Clang命令行参数来

c++ - 如何调用 clang++ 或 g++ 来准确复制两个不同标准版本中的需求

我试图确定N3337§8.5p7(C++11)和N3797§8.5p8(后C++11)之间处理值初始化的差异。N3337§8.5p7:Tovalue-initializeanobjectoftypeTmeans:ifTisa(possiblycv-qualified)classtype(Clause9)withauser-providedconstructor(12.1),thenthedefaultconstructorforTiscalled(andtheinitializationisill-formedifThasnoaccessibledefaultconstructor);

c++ - 将 OSX Clang 配置为对 include 语句区分大小写

我知道C++include语句中区分大小写是一个文件系统问题(相关问题here和here)。是否可以将Clang配置为要求区分大小写的匹配以防止跨平台构建问题? 最佳答案 Clang现在有这些警告标志:-Wnonportable-include-path-Wnonportable-system-include-path第一个用于引用包含,第二个用于尖括号包含。它们甚至可以映射到错误:-Werror=nonportable-include-path-Werror=nonportable-system-include-path据推测,默

clang 中的 C++ 结构内存开销?

clang中是否存在每个结构的内存开销?通常结构的大小只是其所有成员的总大小。但是在clang中似乎不是这样:#includeusingnamespacestd;structObj{intx;inty;};intmain(){inta=42;intb=43;Objobj={100,101};intc=44;cout我用clang++program.cpp编译,没有优化。版本:Ubuntuclangversion3.4-1ubuntu3(tags/RELEASE_34/final)(basedonLLVM3.4)Target:x86_64-pc-linux-gnuThreadmodel:

c++ - 是否有可能从 gcc 或 clang 获得 Lexer 输出?

是否可以让clang或gcc显示词法分析阶段的结果? 最佳答案 虽然解析器doespollthelexer如果没有适当的“词法分析阶段”,这并不意味着您不能在词法分析时转储token。这是通过命令完成的:clang-fsyntax-only-Xclang-dump-tokenscode.c 关于c++-是否有可能从gcc或clang获得Lexer输出?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/

c++ - clang/g++ 与私有(private)继承和使用声明的区别

考虑以下代码:#includestructParams{};templatestructBase{intdata()const{return42;}};templateclassD,classP>structMiddle:privateD//mustbe'public'forg++{};structFinal:publicMiddle{usingBase::data;};intmain(){Finalf;std::cout此代码编译成功并打印42clang并在gcc上给我编译时错误'intBase::data()const[withT=Params]'isinaccessible在这种