MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / preParseCSource

Function preParseCSource

src/extraction/languages/c-cpp.ts:2924–2961  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

2922}
2923
2924function preParseCSource(source: string): string {
2925 const rawStrings = maskCppRawStrings(source);
2926 source = rewriteFoundationEnumMacros(rawStrings.source);
2927 const inner = blankCDesignatedMacroArgs(blankCKernelAnnotations(blankCCplusplusGuardBodies(source)));
2928 let blanked = blankCLeadingAttrMacros(
2929 blankLoneMacroLines(
2930 blankCStatementMacroCalls(
2931 blankCTrailingParamAttrMacros(
2932 blankCppAnnotationMacroCalls(
2933 rewriteCPrefixedDeclMacroInitializers(
2934 blankCFileScopePrefixedDeclMacros(
2935 blankCVaArgQualifiedTypeArgs(
2936 blankCTypeKeywordArgs(
2937 blankCParameterizedAnnotationMacros(
2938 blankCAutoInference(blankCSandwichedAnnotations(inner))
2939 )
2940 )
2941 )
2942 )
2943 ),
2944 { keepCReturnTypes: true }
2945 )
2946 )
2947 )
2948 )
2949 );
2950 if (looksLikeCudaSource(blanked)) blanked = blankCudaConstructs(blanked);
2951 // The named-variadic `#define` pass and the conditional-group collapse run
2952 // AFTER the directive restore — they deliberately edit directive lines (see
2953 // their doc comments) — and BEFORE the raw-string restore: both are
2954 // length-preserving, and the collapse must count braces with raw-string
2955 // bodies still masked.
2956 return rawStrings.restore(
2957 blankCUnbalancedConditionalBranches(
2958 blankCNamedVariadicDefineDots(restoreDirectiveLines(source, blanked))
2959 )
2960 );
2961}
2962
2963/** A constructor prototype carries defaults even when its body is in another file. */
2964export function isCppConstructorDeclaration(node: SyntaxNode): boolean {

Callers

nothing calls this directly

Tested by

no test coverage detected