草庐IT

CLANG_ARGS

全部标签

c++ - El Capitan 下 Xcode 中的 clang-omp

我喜欢在使用Xcode作为IDE的C++项目中使用openmp。不幸的是,Apple的Clang编译器不支持openmp(seehere),所以我安装了clang-omp.我完全按照该网站上给出的说明在Xcode中使用它,但我收到错误消息can'texec'/usr/local/bin/clang++-omp'(Nosuchfileordirectory)。我尝试通过终端编译他们网站上给出的简单示例,当我通过clang-omp++-fopenmpfile.cpp编译它时,我让它工作了。对我来说,Xcode似乎应该搜索/usr/local/bin/clang-omp++(与/usr/lo

c++ - 为什么 clang 不允许通过实例访问嵌套的枚举类?

考虑以下代码:structS{enumclassEnumClass{one};enumEnum{one};};intmain(){Ss;S::EnumClasse=s.EnumClass::one;//一切都适用于GCC,但clang(既不是3.8也不是3.9)不编译s.EnumClass::one,给出错误:'S::EnumClass::one'is不是“S”类的成员。鉴于无范围枚举工作正常的事实,这似乎是一个错误。 最佳答案 这是gcc1中的错误。相关措辞在[expr.ref]p2:Ineithercase,theid-expr

c++ - 删除的构造函数 - MSVC 报告错误,Clang 没有

考虑以下代码:classSILPassPipelinePlanfinal{public:SILPassPipelinePlan()=default;~SILPassPipelinePlan()=default;SILPassPipelinePlan(constSILPassPipelinePlan&)=default;SILPassPipelinePlan(SILPassPipelinePlan&&)=delete;SILPassPipelinePlanx(){SILPassPipelinePlanP;returnP;}};intmain(){return0;}MSVC报如下错误:1>

c++ - 不支持 clang 3.5 中的 -finline-functions?

我正在使用他们分发的clang3.5。我正在使用以下命令行将其安装在我的travis虚拟机中:sudoapt-add-repository'debhttp://llvm.org/apt/precise/llvm-toolchain-precise-3.5main'sudoapt-add-repository'debhttp://llvm.org/apt/precise/llvm-toolchain-precise-3.5main'当我在启用优化的情况下运行测试构建时,出现此错误:clang:error:optimizationflag'-finline-functions'isnots

c++ - 使用 clang API 处理 C++ 函数以插入代码

我需要预处理一些C++文件以自动插入用于测试和分析的代码,我需要使用clangAPI来完成。现在,我希望能够执行以下操作:如果有函数:intSomeFn(inta,intb,intc){doStuff();}我想预处理它,它看起来像这样:intSomeFn(inta,intb,intc){cout我尝试扩展ASTConsumer并使用方法HandleTopLevelDecl和HandleTopLevelSingleDecl并检查传递的Decls是FunctionDecls并将它们向下转换,这样我就可以得到它们的名称和正文位置。但是我不能那样处理类方法,只能处理全局函数。我在ASTCon

c++ - 在 mac os x 的命令行中将 clang 与 libc++ 和 c++11 结合使用

如果我启用c++11和libc++,我什至无法使用clang编译一个简单的helloworld。比如下面的代码#includeintmain(){std::cout当我运行clang++-std=c++11-stdlib=libc++main.cpp时编译产生以下输出Infileincludedfrommain.cpp:1:Infileincludedfrom/usr/bin/../lib/c++/v1/iostream:38:Infileincludedfrom/usr/bin/../lib/c++/v1/ios:216:Infileincludedfrom/usr/bin/../l

c++ - 多行函数声明参数的 Clang 格式问题

ClangFormat一直在这样做:boolimportSomethingIn(constboost::property_tree::ptree&inBoostTree,intinSomeIndex,std::shared_ptrinSomething,intx,inty);当我希望它这样做时:boolimportSomethingIn(constboost::property_tree::ptree&inBoostTree,intinSomeIndex,std::shared_ptrinSomething,intx,inty);请注意,它在符号inSomething之前添加了换行符和

c++ - 在 Visual C++ 和 clang 中使用 C++11 unordered_set

我正在尝试在跨平台C++应用程序中使用std::unordered_set。它在Windows下的VisualC++中的编译和工作非常好,但在MacOSX下的clang上会产生致命的编译错误。我想知道为什么会发生这种情况,以及使它正常工作的正确方法是什么。示例代码:////Clangbuildcmdline://$clang++./set.cpp-Wall-Werror-Wfatal-errors-std=c++11-stdlib=libc++-oset.out//#include#includestructPoint{intx,y;Point(intx=0,inty=0){this-

c++ - clang -cc1 和系统包括

我有以下文件foo.cpp:#includestructMyClass{std::vectorv;};可以用clang编译成功(我在Ubuntu13.0432bit上用的是clang3.3):clang++-cfoo.cpp现在我要打印AST:clang++-cc1-ast-printfoo.cpp我遇到了以下错误foo.cpp:1:10:fatalerror:'vector'filenotfound#include^structMyClass{};1errorgenerated.看起来clang++-cc1不知道系统包含文件等。我想知道如何为clang++-cc1设置包含?

c++ - llvm-ld 仍然存在于 clang 3.4 吗?

我上次检查clang时它的版本是3.1/3.2,现在我在Ubuntu13.0464位下,我从官方apt存储库安装了clang和llvm(加上工具),但没有任何痕迹llvm-ld-3.4、llvm-ld-3.0和llvm-ld-3.1是我的网站上可用的此工具的仅有的2个版native器,我的问题是:我应该用什么来替换llvm-ld并生成库或机器可执行文件? 最佳答案 llvm-ld不再存在。来自LLVM3.2releasenotes:llvm-ldandllvm-stubhavebeenremoved,llvm-ldfunctiona