https://github.com/MaskRay/ccls/blob/master/src/main.cc#L90 is not
relyable because `1` and `2` are out of range of `enum Verbosity`.
According to CWG 1766:
> A value of integral or enumeration type can be explicitly converted to an enumeration type. The value is unchanged if the original value is within the range of the enumeration values (10.2 [dcl.enum]). Otherwise, the resulting value is unspecified (and might not be in that range) behavior is undefined.
so, stuff like LOG_V(1) and LOG_V(2) are UB. The solution is either:
Message(Verbosity verbosity, const char* file, int line); -> Message(int verbosity, const char* file, int line);
or
```c++
enum Verbosity {
Verbosity_FATAL = -3,
Verbosity_ERROR = -2,
Verbosity_WARNING = -1,
Verbosity_INFO = 0,
// more level...
};
```
IMO the latter is better option.
This pr also replace macros inside log.hh with short functions and
replace `enum Verbosity` with `enum class Verbosity`
* In the "initialized" callback, send client/registerCapability with DidChangeWatchedFilesRegistrationOptions
* In workspace/didChangeWatchedFiles callback, call pipeline::Index
* In pipeline::Index, add a `deleted` status
Delete method.{cc,h}
Rename $ccls/setSkippedRanges to $ccls/publishSkippedRanges
Rename $ccls/publishSemanticHighlighting to $ccls/publishSemanticHighlight; stableId -> id
Move using below #include to make preamble happy
textDocument/references: if no references, first line or last line => list where this file is included
malloc_trim() only if files have been indexed in last cycle
Intern: use CachedHashStringRef
* Make CXXConstructor span one more column to left/right
* Use OrigD to collect Decl::Record members
* Better comment parsing
* Limit lines of initializers and macro definition to 3
* Attribute macro arg uses to spelling loc
* Remove FuncDef::declaring_type
Constructors and destructors are also included in declarations. But this is not necessarily bad, as textDocument/definition on class spelling names can jump to constructors as well as declarations.
If I replace all the important constructors used in query.cc, there will be a weird issue that strings following "Applying index update for " are empty.