On Sep 8, 2011, at 1:57 PM, Bill Wendling wrote: > On Sep 8, 2011, at 10:15 AM, Eric Christopher wrote: > >> Author: echristo >> Date: Thu Sep 8 12:15:01 2011 >> New Revision: 139295 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=139295&view=rev >> Log: >> Add a block comment explaining how the different source locations work >> including some source examples. >> >> Modified: >> cfe/trunk/include/clang/Basic/SourceManager.h >> >> Modified: cfe/trunk/include/clang/Basic/SourceManager.h >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=139295&r1=139294&r2=139295&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/Basic/SourceManager.h (original) >> +++ cfe/trunk/include/clang/Basic/SourceManager.h Thu Sep 8 12:15:01 2011 >> @@ -38,6 +38,22 @@ >> class ASTWriter; >> class ASTReader; >> >> +/// There are three different types of locations in a file: a spelling >> +/// location, an expansion location, and a presumed location. >> +/// >> +/// Given an example of: >> +/// #define min(x, y) x < y ? x : y >> +/// >> +/// and then later on a use of min: >> +/// return min(a, b); >> +/// #line 17 >> +/// >> +/// The expansion location is the line in the source code where the macro >> +/// was expanded (the return statement), the spelling location is the >> +/// location in the source where the macro was originally defined, >> +/// and the presumed location is where the line directive states that >> +/// the line is 17, or any other line. >> + > > Small nit: shouldn't the "#line 17" come before the return statement? Or do I > have this wrong?
They were somewhat separate examples, but I can put one before the other just for you! :) -eric _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
