]> granicus.if.org Git - clang/commitdiff
Add getDeclaration()/getKind() accessors to CodeCompleteConsumer::Result
authorDouglas Gregor <dgregor@apple.com>
Tue, 22 Sep 2009 22:11:38 +0000 (22:11 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 22 Sep 2009 22:11:38 +0000 (22:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82581 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/CodeCompleteConsumer.h

index 5db369cc13687327acb9ff862696572c2269430c..68e07e9608eed06371bfc1be88af3d1e3d6bed36 100644 (file)
@@ -170,6 +170,18 @@ public:
     Result(const char *Keyword, unsigned Rank)
       : Kind(RK_Keyword), Keyword(Keyword), Rank(Rank), Hidden(false) { }
     
+    /// \brief Retrieve the declaration stored in this result.
+    NamedDecl *getDeclaration() const {
+      assert(Kind == RK_Declaration && "Not a declaration result");
+      return Declaration;
+    }
+    
+    /// \brief Retrieve the keyword stored in this result.
+    const char *getKeyword() const {
+      assert(Kind == RK_Keyword && "Not a keyword result");
+      return Keyword;
+    }
+    
     /// \brief Create a new code-completion string that describes how to insert
     /// this result into a program.
     CodeCompletionString *CreateCodeCompletionString(Sema &S);