Also added unit tests for the index library; lit+c-index-test is painful...
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Overall LG, see the major comment about running without the preprocessor.
include/clang/Index/IndexingAction.h | ||
---|---|---|
44 ↗ | (On Diff #165516) | Maybe add a comment or change a name to indicate that this currently only indexes macro definitions? |
53 ↗ | (On Diff #165516) | This does not yet index macro references, maybe keep a mention of this in a comment? |
59 ↗ | (On Diff #165516) | It means we won't have the API to index AST without the preprocessor. We could take a slightly more backwards-compatible approach, add an overload without the preprocessor and assert that the IndexMacrosInPreprocessor option is set to false. |
unittests/Index/IndexTests.cpp | ||
30 ↗ | (On Diff #165516) | Roles and Info are neither tested nor output currently. Consider simplifying the test code by collecting only qual names and using strings everywhere. Feel free to ignore, e.g. if you feel we need this for future revisions. |
36 ↗ | (On Diff #165516) | If we decide to keep Roles and Info, maybe consider outputting them here? |
61 ↗ | (On Diff #165516) | Can this actually happen? It seems weird to have a macro occurrence without a MacroInfo. |
- addressed review comments.
include/clang/Index/IndexingAction.h | ||
---|---|---|
44 ↗ | (On Diff #165516) | Done. Added a comment about this. I think InPreprocessor also indicates this to some extend. |
53 ↗ | (On Diff #165516) | Covered this in the IndexMacrosInPreprocessor option, which seems to be a better place to document this. |
59 ↗ | (On Diff #165516) | yeah, not sure if it's worth the trouble. In theory, a PP should always be available when AST is available (I hope the index library could enforce somehow). And having two overloads with slightly different behaviors seems worse than unknown backward compatibility. |
unittests/Index/IndexTests.cpp | ||
30 ↗ | (On Diff #165516) | Sure. |
61 ↗ | (On Diff #165516) | this can happen for macros that are #undefined. Not relevant anymore. |
LGTM
include/clang/Index/IndexingAction.h | ||
---|---|---|
59 ↗ | (On Diff #165516) | Agreed, let's see if anyone complains instead of assuming backwards-compatibility is a requirement. |
unittests/Index/IndexTests.cpp | ||
61 ↗ | (On Diff #165516) | Ah, makes sense, thanks. |
unittests/Index/IndexTests.cpp | ||
---|---|---|
61 ↗ | (On Diff #165516) | I don't think this is a bug e.g. SemaCodeCompletion can intentionally show undefined macros in some contexts. It's up to the index consumer implementations how to handle undefinitions. |