Setting up cpptools's intelligence to work with LLVM repository #10622
Replies: 4 comments 20 replies
-
We've configured LLVM in the past, but not with CMake presets. This sounds like it might be a CMake Tools configuration provider issue. If you run the C/C++: Log Diagnostics for the file with squiggles, do you see a custom configuration provided for the source file? |
Beta Was this translation helpful? Give feedback.
-
To give some more context:
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}",
"${workspaceFolder}/**",
"${workspaceFolder}/libcxx/include",
"${workspaceFolder}/libcxx/include/**",
"${workspaceFolder}/libcxx/test/support",
"${workspaceFolder}/libcxx/test/support/**",
"/Users/hristohristov/Projects/LLVM/llvm-project/libcxx/include/**",
"/Users/hristohristov/Projects/LLVM/llvm-project/libcxx/test/**",
"/Users/hristohristov/Projects/LLVM/llvm-project/libcxx/test/support",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1",
"${workspaceFolder}/build/default.debug.libcxx/include/c++/v1"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++23",
"intelliSenseMode": "macos-clang-arm64",
"compileCommands": "${workspaceFolder}/build/default.debug.libcxx/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
{
"cmake.sourceDirectory": "${workspaceFolder}/runtimes",
"files.autoSave": "afterDelay",
"files.associations": {
"deque": "cpp",
"filesystem": "cpp",
"__bit_reference": "cpp",
"__bits": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__std_stream": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"barrier": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"exception": "cpp",
"format": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"random": "cpp",
"ranges": "cpp",
"ratio": "cpp",
"regex": "cpp",
"set": "cpp",
"span": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"string_view": "cpp",
"strstream": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"valarray": "cpp",
"variant": "cpp",
"vector": "cpp",
"algorithm": "cpp",
"*.ipp": "cpp"
}
}
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 1
},
"configurePresets": [
{
"name": "default",
"displayName": "Default Config",
"description": "Default build using Ninja generator",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceParentDir}/build/${presetName}"
},
{
"name": "default.debug.libcxx",
"displayName": "Debug libc++ ",
"description": "libc++ debug configuration",
"inherits": [
"default"
],
"cacheVariables": {
"LLVM_ENABLE_RUNTIMES": {
"type": "STRING",
"value": "libcxx;libcxxabi;libunwind"
},
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "ON"
}
}
}
],
"buildPresets": [
{
"name": "default",
"configurePreset": "default.debug.libcxx"
}
]
} With VSCode I open the project's root folder. |
Beta Was this translation helpful? Give feedback.
-
@sean-mcmanus I'd like to setup VSCode to enable C++23 mode for IntelliSense in the sources. The above settings don't work, specifically: "cppStandard": "c++23", I still see any code surrounded by version guards as greyed out: #if _LIBCPP_STD_VER >= 23 Is there a way to force IntelliSense to define certain macros and values? What would be the recommended approach? It will be very convenient if I can switch between different language versions on the fly to inspect the code or at least to be able to set the latest version for everything to show up and not be greyed out. |
Beta Was this translation helpful? Give feedback.
-
I just want to let you know that I am using the latest preview. The active code is still grayed out and nothing really changed. Also Intellisense seems to pick up all available names and displays them even if the hovered over one is declared in the same file. The long story short: LLVM setup doesn't quite work for me yet. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to setup VSCode to work with the LLVM.
I managed to setup a CMake preset in
<llvm_root>/runtimes
and I am able to compilelibcxx
. I want to make IntelliSense work at least to get the ability to ctrl+click on includes/headers, etc but all I get is red squiggles on includes.I added "proper" paths, then I started adding paths randomly but I cannot get it to work:
Am I doing something wrong? Is it possible to get InteliSense to work in that context? The unit tests *.cpp's are apparently not part of the CMake file and are not compiled by it.
Beta Was this translation helpful? Give feedback.
All reactions