[cfe-commits] r143606 - in /cfe/trunk/tools: c-index-test/c-index-test.c libclang/CXSourceLocation.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Nov 2 19:20:36 PDT 2011


Author: akirtzidis
Date: Wed Nov  2 21:20:36 2011
New Revision: 143606

URL: http://llvm.org/viewvc/llvm-project?rev=143606&view=rev
Log:
[libclang] Add missing return in clang_getExpansionLocation that resulted in that function
always returning a null file/line/column.

Also add at least one use of clang_getExpansionLocation inside c-index-test that would have
made the tests to catch that.

Modified:
    cfe/trunk/tools/c-index-test/c-index-test.c
    cfe/trunk/tools/libclang/CXSourceLocation.cpp

Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=143606&r1=143605&r2=143606&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Wed Nov  2 21:20:36 2011
@@ -340,7 +340,7 @@
   CXSourceLocation Loc = clang_getCursorLocation(Cursor);
   CXString source;
   CXFile file;
-  clang_getSpellingLocation(Loc, &file, 0, 0, 0);
+  clang_getExpansionLocation(Loc, &file, 0, 0, 0);
   source = clang_getFileName(file);
   if (!clang_getCString(source)) {
     clang_disposeString(source);

Modified: cfe/trunk/tools/libclang/CXSourceLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXSourceLocation.cpp?rev=143606&r1=143605&r2=143606&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXSourceLocation.cpp (original)
+++ cfe/trunk/tools/libclang/CXSourceLocation.cpp Wed Nov  2 21:20:36 2011
@@ -212,6 +212,7 @@
       *column = SM.getExpansionColumnNumber(ExpansionLoc);
     if (offset)
       *offset = SM.getDecomposedLoc(ExpansionLoc).second;
+    return;
   }
   
   // FIXME:





More information about the cfe-commits mailing list