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

Function preParseCSource

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Tested by

no test coverage detected