[cfe-commits] r139295 - /cfe/trunk/include/clang/Basic/SourceManager.h

Eric Christopher echristo at apple.com
Thu Sep 8 10:15:01 PDT 2011


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.
+
 /// SrcMgr - Public enums and private classes that are part of the
 /// SourceManager implementation.
 ///





More information about the cfe-commits mailing list