You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
postprocess: include C definitions before and after preprocessing in prompts
Read both forms from the structured *.c_decls.json instead of running a clang subprocess per snippet. The CommentsTransform prompt includes the preprocessed text only when it differs from the original, so prompts (and llm-cache keys) are unchanged for directive-free functions.
Comment gating and response validation use comments from the preprocessed text plus comments on original preprocessor directive lines, so inactive-region comments are not transferred while directive-line comments are not dropped just because clang omits them from directives-only output.
"swap": "void swap(int* a, int* b)\n{\n int t = *a;\n *a = *b;\n *b = t;\n}",
3
-
"quickSort": "void quickSort(int arr[], int low, int high)\n{\n if (low < high) {\n /* pi is the partitioning index; arr[pi] is now at the right place */\n int pi = partition(arr, low, high);\n\n /* Recursively sort elements before and after partition */\n quickSort(arr, low, pi - 1);\n quickSort(arr, pi + 1, high);\n }\n}",
4
-
"partition": "/* \n * Lomuto Partition Scheme:\n * Partitions the array so that elements < pivot are on the left, \n * and elements >= pivot are on the right.\n */\nint partition (int arr[], int low, int high)\n{\n // Partition the subarray around the last element as pivot and return pivot's final index.\n int pivot = arr[high];\n int i = low - 1;\n\n for (int j = low; j <= high - 1; j++) {\n if (arr[j] <= pivot) {\n i++;\n // Move elements <= pivot into the left partition.\n swap(&arr[i], &arr[j]);\n }\n }\n // Place pivot just after the final element of the left partition.\n swap(&arr[i + 1], &arr[high]);\n return i + 1;\n}"
5
-
}
1
+
{"definitions":{"swap":{"definition":"void swap(int* a, int* b)\n{\n int t = *a;\n *a = *b;\n *b = t;\n}","preprocessed_definition":"void swap(int* a, int* b)\n{\n int t = *a;\n *a = *b;\n *b = t;\n}"},"partition":{"definition":"/* \n * Lomuto Partition Scheme:\n * Partitions the array so that elements < pivot are on the left, \n * and elements >= pivot are on the right.\n */\nint partition (int arr[], int low, int high)\n{\n // Partition the subarray around the last element as pivot and return pivot's final index.\n int pivot = arr[high];\n int i = low - 1;\n\n for (int j = low; j <= high - 1; j++) {\n if (arr[j] <= pivot) {\n i++;\n // Move elements <= pivot into the left partition.\n swap(&arr[i], &arr[j]);\n }\n }\n // Place pivot just after the final element of the left partition.\n swap(&arr[i + 1], &arr[high]);\n return i + 1;\n}","preprocessed_definition":"/* \n * Lomuto Partition Scheme:\n * Partitions the array so that elements < pivot are on the left, \n * and elements >= pivot are on the right.\n */\nint partition (int arr[], int low, int high)\n{\n // Partition the subarray around the last element as pivot and return pivot's final index.\n int pivot = arr[high];\n int i = low - 1;\n\n for (int j = low; j <= high - 1; j++) {\n if (arr[j] <= pivot) {\n i++;\n // Move elements <= pivot into the left partition.\n swap(&arr[i], &arr[j]);\n }\n }\n // Place pivot just after the final element of the left partition.\n swap(&arr[i + 1], &arr[high]);\n return i + 1;\n}"},"quickSort":{"definition":"void quickSort(int arr[], int low, int high)\n{\n if (low < high) {\n /* pi is the partitioning index; arr[pi] is now at the right place */\n int pi = partition(arr, low, high);\n\n /* Recursively sort elements before and after partition */\n quickSort(arr, low, pi - 1);\n quickSort(arr, pi + 1, high);\n }\n}","preprocessed_definition":"void quickSort(int arr[], int low, int high)\n{\n if (low < high) {\n /* pi is the partitioning index; arr[pi] is now at the right place */\n int pi = partition(arr, low, high);\n\n /* Recursively sort elements before and after partition */\n quickSort(arr, low, pi - 1);\n quickSort(arr, pi + 1, high);\n }\n}"}}}
0 commit comments