(source: string, filePath?: string)
| 1901 | } |
| 1902 | |
| 1903 | function preParseCppSource(source: string, filePath?: string): string { |
| 1904 | const rawStrings = maskCppRawStrings(source); |
| 1905 | source = flattenMidStatementConditionals(rewriteCppAccessMacros(rewriteFoundationEnumMacros(rawStrings.source))); |
| 1906 | // blankCLeadingAttrMacros runs AFTER the api-prefix blank so a stacked |
| 1907 | // `FMT_NORETURN FMT_API void f(…)` reduces to the `MACRO Ret name(` shape |
| 1908 | // it matches (the _API token is already spaces by then). The C++ leading |
| 1909 | // blank runs after the pointer, trailing and declarator ones, so the |
| 1910 | // declaration it looks for (`Type* name(`, `Type name;`) is already free of |
| 1911 | // their macros. |
| 1912 | let blanked = blankLoneMacroLines( |
| 1913 | blankCppLeadingAttributeMacros( |
| 1914 | blankCLeadingAttrMacros( |
| 1915 | blankCppAnnotationMacroCalls( |
| 1916 | blankCppDeclaratorAttributeMacros( |
| 1917 | blankCppTrailingAttributeMacros( |
| 1918 | blankCppPointerAnnotationMacros( |
| 1919 | blankCppInlineAnnotationMacros( |
| 1920 | blankCppApiPrefixMacros(blankCppInlineMacros(blankCppExportMacros(normalizeCppComInterfaces(source)))) |
| 1921 | ) |
| 1922 | ) |
| 1923 | ) |
| 1924 | ) |
| 1925 | ) |
| 1926 | ) |
| 1927 | ) |
| 1928 | ); |
| 1929 | const lower = filePath ? filePath.toLowerCase() : ''; |
| 1930 | if (lower.endsWith('.metal')) { |
| 1931 | blanked = blankMetalAttributes(blanked); |
| 1932 | } else if (lower.endsWith('.cu') || lower.endsWith('.cuh') || looksLikeCudaSource(source)) { |
| 1933 | blanked = blankCudaConstructs(blanked); |
| 1934 | } |
| 1935 | return rawStrings.restore(restoreDirectiveLines(source, blanked)); |
| 1936 | } |
| 1937 | |
| 1938 | /** |
| 1939 | * Blank an unknown attribute macro sitting in front of a C function |
nothing calls this directly
no test coverage detected