Header Contexts
What a header means depends on the file that includes it: the macros and declarations that come before the #include. clice compiles a header as part of a file that includes it, its host, so the header reads the way the build sees it; a source the build compiles several ways has a context for each command. The editor shows the active context and can switch to another. Compilation Context explains the design.
Headers That Need Their Includer
A header that compiles only after what its includer declares first works in that includer's context.
Headers that need their includer
A header that uses what its includer declares first still compiles, in the includer's context
ruler.h uses a type and a macro that main.cpp declares before including it, so the header does not compile on its own. clice finds that out and compiles it after what main.cpp declares, so it has no errors and hover works inside it.
Choosing a Host
A header with several includers reads the way the chosen one makes it, and the editor can switch to another.
Choosing a header's host
A header that relies on its includer reads the way the chosen includer makes it
shared.h uses a macro that each source defines before including it. Both sources are contexts of the header: clice picks one, the editor can switch to the other, and hover then shows the type that host gives. The choice is kept across restarts until it is reset.
Code other hosts compile
A header's code that only another host compiles keeps its colors, outline, folds, links and hover
shared.h defines fast_path() when fast_host.cpp includes it and slow_path() when slow_host.cpp does. Shown in the first host's context, the second branch is dimmed as inactive, yet it keeps its semantic colors, its outline entry, its folds and its include link, and hovering slow_path shows its declaration: clice's index holds every context of the header, and while the file is as it was saved, the answers take the other contexts' code from it. Hide other contexts, in the menu switching contexts, shows the first host's context alone.
Included Fragments
A file included in the middle of a declaration, such as a class body or an enumerator list, compiles where it is included.
Class body fragments
A file included inside a class body compiles as part of that class
body.inc holds members that rec.cpp includes between the braces of Record. Opened on its own, it compiles inside the class, so it has no errors, lists its members, and hover and go-to-definition work on them; completion offers the members the class declares after it too.
X-macro lists
A list of macro calls compiles where its includer first expands it
errors.def is an X-macro list: codes.cpp includes it once to declare the enumerators and once to name them. Opened on its own, it compiles inside the enum, so its entries show as enumerators.
Files Built Several Ways
A source the build compiles with several commands has a context for each of them.
Files built several ways
A source the database lists under several commands offers each one as a context
When a build compiles one file more than once, for example once per configuration, every command is a context the editor can switch between, labeled by its flags.
