[PATCH] D44423: [clangd] Use the macro name range as the definition range.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 13 07:35:03 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE327401: [clangd] Use the macro name range as the definition range. (authored by hokein, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D44423?vs=138163&id=138189#toc
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D44423
Files:
clangd/XRefs.cpp
unittests/clangd/XRefsTests.cpp
Index: unittests/clangd/XRefsTests.cpp
===================================================================
--- unittests/clangd/XRefsTests.cpp
+++ unittests/clangd/XRefsTests.cpp
@@ -207,15 +207,15 @@
R"cpp(// Macro
#define MACRO 0
- #define [[MACRO 1]]
+ #define [[MACRO]] 1
int main() { return ^MACRO; }
#define MACRO 2
#undef macro
)cpp",
R"cpp(// Macro
class TTT { public: int a; };
- #define [[FF(S) if (int b = S.a) {}]]
+ #define [[FF]](S) if (int b = S.a) {}
void f() {
TTT t;
F^F(t);
Index: clangd/XRefs.cpp
===================================================================
--- clangd/XRefs.cpp
+++ clangd/XRefs.cpp
@@ -219,9 +219,8 @@
}
for (auto Item : MacroInfos) {
- SourceRange SR(Item.Info->getDefinitionLoc(),
- Item.Info->getDefinitionEndLoc());
- auto L = makeLocation(AST, SR);
+ auto Loc = Item.Info->getDefinitionLoc();
+ auto L = makeLocation(AST, SourceRange(Loc, Loc));
if (L)
Result.push_back(*L);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44423.138189.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180313/11316d0f/attachment.bin>
More information about the cfe-commits
mailing list