MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cmd_static

Function cmd_static

scripts/sanitizer-coverage-map.py:104–143  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

102
103
104def cmd_static(args) -> int:
105 instrumented: dict[str, set[str]] = defaultdict(set)
106 compiled: set[str] = set()
107 for lane, spec in {"asan": LANES["asan"], "tsan": LANES["tsan"]}.items():
108 bdir = f"build/covmap-static-{lane}"
109 for argv in dry_commands(f"{bdir}/{spec['target']}", [f"BUILD_DIR={bdir}"]):
110 flags = " ".join(argv)
111 for a in argv:
112 if a.endswith(SRC_EXT) and os.path.isfile(os.path.join(ROOT, a)):
113 compiled.add(a)
114 if any(f in flags for f in ("-fsanitize=address", "-fsanitize=thread")):
115 instrumented[a].add(lane)
116 uninstrumented = sorted(s for s in compiled if not instrumented.get(s))
117 lint_srcs = set(make_var("LINT_SRCS"))
118 static_skipped = sorted(s for s in compiled if s not in lint_srcs)
119 out = {
120 "translation_units": len(compiled),
121 "not_instrumented_by_any_dynamic_lane": uninstrumented,
122 "not_in_static_lanes": static_skipped,
123 "per_tu": {s: sorted(instrumented.get(s, ())) for s in sorted(compiled)},
124 }
125 if args.json:
126 json.dump(out, sys.stdout, indent=1)
127 print()
128 return 0
129 print(f"translation units in the test builds: {len(compiled)}")
130 print(f" instrumented by ASan+UBSan: {sum(1 for v in instrumented.values() if 'asan' in v)}"
131 f" by TSan: {sum(1 for v in instrumented.values() if 'tsan' in v)}")
132 print()
133 print(f" NOT instrumented by any dynamic lane ({len(uninstrumented)}):")
134 for s in uninstrumented:
135 print(f" {s}{' [vendored]' if is_vendored(s) else ''}")
136 print()
137 print(f" outside the static lanes' source list (cppcheck, clang-analyzer) ({len(static_skipped)}):")
138 vend = [s for s in static_skipped if is_vendored(s)]
139 own = [s for s in static_skipped if not is_vendored(s) and not s.startswith("tests/")]
140 print(f" vendored: {len(vend)} project: {len(own)}")
141 for s in own:
142 print(f" {s}")
143 return 0
144
145
146def find_llvm_tool(name: str, cc: str) -> str:

Callers

nothing calls this directly

Calls 6

setFunction · 0.85
dry_commandsFunction · 0.85
make_varFunction · 0.85
sumFunction · 0.85
is_vendoredFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected