clang

Why can't this python script find the libclang dll?

自闭症网瘾萝莉.ら 提交于 2019-12-23 22:45:07
问题 I would like to get started with using libclang with Python . I am trying to get a sample code (http://www.altdevblogaday.com/2014/03/05/implementing-a-code-generator-with-libclang/) to work on Windows , here is a part of the code I'm trying to run: #!/usr/bin/python # vim: set fileencoding=utf-8 import sys import os import clang.cindex import itertools ... print("Setting clang path") # I tried multiple variations. Libclang is correctly installed in the specified location. #clang.cindex

Append a copy of std::vector to the end of itself [duplicate]

拟墨画扇 提交于 2019-12-23 20:53:13
问题 This question already has answers here : Nice way to append a vector to itself (4 answers) Closed 5 years ago . I am trying to make a copy of a vector of string and append it to the end of its original vector, i.e. duplicating its contents. Example: Input : vector<string> s = {"abc", "def"} Output: vector<string> s = {"abc", "def", "abc", "def"} I was using the insert method, i.e. s.insert(s.end(), s.begin(), s.end()); However, this exhibits compiler-dependent results. In, LLVM clang, it gave

Qt 5.1 Beta Error using std::atomic c++11 feature

╄→гoц情女王★ 提交于 2019-12-23 20:52:40
问题 I have just started to work with QT and am still getting familiar with the compilation process. Currently, I am trying to port an existing QT project to Mac. This app compiles and runs on Linux and Windows. When I compile the project on Mac OSX 10.8.2 , I am getting this c++11 related error , #include ../xxx/pch.h:71:10: fatal error: 'atomic' file not found #include <atomic> ^ 1 error generated. make[1]: *** [debug/xxx/objective-c++.pch] Error 1 make: *** [debug] Error 2 11:32:01: The process

Can't pass parameters to std::thread?

≯℡__Kan透↙ 提交于 2019-12-23 20:41:33
问题 I'm trying to use std::thread . My thread is supposed to call a method and pass a struct as a parameter, as so many examples show. Except my very simple code won't compile. For the record, I'm aware of this question but nothing there seems to help me. Where I call the thread: void Exporter::save() const { thread(write_to_disk, this->parameter).detach(); } The signature of write_to_disk : void write_to_disk(const Parameter& parameter) write_to_disk is defined in a nameless namespace in the

How to change compilation flags for MyFramework_vers.c in Xcode?

自作多情 提交于 2019-12-23 20:33:10
问题 With Apple Generic Versioning enabled, Xcode autogenerates a MyFramework_vers.c file in the DERIVED_SOURCES_DIR , which contains the version string and number defined as const unsigned char[] and const double . However, with -Wmissing-variable-declarations enabled (part of -Weverything ), this produces the warnings no previous extern declaration for non-static variable 'MyFrameworkVersionString' no previous extern declaration for non-static variable 'MyFrameworkVersionNumber' It seems the

Link problems with libc++abi when linking against libc++ via cmake

吃可爱长大的小学妹 提交于 2019-12-23 20:24:40
问题 I'm trying to build a simple ("hello world") C++ program with LLVM/Clang 3.7.0 built from sources against the toolchain's libc++ , with the command line: clang++ -std=c++14 -stdlib=libc++ -fno-exceptions hello.cpp However, I get the following errors: /usr/bin/ld: warning: libc++abi.so.1, needed by /bulk/workbench/llvm/3.7.0 /toolchain4/bin/../lib/libc++.so, not found (try using -rpath or -rpath-link) /bulk/workbench/llvm/3.7.0/toolchain4/bin/../lib/libc++.so: undefined reference to `__cxa

Benefits of using clang builtins vs standard functions

倾然丶 夕夏残阳落幕 提交于 2019-12-23 18:42:25
问题 Clang and GCC define a bunch of builtin functions I'll use the example of remainder here: __builtin_sqrt(x) However, standard C99 defines the following in math.h sqrt(x) What's the point of clang defining a builtin for a method that already exists? I'd have thought common math functions such as sqrt would be optimised by the backend so doesn't really need a builtin. This builtins are less portable than standard c, for obvious reasons. 回答1: From gcc manual: GCC normally generates special code

Meaning of XCode clang error “not found in architecture i386”

北慕城南 提交于 2019-12-23 18:07:25
问题 I'm not sure what these errors mean or what to do about them. I moved a folder and some files around in Finder, and then added them back to my project. Undefined symbols for architecture i386: "_OBJC_CLASS_$_IASKSettingsReader", referenced from: objc-class-ref in IASKAppSettingsViewController.o "_OBJC_CLASS_$_IASKSettingsStoreUserDefaults", referenced from: objc-class-ref in IASKAppSettingsViewController.o "_OBJC_CLASS_$_IASKSpecifierValuesViewController", referenced from: objc-class-ref in

How to get function definition/signature as a string in Clang?

和自甴很熟 提交于 2019-12-23 18:04:25
问题 How can I get a function's signature (or at least the entire definition?) as a string using Clang/Libclang, assuming I have its CXCursor or so? I think that the definition may be somehow obtainable by using the cursor's extents, but I don't really know how (what function to use). 回答1: You can use this simple code to get prototype of a function ( name, return type, count of arguments and arguments[name,data type]). string Convert(const CXString& s) { string result = clang_getCString(s); clang

@class vs. #import in header compile time saving with Clang?

笑着哭i 提交于 2019-12-23 17:52:10
问题 I have read in a couple of places that it is advisable to use declarations like @class Something in header files and only importing these classes in the .m file to save compile time. Is that really still necessary and makes compiling faster with LLVM Clang or was the compile time advantage only valid for older compilers like (old versions of) GCC? 回答1: @Eimantas is correct about the circular dependencies. It's also for performance. Imagine the case where you import A.h into B.h and B.h into C