Expand description
Source-file language classification.
Cabin treats C/C++ as related but distinct source
languages. The build planner consults this module to decide
which compiler driver and which standard to use for each
source file in a library / executable / test / example
target. The same target may carry both .c and .cc sources;
classification is per-file.
This module is data and pure logic only. Filesystem traversal and process spawning live elsewhere.
§Recognized extensions
| Extension | Language |
|---|---|
.c | SourceLanguage::C |
.cc, .cpp, .cxx, .c++, .C | SourceLanguage::Cxx |
Headers (.h, .hh, .hpp) are not classified here — they
are not compiled as standalone translation units. Anything
outside the table above returns None so callers can surface
a clear “unrecognized source extension” diagnostic instead of
silently picking the wrong compiler.
Enums§
- Source
Language - Source-file language as observed by the build planner.
Functions§
- classify_
source - Classify a source file by its filename extension. Returns
Nonewhen the extension is missing or unrecognized — the planner surfaces an explicit diagnostic in that case rather than silently picking a default compiler. - link_
driver_ language - Pick the link-driver language for a target whose objects span the supplied set of source languages.