The method only takes PPreprocessor and don't require structures that
might not be available (e.g. Sema and ASTContext) when CodeCompletionString
needs to be generated for macros.
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 20093 Build 20093: arc lint + arc unit
Event Timeline
Could you give a little more context about how this will be used? (where the completion items come from, and when the strings will get built)
include/clang/Sema/CodeCompleteConsumer.h | ||
---|---|---|
921 | please document the new function - particularly why it's different and what's the use case it supports One of the args you're *not* taking here is ASTContext, but if I understand right it must still be alive: this->Macro points into the IdentifierTable which is owned by ASTContext. |
- Addressed review comments.
include/clang/Sema/CodeCompleteConsumer.h | ||
---|---|---|
921 | Done. Added documentation.
ASTContext might not be available during preprocessing. It turned out that ASTContext only holds a reference to the IdentifierTable which is owned by the Preprocessor, so requiring a Preprocessor should be safe. |
please document the new function - particularly why it's different and what's the use case it supports
(if I understand right, it's to allow storing CodeCompletionResult instances for later stringification only when they're for macros - why?)
One of the args you're *not* taking here is ASTContext, but if I understand right it must still be alive: this->Macro points into the IdentifierTable which is owned by ASTContext.
In some sense taking this arg seems like a safety feature!