clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
632 stars 110 forks source link

missing `/std:c++latest` for .h file #467

Closed guijiyang closed 1 year ago

guijiyang commented 1 year ago

I set /std:c++latest flag for project, but head file inferred commands missing it, but i try set /std:c++20 which is worked.

cpp file

ASTWorker building file d:\Code\MyProject\cxx\ParalleData\src\main.cpp version 1 with command 
[D:\Code\MyProject\cxx\ParalleData]
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.31.31103\\bin\\Hostx64\\x64\\cl.exe" 
--driver-mode=cl /c /nologo /Zi /FS "/Fdbuild\\windows\\x64\\debug\\compile.ParalleData.pdb"
 /W3 /WX /Od /std:c++latest /EHsc "/IC:\\Users\\guiji\\AppData\\Local\\.xmake\\packages\\g\\gsl\\v4.0.0\\b1ec133f21b342ada9530623a4d0880a\\include"
"/Fobuild\\.objs\\ParalleData\\windows\\x64\\debug\\src\\main.cpp.obj" 
"-resource-dir=C:\\Program Files\\LLVM\\lib\\clang\\14.0.0"
 -- "d:\\Code\\MyProject\\cxx\\ParalleData\\src\\main.cpp"

head file

I[21:41:54.625] ASTWorker building file d:\Code\MyProject\cxx\ParalleData\src\XmmVal.h version 1 with command inferred from src\main.cpp
[D:\Code\MyProject\cxx\ParalleData]
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.31.31103\\bin\\Hostx64\\x64\\cl.exe" 
--driver-mode=cl /c /nologo /Zi /FS "/Fdbuild\\windows\\x64\\debug\\compile.ParalleData.pdb" 
/W3 /WX /Od /EHsc 
"/IC:\\Users\\guiji\\AppData\\Local\\.xmake\\packages\\g\\gsl\\v4.0.0\\b1ec133f21b342ada9530623a4d0880a\\include" 
/TP "-resource-dir=C:\\Program Files\\LLVM\\lib\\clang\\14.0.0" 
-- "d:\\Code\\MyProject\\cxx\\ParalleData\\src\\XmmVal.h"

set with c++20

I[21:44:09.628] ASTWorker building file d:\Code\MyProject\cxx\ParalleData\src\XmmVal.h version 1 with command inferred from src\main.cpp
[D:\Code\MyProject\cxx\ParalleData]
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.31.31103\\bin\\Hostx64\\x64\\cl.exe" 
--driver-mode=cl /c /nologo /Zi /FS "/Fdbuild\\windows\\x64\\debug\\compile.ParalleData.pdb" 
/W3 /WX /Od /EHsc "/IC:\\Users\\guiji\\AppData\\Local\\.xmake\\packages\\g\\gsl\\v4.0.0\\b1ec133f21b342ada9530623a4d0880a\\include" 
/TP /std:c++20 "-resource-dir=C:\\Program Files\\LLVM\\lib\\clang\\14.0.0" 
-- "d:\\Code\\MyProject\\cxx\\ParalleData\\src\\XmmVal.h"

System information

Output of clangd --version: 14.0.0

Editor/LSP plugin: vscode

Operating system: win10

HighCommander4 commented 1 year ago

Duplicate of https://github.com/clangd/clangd/issues/527