![](/img/trans.png)
[英]Clang tidy doesn't work properly for static member variable
賞金將在 6 天后到期。 此問題的答案有資格獲得+50聲望賞金。 Danny想提請更多人注意這個問題: 我期待一種可行的方法來使用 clang-tidy 適當地為 static 成員函數添加前綴和后綴,或者對為什么這是不可能的進行合理的解釋。 我正在為我的項目運行 clang-tidy。 以下是 ...
[英]Clang tidy doesn't work properly for static member variable
賞金將在 6 天后到期。 此問題的答案有資格獲得+50聲望賞金。 Danny想提請更多人注意這個問題: 我期待一種可行的方法來使用 clang-tidy 適當地為 static 成員函數添加前綴和后綴,或者對為什么這是不可能的進行合理的解釋。 我正在為我的項目運行 clang-tidy。 以下是 ...
[英]Why does __builtin_constant_p evaluate to false for a constexpr std::string_view argument?
我需要與期望編譯時間 static 字符串的 API 接口。 它通過使用強制執行它們 更具體地說,我在這里指的是Apple Signpost API 。 現在我有一種情況,我想將一個constexpr字符串傳遞給這個接口,但是由於編譯器錯誤而失敗。 歸結為這個簡單的測試用例 Apple Clan ...
[英]Clang link libc++ statically
在 Ubuntu 20.04 我需要使用 libc++,因為默認的 libstdc++ 缺少必需的支持。 為了不必發布 libc++,我需要靜態鏈接到 libc++。 我有一個 static 版本的 libc++ 可用,它是使用以下一系列命令在本地創建的(根據https://libcxx.llvm ...
[英]Confusion (or Clang bug?) about incomplete types in std::vector
[vector.overview]/4 中的 C++20 標准狀態: 如果分配器滿足分配器完整性要求,則在實例化 vector 時可以使用不完整類型 T。 在引用向量的結果特化的任何成員之前,T 應該是完整的。 默認分配器std::allocate確實滿足allocator completene ...
[英]Is it considered normal that -nostdlib does not prevent GCC/Clang to generate calls to C standard library functions?
來自man gcc : 這里我們看到“鏈接時”。 這意味着-nostdlib不會阻止 GCC 生成對 C 標准庫函數的調用。 讓我們檢查: 在這里我們看到 ld 需要memset (因為 GCC 生成了memset )。 因此,盡管用戶程序中沒有memset ,但用戶仍需要提供memset 。 對 ...
[英]Undefined symbols for architecture arm64: clang: error: linker command failed with exit code 1
當我嘗試運行我的 main.cpp 文件時遇到一些問題,僅使用 mac gcc/clang/g++ 編譯器。 這是代碼: 隨機.h 隨機.cpp 工具.h 工具.cpp 主.cpp 它給了我這個結果: vscode 應用此命令來運行代碼: 這是我的項目結構: 在此處輸入圖像描述我已經試過了 ...
[英]Function defined without a prototype sometimes results in conflicting types error
我在 clang(來自 Homebrew 的 AppleClang 1400.0.29.202 和 clang 15.0.7)中遇到了一個奇怪的行為。 假設我有以下代碼: 它使用-DTEST=int編譯,但無法使用-DTEST=char編譯,導致conflicting types for 'bar' ...
[英]invalid ‘static_cast’ from type ‘llvm::MCSection’ to type ‘llvm::MCSectionELF&’
在構建 LLVM 15.0.4 時,我遇到了以下錯誤: 這是我要編譯的代碼。 在這里它給出了無效的 static_cast Rest 的代碼被縮短了。 ...
[英]Use line and column numbers to map a source code variable back to its definition in a structure variable in c
如果我有一個這樣的 c 程序:定義了node_s和list_s結構,並且list_get_first是定義為獲取其第一個元素數據的 function; 假設我可以在運行時獲取list->size: 9:14和list->head->data: 12:13的調試信息。 有沒有一種簡 ...
[英]Unity iOS Build - Wrong XCode Installation, Incorrect Clang Version
為 iOS 構建 Unity 2022.1 項目時出現以下錯誤: 這很奇怪,因為我剛剛將 XCode 更新為 14.2,顯然使用 Clang 14。 ...
[英]On WSL2 Ubuntu doesn't recognize my clang installition from yesterday
我遇到了 clang 的一些奇怪問題。昨天我從官方 clang/LLVM github 存儲庫 - 版本 15.0.6 - 下載了預編譯的二進制文件。 我設法安裝了它 - 解壓縮它,從 tar 中提取,並將整個文件夾復制到 /usr/local/ 並將其添加到 $PATH 變量中 - 當我運行命令 ...
[英]How to uninstall a compiler on mac?
首先,我想檢查我在 mac 上安裝的所有 c++ 編譯器。 我很可能同時擁有 Clang 和 GCC。 所以現在我想刪除 GCC。請告訴我如何做這兩件事。 ...
[英]illegal hardware instruction in clang
這是我的代碼片段(header 文件很簡單,因此不會出現在這里)。#include<string> #include<list> #include<optional> #include<malloc.h> #include "include/comm ...
[英]Mac OS boost installed using macports collision with C++ version
任何人都知道為什么sudo cmake --build./build-clang --config Release結果 盡管設置了環境變量? $CC --version 第一次嘗試為 Mac 構建。 boost 是使用 macports sudo port install boost +unive ...
[英]"Undefined symbols for architechture x86_64" using g++
我正在編譯一個簡單的“Hello world”程序 hw.cpp。 看起來像這樣 我在 OS X 上運行。我使用以下命令編譯: g++ hw.cp但是收到一條錯誤消息: 就這樣一直持續到最后兩行: 什么可能導致此錯誤? 我最感興趣的是了解為什么會這樣。 ...
[英]Windows.h in Clang c++20 modules
我開始使用 c++20 模塊開發我的第一個項目,我選擇 LLVM Clang 作為構建工具集。 問題是,當我嘗試包含 windows.h 文件時,clangs 就像我沒有包含一樣。 (只有當我在同一個翻譯單元中導入時才會發生這種情況)module; #include <windows.h& ...
[英]candidate function not viable: no known conversion from 'LPTSTR' (aka 'char *') to 'const OLECHAR *' (aka 'const wchar_t *')
我不期待改變來源的解決方案。 使 Clang 在不修改的情況下解析 Source。 測試類.cpp 命令運行 Output 詳細 Output: 操作系統:Windows 10 Clang 版本:12.0.0 目標:x86_64-pc-windows-msvc 線程 model:posix 嘗試使 ...
[英]Why one line of code to decline performance 10x?
代碼行 性能下降到 10 倍,我檢查了 ASM 代碼,而不是結果。 為什么這行代碼將性能降低到 10 倍? 這是結果: CPU:Intel(R) Xeon(R) Silver 4210 CPU @ 2.20GHz 這是代碼: ...
[英]Instantiating templates based on a non-template argument works for GCC but not for CLANG
語言律師的一個問題:我的代碼是否格式錯誤並且恰好在 GCC 上工作,或者相反,CLANG 是否與標准不兼容? 使用成員或非類型參數實例化模板時 CLANG 抱怨: error: non-type template argument refers to subobject 我試圖讓編譯器使用帶有 s ...
[英]The reasoning behind clang's implementation of std::function's move semantics
我的問題是如何在libc++的std::function實現中完成移動語義。 我無法理解所做出的設計選擇背后的邏輯。 或者這只是一個錯誤/疏忽? 問題在於一個事實:如果 function object(其類型在std::function內部被擦除)足夠小以適合SBO內部,則對std::functio ...