Skip to main content

Module source_language

Module source_language 

Source
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

ExtensionLanguage
.cSourceLanguage::C
.cc, .cpp, .cxx, .c++, .CSourceLanguage::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§

SourceLanguage
Source-file language as observed by the build planner.

Functions§

classify_source
Classify a source file by its filename extension. Returns None when 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.