Also added unit tests for the index library; lit+c-index-test is painful...
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 22649 Build 22649: arc lint + arc unit
Event Timeline
Overall LG, see the major comment about running without the preprocessor.
include/clang/Index/IndexingAction.h | ||
---|---|---|
44 | Maybe add a comment or change a name to indicate that this currently only indexes macro definitions? | |
53 | This does not yet index macro references, maybe keep a mention of this in a comment? | |
59–60 | 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 | ||
31 | 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. | |
37 | If we decide to keep Roles and Info, maybe consider outputting them here? | |
62 | Can this actually happen? It seems weird to have a macro occurrence without a MacroInfo. |
- addressed review comments.
include/clang/Index/IndexingAction.h | ||
---|---|---|
44 | Done. Added a comment about this. I think InPreprocessor also indicates this to some extend. | |
53 | Covered this in the IndexMacrosInPreprocessor option, which seems to be a better place to document this. | |
59–60 | 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 | ||
31 | Sure. | |
62 | this can happen for macros that are #undefined. Not relevant anymore. |
LGTM
include/clang/Index/IndexingAction.h | ||
---|---|---|
59–60 | Agreed, let's see if anyone complains instead of assuming backwards-compatibility is a requirement. | |
unittests/Index/IndexTests.cpp | ||
62 | Ah, makes sense, thanks. |
unittests/Index/IndexTests.cpp | ||
---|---|---|
62 | 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. |
Maybe add a comment or change a name to indicate that this currently only indexes macro definitions?
Macro usages are still only indexed in createIndexingAction.