Closed mkitby closed 5 years ago
ccls is a clang based tool. It reuses the clang preprocessor.
The macro _MSC_VER
will be defined if the target triple is *-msvc
, e.g.
% clang -target x86_64-windows-msvc -dM -E -xc /dev/null | grep _MSC_VER
#define _MSC_VER 1911
The clang command line options are provided by your configuration. Please check https://github.com/MaskRay/ccls/wiki/Debugging#logs how to retrieve the options, mess around with clang -E
commands and find why and where __ICCARM__
is defined (probably a -D__ICCARM__
somewhere in your source files or build system).
I am using the vscode-ccls, here is my configuration,
/* ccls */
"ccls.launch.command": "D:\\ccls\\build\\ccls",
"ccls.highlighting.enabled.types": true,
"ccls.highlighting.enabled.freeStandingFunctions": true,
"ccls.highlighting.enabled.memberFunctions": true,
"ccls.highlighting.enabled.freeStandingVariables": true,
"ccls.highlighting.enabled.memberVariables": true,
"ccls.highlighting.enabled.namespaces": true,
"ccls.highlighting.enabled.macros": true,
"ccls.highlighting.enabled.enums": true,
"ccls.highlighting.enabled.typeAliases": true,
"ccls.highlighting.enabled.enumConstants": true,
"ccls.highlighting.enabled.staticMemberFunctions": true,
"ccls.highlighting.enabled.parameters": true,
"ccls.highlighting.enabled.templateParameters": true,
"ccls.highlighting.enabled.staticMemberVariables": true,
"ccls.highlighting.enabled.globalVariables": true,
Here is the part of the ccls log, but there is no clang command, clang -target? clang -E?
18:37:14 ..\src\messages\initialize.cc:272 I initialize in directory D:/02_PROJ/GWM_V2/gwm_v2_source/cFla with uri file:///D%3A\02_PROJ\GWM_V2\gwm_v2_source\cFla\.
18:37:14 ..\src\messages\initialize.cc:295 I initializationOptions: {"compilationDatabaseCommand":"","compilationDatabaseDirectory":"","cache":{"directory":".ccls-cache","format":"binary","hierarchicalPath":false,"retainInMemory":2},"capabilities":{"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[]},"foldingRangeProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}}},"clang":{"excludeArgs":[],"extraArgs":[],"pathMappings":[],"resourceDir":""},"client":{"diagnosticsRelatedInformation":true,"hierarchicalDocumentSymbolSupport":true,"linkSupport":true,"snippetSupport":true},"codeLens":{"localVariables":true},"completion":{"caseSensitivity":2,"detailedLabel":true,"dropOldRequests":true,"duplicateOptional":true,"filterAndSort":true,"include":{"blacklist":[],"maxPathSize":30,"suffixWhitelist":[".h",".hpp",".hh",".inc"],"whitelist":[]},"maxNum":100},"diagnostics":{"blacklist":[],"onChange":1000,"onOpen":0,"onSave":0,"spellChecking":true,"whitelist":[]},"highlight":{"largeFileSize":2097152,"lsRanges":false,"blacklist":[],"whitelist":[]},"index":{"blacklist":[],"comments":2,"initialNoLinkage":false,"initialBlacklist":[],"initialWhitelist":[],"maxInitializerLines":5,"multiVersion":0,"multiVersionBlacklist":[],"multiVersionWhitelist":[],"name":{"suppressUnwrittenScope":false},"onChange":false,"parametersInDeclarations":true,"threads":0,"trackDependency":2,"whitelist":[]},"request":{"timeout":5000},"session":{"maxNum":10},"workspaceSymbol":{"caseSensitivity":1,"maxNum":1000,"sort":true},"xref":{"maxNum":2000}}
18:37:14 ..\src\messages\initialize.cc:324 I use -resource-dir=D:\llvm+clang-8.0.0-win64-msvc-release\lib\clang\8.0.0
Observed behavior
Macro definition mess up, which causes "go to definition" jumps to a wrong place. From the code Semantic highlighting, _MSC_VER case is highlighted, but this is unexpected. The code is compiled by IAR complier instead of Visual Studio c/c++ compiler. I am not sure if this is client or server issue or just my setting issue.
_MSCVER is defined internally by Visual Studio c/c++ compiler __ICCARM_\ is defined internally by IAR compiler
Expected behavior
__ICCARM__ case is highlighted and go to definition jumps to right place.
System information
git describe --tags
): 0.20190823git describe --tags
): install from vscode marketplace 0.1.26