apple / swift-llbuild
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 8,587 units with 62,996 lines of code in units (46.3% of code).
    • 13 very complex units (2,308 lines of code)
    • 28 complex units (2,383 lines of code)
    • 173 medium complex units (8,447 lines of code)
    • 385 simple units (9,347 lines of code)
    • 7,988 very simple units (40,511 lines of code)
3% | 3% | 13% | 14% | 64%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
cpp7% | 7% | 21% | 17% | 45%
inc0% | 2% | 20% | 24% | 51%
cc0% | 0% | 14% | 17% | 67%
py0% | 0% | 41% | 13% | 44%
h0% | 0% | 1% | 9% | 89%
c0% | 0% | 0% | 60% | 39%
swift0% | 0% | 0% | 3% | 96%
mm0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
lib5% | 5% | 17% | 17% | 53%
utils0% | 1% | 10% | 13% | 74%
products0% | 0% | 7% | 12% | 80%
include0% | 0% | 1% | 9% | 89%
unittests0% | 0% | 2% | 0% | 97%
perftests0% | 0% | 0% | 0% | 100%
experimental0% | 0% | 0% | 0% | 100%
bindings0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
int llvm::sys::unicode::foldCharSimple()
in lib/llvm/Support/UnicodeCaseFold.cpp
541 283 1
int commands::executeNinjaBuildCommand()
in lib/Commands/NinjaBuildCommand.cpp
474 111 1
bool sys::getHostCPUFeatures()
in lib/llvm/Support/Host.cpp
98 88 1
static void getAvailableFeatures()
in lib/llvm/Support/Host.cpp
91 77 5
bool CommandLineParser::ParseCommandLineOptions()
in lib/llvm/Support/CommandLine.cpp
232 76 4
66 55 1
bool Scanner::fetchMoreTokens()
in lib/llvm/Support/YAMLParser.cpp
66 54 0
std::string Triple::normalize()
in lib/llvm/Support/Triple.cpp
137 53 1
void llbuild::basic::spawnProcess()
in lib/Basic/Subprocess.cpp
367 52 9
StringRef Triple::getArchTypeName()
in lib/llvm/Support/Triple.cpp
56 52 1
static unsigned getArchPointerBitWidth()
in lib/llvm/Support/Triple.cpp
60 52 1
Triple Triple::get32BitArchVariant()
in lib/llvm/Support/Triple.cpp
60 52 0
Triple Triple::get64BitArchVariant()
in lib/llvm/Support/Triple.cpp
60 52 0
StringRef Triple::getArchTypePrefix()
in lib/llvm/Support/Triple.cpp
51 46 1
void IEEEFloat::toString()
in lib/llvm/Support/APFloat.cpp
138 45 4
StringRef ScalarNode::unescapeDoubleQuoted()
in lib/llvm/Support/YAMLParser.cpp
126 41 3
Triple Triple::getBigEndianArchVariant()
in lib/llvm/Support/Triple.cpp
49 39 0
bool executeTasks()
in lib/Core/BuildEngine.cpp
188 38 1
void SMDiagnostic::print()
in lib/llvm/Support/SourceMgr.cpp
107 37 4
bool Triple::isLittleEndian()
in lib/llvm/Support/Triple.cpp
43 37 0