草庐IT

CLANG_ENABLE_MODULE_DEBUGGING

全部标签

c++ - std::enable_if 不能用于禁用此声明

我有一段相当复杂的代码,我将其简化为这个复制器:#include#includetemplatestructouter{templatestructinner{templatestructproblem;usingTA=std::tuple;usingTB=std::tuple;templatestructproblem::value::value>::type>{staticconstexprautoval(){return1;}//actuallyacomplexfunction};templatestructproblem::value>=std::tuple_size::val

c++ - MinGW-Clang 的 libgcc_s_dw2-1.dll 丢失了吗?

当我尝试运行rubenvb'sClang3.2时,我得到:Theprogramcan'tstartbecauselibgcc_s_dw2-1.dllismissingfromyourcomputer.Tryreinstallingtheprogramtofixthisproblem.我在任何地方都找不到DLL...我缺少什么包/我该如何解决这个问题? 最佳答案 您还需要下载一个gcc包,Clang的构建没有C++库或任何东西。它的意思是与gcc包结合使用。来自here:HereyouwillfindthelatestClangcom

c++ - 从 clang 中的 FunctionDecl 类获取参数信息

如何从clang中的FunctionDecl类获取参数信息作为字符串。我正在尝试,但对这么多的继承感到困惑。他们的编译器还说getReturnType()不是FunctionDecl的成员,但doxygen文档另有说明。请帮忙。http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.htmlusingnamespacestd;usingnamespaceclang;usingnamespaceclang::driver;usingnamespaceclang::tooling;usingnamespacellvm;.......

c++ - 获取 Clang 中变量的大小

使用Clang库,是否有一些可用的方法来获取变量的大小(就像我在常规C/C++程序中使用sizeof()一样?我能够(这就是我想做的)发现VarDecl,但目前我仍然无法在Clang命名空间中找到任何方法来获取我的var的大小发现了当前的VarDecl 最佳答案 类型的大小信息存储在与给定类型关联的TypeInfo中。您可以通过getTypeInfo函数从ASTContext中获取对应的FieldInfo对。该对的第一个元素是类型的大小(以位为单位)。第二个元素是以位为单位的类型对齐。boolVisitVarDecl(VarDecl

c++ - 在 clang 中循环展开

我正在尝试有选择地展开以下程序中的第二个循环:#includeintmain(){intin[1000],out[1000];inti,j;#pragmanounrollfor(i=100;i当我使用以下选项运行clang(3.5)时,它会展开两个循环4次。clang-std=c++11-O3-fno-slp-vectorize-fno-vectorize-mllvm-unroll-count=4-mllvm-debug-pass=Arguments-emit-llvm-c*.cpp我做错了什么?此外,如果我添加-fno-unroll-loops,或跳过-unroll-count=4标

c++ - enable_if 和互斥方法

我不明白为什么下面的代码不起作用。编译器(gcc)似乎同时实例化了两者方法,显然整数是有符号或无符号的,所以总是失败。我虽然enable_if在这里是为了避免这种情况。问:为什么编译出错,如何避免?usingnamespaceboost;//orstdasyouwanttemplatestructtest{//ifsignedtemplate,int>::type=0>test&operator,int>::type=0>test&operatorx;xetc.testy;yetc.} 最佳答案 SFINAE仅适用于immediat

c++ - 构建 Clang 时未知包 libcxx 和 libcxxabi?

我正在尝试使用来自源代码的libc++构建Clang。我试图在树外将libc++与其他组件构建在一起。我使用的食谱如下。如果我只是将libcxx和libcxxabi放在树中,那么配置不会将它们拾取,而且它们不是自动构建的。我根据LLVM'slibc++StandardLibrary将它们放在llvm/projects中.此外,将makecxx添加到配方中并不像LLVM'slibc++StandardLibrary上宣传的那样有效页。结果是:llvm[0]:ConstructingLLVMBuildprojectinformation.make:***Noruletomaketarget

c++ - 我在这里做错了什么?或者这是一个 clang++ 错误?

以下代码无法在我的Mac上编译#include#includetemplateusingVector=std::array;templateTdot(constVector&l,constVector&r){Tresult{0};for(autoi=0;i;intmain(intargc,constchar*argv[]){Vector3fu{1.0f,2.0f,3.0f};Vector3fv{6.0f,5.0f,4.0f};std::cout这是我从终端编译的方式:clang++-std=c++11-stdlib=libc++repro.cpp-orepro这是我得到的错误:repr

c++ - enable_if 只有 C++11 吗?

在C++引用网站上查找enable_if,据说它只是C++11的一个特性。但是,我在C++98类型上使用GCC编译器编译了我自己的enable_if版本,它运行良好并且似乎能够用于任何版本的C++(打印1):#includenamespaceegg{templatestructenable_if{};templatestructenable_if{typedefTtype;};}intmain(){egg::enable_if::typex=1;std::cout我说的enable_if是任何C++版本的一个有效功能,但只是引入到C++标准中,或者还有其他原因吗?

c++ - 使用 enable_if 重载函数时出错

我有这段代码,其中一个函数根据可用的成员有不同的实现:#includetemplatestructD{structinner{Tfirst;};};templatestructD{usinginner=std::vector;};templateclassC{usingB=D;typenameB::innerb;public:typenamestd::enable_if().first),T>::value,T>::typefirst(){returnb.first;}typenamestd::enable_if()[0]),T>::value,T>::typefirst(){retu