]> granicus.if.org Git - clang/commitdiff
[libclang] Add missing return in clang_getExpansionLocation that resulted in that...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 3 Nov 2011 02:20:36 +0000 (02:20 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 3 Nov 2011 02:20:36 +0000 (02:20 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143606 91177308-0d34-0410-b5e6-96231b3b80d8

tools/c-index-test/c-index-test.c
tools/libclang/CXSourceLocation.cpp

index b46e3842a0d6c04ea2afc166756ba44156681040..3bfdeeed2a57680f375004ab2fa6dd4e3f948e2b 100644 (file)
@@ -340,7 +340,7 @@ static const char* GetCursorSource(CXCursor Cursor) {
   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);
index 71383445c57f0d3889f5225716c45205c2e5f242..d8d4c96e48d349c6d86416f7191691aa234d29a1 100644 (file)
@@ -212,6 +212,7 @@ void clang_getExpansionLocation(CXSourceLocation location,
       *column = SM.getExpansionColumnNumber(ExpansionLoc);
     if (offset)
       *offset = SM.getDecomposedLoc(ExpansionLoc).second;
+    return;
   }
   
   // FIXME: