Skip to content

Conversation

@kodemeister
Copy link
Contributor

@kodemeister kodemeister commented Jul 20, 2019

Hi @chpatrick,

This PR adds two new functions createIndexWithOptions and parseTranslationUnitWithOptions that support all arguments of libclang's clang_createIndex and clang_parseTranslationUnit2. Now you can write something like this:

let code = "int main(int argc, char **argv) { return 0; }"
idx <- createIndexWithOptions [DisplayDiagnostics]
tu <- parseTranslationUnitWithOptions idx "main.cpp" ["-Wall"] [("main.cpp", code)] [SkipFunctionBodies]

These additional options are useful to fine-tune Clang parser and process in-memory files.

I kept existing functions createIndex and parseTranslationUnit for backward compatibility but implemented them as shortcuts to createIndexWithOptions and parseTranslationUnitWithOptions.

Thanks in advance!


This change is Reviewable

@chpatrick
Copy link
Owner

Thank you!

@chpatrick chpatrick merged commit 8f337da into chpatrick:master Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants