Add C and C++ extraction coverage#34
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f062e739f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| c: [/^\s*#\s*include\s+[<"]([^>"]+)[>"]/gm], | ||
| cpp: [/^\s*#\s*include\s+[<"]([^>"]+)[>"]/gm, /^\s*import\s+([A-Za-z_][\w.:]*)\s*;/gm] |
There was a problem hiding this comment.
Preserve quoted includes for local resolution
When a local C/C++ header is included with the normal quoted form (#include "orders.h"), this regex returns only orders.h and loses that it was quoted. buildResolvedImportEdges then passes the bare specifier to resolveImportFile, which only performs same-directory relative resolution for specifiers starting with ., so common local headers in the same folder are left as external-only imports and never produce IMPORTS_FILE edges. This breaks the new include graph for the typical non-./ quoted include case.
Useful? React with 👍 / 👎.
| if (["swift", "kotlin", "cpp"].includes(symbol.language) || ["struct", "enum", "protocol", "actor"].includes(symbol.kind)) { | ||
| const colonConformance = /\b(?:class|struct|enum|actor|protocol)\s+[A-Za-z_]\w*(?:<[^>{}]+>)?\s*:\s*([^{}]+)/.exec(compact); | ||
| if (colonConformance?.[1]) { | ||
| relations.push({ targets: typeNamesFromList(colonConformance[1]), reason: "colon inheritance or conformance" }); |
There was a problem hiding this comment.
Handle C++ qualified base classes
For C++ inheritance like class Derived : public ns::Base, this new path feeds ns::Base into typeNamesFromList, but that helper only understands dotted qualifiers and captures ns instead of Base; resolveTypeSymbol then cannot find the extracted Base class, so no INHERITS edge is emitted. Namespaced base classes are common in C++, so the newly advertised colon-inheritance extraction silently misses those relationships.
Useful? React with 👍 / 👎.
Signed-off-by: Mir Sameer <mirsameer0304@gmail.com>
|
CodeQL follow-up pushed in
Validation after the fix:
|
Summary
#includeimports, C macros, structs, enums, functions, C++ namespaces/classes, and C++ colon inheritance edges.Validation
npm run verifynpm run test:skip-gatenpm run package:checknpm run audit:prod-> 0 vulnerabilitiesnpm pack --dry-run