summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-09-05 14:59:17 +0000
committerEric Liu <ioeric@google.com>2018-09-05 14:59:17 +0000
commite680dc2798ea4b99017b79bc8ccab1125942c0e6 (patch)
tree8e81cff12de845f907694c9b28474f4df2e55b54 /lib/Sema/SemaCodeComplete.cpp
parent2d5c20fae345fa78684af5bbf6cac59c79828834 (diff)
downloadclang-e680dc2798ea4b99017b79bc8ccab1125942c0e6.tar.gz
[Sema] Store MacroInfo in CodeCompletionResult for macro results.
Summary: This provides information about the macro definition. For example, it can be used to compute macro USRs. Reviewers: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51675 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index e0adf38f93..7ba94c6e0e 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -3313,14 +3313,14 @@ static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results,
M != MEnd; ++M) {
auto MD = PP.getMacroDefinition(M->first);
if (IncludeUndefined || MD) {
- if (MacroInfo *MI = MD.getMacroInfo())
- if (MI->isUsedForHeaderGuard())
- continue;
+ MacroInfo *MI = MD.getMacroInfo();
+ if (MI && MI->isUsedForHeaderGuard())
+ continue;
- Results.AddResult(Result(M->first,
- getMacroUsagePriority(M->first->getName(),
- PP.getLangOpts(),
- TargetTypeIsPointer)));
+ Results.AddResult(
+ Result(M->first, MI,
+ getMacroUsagePriority(M->first->getName(), PP.getLangOpts(),
+ TargetTypeIsPointer)));
}
}