[cfe-commits] r139295 - /cfe/trunk/include/clang/Basic/SourceManager.h
wendling at apple.com
Thu Sep 8 13:57:31 PDT 2011
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
> Add a block comment explaining how the different source locations work
> including some source examples.
> 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?
More information about the cfe-commits