From: Argyrios Kyrtzidis Date: Thu, 3 Nov 2011 02:20:36 +0000 (+0000) Subject: [libclang] Add missing return in clang_getExpansionLocation that resulted in that... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b4efaa0a14dd2382aa028c03283b5a7f5345e24d;p=clang [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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143606 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index b46e3842a0..3bfdeeed2a 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -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); diff --git a/tools/libclang/CXSourceLocation.cpp b/tools/libclang/CXSourceLocation.cpp index 71383445c5..d8d4c96e48 100644 --- a/tools/libclang/CXSourceLocation.cpp +++ b/tools/libclang/CXSourceLocation.cpp @@ -212,6 +212,7 @@ void clang_getExpansionLocation(CXSourceLocation location, *column = SM.getExpansionColumnNumber(ExpansionLoc); if (offset) *offset = SM.getDecomposedLoc(ExpansionLoc).second; + return; } // FIXME: