Enhance data stored for macros and macro uses.

In preparation for finding macro uses.

* Macro: add offset and length
* MacroUse: add line
* Document: add convenience functions for finding a macro definition, use
  or undefined use at a given location.

Reviewed-by: Erik Verbruggen
This commit is contained in:
Christian Kamm
2009-12-21 14:47:22 +01:00
parent 6c27faf0fc
commit c3cc7cf4d8
7 changed files with 72 additions and 17 deletions

View File

@@ -1205,6 +1205,8 @@ void Preprocessor::processDefine(TokenIterator firstToken, TokenIterator lastTok
macro.setFileName(env->currentFile);
macro.setLine(env->currentLine);
macro.setName(tokenText(*tk));
macro.setOffset(firstToken->offset);
macro.setLength(endOfToken(lastToken[- 1]) - startOfToken(*firstToken));
++tk; // skip T_IDENTIFIER
if (tk->is(T_LPAREN) && ! tk->f.whitespace) {