Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser::parse: Inconsistency in documentation or unwanted behavior when file already in index #170

Open
rafzi opened this issue May 31, 2023 · 0 comments

Comments

@rafzi
Copy link

rafzi commented May 31, 2023

  • cppast version: main branch
  • parser: libclang_parser
  • clang version: 16.0.4

simple_file_parser::parse states: \returns The parsed file or an empty optional, if a fatal error occurred.

https://github.com/foonathan/cppast/blob/main/include/cppast/parser.hpp#L110

It does internally call parser::parse, which states: \returns The [cppast::cpp_file]() object describing it. It can be 'nullptr', if there was an error or the specified file already registered in the index.

Therefore, simple_file_parser::parse actually also returns nullptr if the file is already in the index. A user of it will then expect that the parsing failed, when it actually succeeded.

@rafzi rafzi changed the title parser::parse: Inconsistency in documentation or unwanted behavior parser::parse: Inconsistency in documentation or unwanted behavior when file already in index May 31, 2023
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

No branches or pull requests

1 participant