2008/8/15 Ian Lance Taylor <[EMAIL PROTECTED]>: >> >> BTW, Clang takes into account both locations when printing diagnostics. > > Perhaps I misunderstand what you mean by recording the location in the > preprocessed token stream. You evidently do not mean getting column > numbers for the preprocessed code. You mean that when a preprocessor > macro is expanded, we should record both the location where the macro > is used, and also some sort of reference to the macro so that we know > the location where the macro was defined. Is that right? >
I don't see the difference. We do currently assign to the preprocessed code the location of the macro call. So we get column numbers to the preprocessed code. In addition, we should record the location were the macro was defined. In the previous example, we should be able to obtain somehow two locations for 0x1b27da572ef3cd86ULL, one for its position in header.h and another for its final position in file.c. Whether we record two locations explicitly or we keep some lookup table of macro expansions/definitions would depend on what is found to be the most efficient implementation. I don't know which approach Clang follows but in our case it would be better to use the mapped-location infrastructure to track this for us in a single source_location number. Cheers, Manuel.