Clean up the CIndex API slightly.

Renamed CXSourceFileLine to CXSourceLocation and added a CXFile, to
better match Clang's SourceLocation. Teach clang_getDeclExtent to fill
in the CXFile properly.

Renamed CXSourceExtent to CXSourceRange, to better match Clang's
SourceLocation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93783 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index c5c7409..a11f54b 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -643,7 +643,7 @@
   return SourceMgr.getSpellingColumnNumber(ND->getLocation());
 }
   
-CXDeclExtent clang_getDeclExtent(CXDecl AnonDecl) {
+CXSourceRange clang_getDeclExtent(CXDecl AnonDecl) {
   assert(AnonDecl && "Passed null CXDecl");
   NamedDecl *ND = static_cast<NamedDecl *>(AnonDecl);
   SourceManager &SM = ND->getASTContext().getSourceManager();
@@ -653,7 +653,7 @@
   SourceLocation End = SM.getInstantiationLoc(R.getEnd());
 
   if (!Begin.isValid()) {
-    CXDeclExtent extent = { { 0, 0 }, { 0, 0 } };
+    CXSourceRange extent = { { 0, 0, 0 }, { 0, 0, 0 } };
     return extent;
   }
   
@@ -691,8 +691,9 @@
   }
 
   // Package up the line/column data and return to the caller.
-  CXDeclExtent extent = { { StartLineNo, StartColNo },
-                          { EndLineNo, EndColNo } };
+  const FileEntry *FEntry = SM.getFileEntryForID(SM.getFileID(Begin));
+  CXSourceRange extent = { { (void *)FEntry, StartLineNo, StartColNo },
+                           { (void *)FEntry, EndLineNo, EndColNo } };
   return extent;  
 }