summaryrefslogtreecommitdiffstats
path: root/clang/include/clang-c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-09 05:28:47 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-09 05:28:47 +0000
commitd1ea3f0d29dd9e18c42d17ef281c744b5bea6b92 (patch)
tree3580c7cb3ab4b9e937bd8707cb989419f836ac62 /clang/include/clang-c
parentc1351cac17c2357866132aeaa69706fc84bd4201 (diff)
downloadbcm5719-llvm-d1ea3f0d29dd9e18c42d17ef281c744b5bea6b92.tar.gz
bcm5719-llvm-d1ea3f0d29dd9e18c42d17ef281c744b5bea6b92.zip
Introduce clang_getSpellingLocation() into libclang, to provide the
location where we're spelling a token even within a macro. clang_getInstantiationLocation() tells where we instantiated the macro. I'm still not thrilled with the CXSourceLocation/CXSourceRange APIs, since they gloss over macro-instantiation information. llvm-svn: 118492
Diffstat (limited to 'clang/include/clang-c')
-rw-r--r--clang/include/clang-c/Index.h35
1 files changed, 33 insertions, 2 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index b193600d9d6..f3ba9974eb2 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -257,8 +257,8 @@ CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
* \brief Identifies a specific source location within a translation
* unit.
*
- * Use clang_getInstantiationLocation() to map a source location to a
- * particular file, line, and column.
+ * Use clang_getInstantiationLocation() or clang_getSpellingLocation()
+ * to map a source location to a particular file, line, and column.
*/
typedef struct {
void *ptr_data[2];
@@ -325,6 +325,9 @@ CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin,
* \brief Retrieve the file, line, column, and offset represented by
* the given source location.
*
+ * If the location refers into a macro instantiation, retrieves the
+ * location of the macro instantiation.
+ *
* \param location the location within a source file that will be decomposed
* into its parts.
*
@@ -347,6 +350,34 @@ CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
unsigned *offset);
/**
+ * \brief Retrieve the file, line, column, and offset represented by
+ * the given source location.
+ *
+ * If the location refers into a macro instantiation, return where the
+ * location was originally spelled in the source file.
+ *
+ * \param location the location within a source file that will be decomposed
+ * into its parts.
+ *
+ * \param file [out] if non-NULL, will be set to the file to which the given
+ * source location points.
+ *
+ * \param line [out] if non-NULL, will be set to the line to which the given
+ * source location points.
+ *
+ * \param column [out] if non-NULL, will be set to the column to which the given
+ * source location points.
+ *
+ * \param offset [out] if non-NULL, will be set to the offset into the
+ * buffer to which the given source location points.
+ */
+CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
+ CXFile *file,
+ unsigned *line,
+ unsigned *column,
+ unsigned *offset);
+
+/**
* \brief Retrieve a source location representing the first character within a
* source range.
*/
OpenPOWER on IntegriCloud