summaryrefslogtreecommitdiff
path: root/tools/libclang/CIndexHigh.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-07 19:16:25 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-07 19:16:25 +0000
commit664b06f9bd2ea83443ddc8553feba8ba48880752 (patch)
tree32ee70458994744d3be3d967d541dfe84bea86ab /tools/libclang/CIndexHigh.cpp
parent8169b671974fc15b6059b1e9532f7f3207d79786 (diff)
downloadclang-664b06f9bd2ea83443ddc8553feba8ba48880752.tar.gz
clang-664b06f9bd2ea83443ddc8553feba8ba48880752.tar.bz2
clang-664b06f9bd2ea83443ddc8553feba8ba48880752.tar.xz
[libclang] When getting the cursor for an identifier inside a macro definition, check if
this was ever a macro name and return a specific CXCursor_MacroExpansion cursor in such a case, instead of the generic CXCursor_MacroDefinition. Checking for macro name makes sure the identifier is not part of the identifier list in a function macro. While, in general, resolving identifiers in macro definitions to other macros may not be completely accurate, it greatly improves functionality such as give-me-the-definition-of-this, which was not working at all inside macro definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndexHigh.cpp')
-rw-r--r--tools/libclang/CIndexHigh.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/libclang/CIndexHigh.cpp b/tools/libclang/CIndexHigh.cpp
index 43f2024079..f4d6bc564e 100644
--- a/tools/libclang/CIndexHigh.cpp
+++ b/tools/libclang/CIndexHigh.cpp
@@ -266,7 +266,7 @@ static enum CXChildVisitResult findFileMacroRefVisit(CXCursor cursor,
if (cursor.kind == CXCursor_MacroDefinition)
Macro = getCursorMacroDefinition(cursor)->getName();
else if (cursor.kind == CXCursor_MacroExpansion)
- Macro = getCursorMacroExpansion(cursor)->getName();
+ Macro = getCursorMacroExpansion(cursor).getName();
if (!Macro)
return CXChildVisit_Continue;
@@ -317,7 +317,7 @@ static void findMacroRefsInFile(CXTranslationUnit TU, CXCursor Cursor,
if (Cursor.kind == CXCursor_MacroDefinition)
Macro = getCursorMacroDefinition(Cursor)->getName();
else
- Macro = getCursorMacroExpansion(Cursor)->getName();
+ Macro = getCursorMacroExpansion(Cursor).getName();
if (!Macro)
return;