diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2018-02-19 13:53:49 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2018-02-19 13:53:49 +0000 |
commit | 3289ab20e5e73f2cbd52bfa2c449ce1fb48bae6a (patch) | |
tree | f3f8d299a95686c1ccb124a7d1bfb9185879190f | |
parent | d6f903f05c8eaa5ad4f290f016daf84e06349901 (diff) | |
download | bcm5719-llvm-3289ab20e5e73f2cbd52bfa2c449ce1fb48bae6a.tar.gz bcm5719-llvm-3289ab20e5e73f2cbd52bfa2c449ce1fb48bae6a.zip |
[CodeComplete] Avoid name clashes of 'Kind' inside CodeCompletionContext. NFC
CodeCompletionContext had declarations of field and enum inside, both named 'Kind'.
It caused gcc 4.8 to give an incorrent warning when refering to enum as
`enum CodeCompletionContext::Kind`.
Avoid that warning by renaming the private field to CCKind.
llvm-svn: 325496
-rw-r--r-- | clang/include/clang/Sema/CodeCompleteConsumer.h | 19 | ||||
-rw-r--r-- | clang/lib/Sema/CodeCompleteConsumer.cpp | 6 |
2 files changed, 12 insertions, 13 deletions
diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h index 6698f39f30d..a966e73668e 100644 --- a/clang/include/clang/Sema/CodeCompleteConsumer.h +++ b/clang/include/clang/Sema/CodeCompleteConsumer.h @@ -271,7 +271,7 @@ public: using VisitedContextSet = llvm::SmallPtrSet<DeclContext*, 8>; private: - enum Kind Kind; + Kind CCKind; /// \brief The type that would prefer to see at this point (e.g., the type /// of an initializer or function parameter). @@ -293,23 +293,22 @@ private: public: /// \brief Construct a new code-completion context of the given kind. - CodeCompletionContext(enum Kind Kind) : Kind(Kind), SelIdents(None) { } + CodeCompletionContext(Kind CCKind) : CCKind(CCKind), SelIdents(None) { } /// \brief Construct a new code-completion context of the given kind. - CodeCompletionContext(enum Kind Kind, QualType T, + CodeCompletionContext(Kind CCKind, QualType T, ArrayRef<IdentifierInfo *> SelIdents = None) - : Kind(Kind), - SelIdents(SelIdents) { - if (Kind == CCC_DotMemberAccess || Kind == CCC_ArrowMemberAccess || - Kind == CCC_ObjCPropertyAccess || Kind == CCC_ObjCClassMessage || - Kind == CCC_ObjCInstanceMessage) + : CCKind(CCKind), SelIdents(SelIdents) { + if (CCKind == CCC_DotMemberAccess || CCKind == CCC_ArrowMemberAccess || + CCKind == CCC_ObjCPropertyAccess || CCKind == CCC_ObjCClassMessage || + CCKind == CCC_ObjCInstanceMessage) BaseType = T; else PreferredType = T; } /// \brief Retrieve the kind of code-completion context. - enum Kind getKind() const { return Kind; } + Kind getKind() const { return CCKind; } /// \brief Retrieve the type that this expression would prefer to have, e.g., /// if the expression is a variable initializer or a function argument, the @@ -352,7 +351,7 @@ public: }; /// \brief Get string representation of \p Kind, useful for for debugging. -llvm::StringRef getCompletionKindString(enum CodeCompletionContext::Kind Kind); +llvm::StringRef getCompletionKindString(CodeCompletionContext::Kind Kind); /// \brief A "string" used to describe how code completion can /// be performed for an entity. diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index 6a96e626d90..798e7d6a1c2 100644 --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/lib/Sema/CodeCompleteConsumer.cpp @@ -33,7 +33,7 @@ using namespace clang; //===----------------------------------------------------------------------===// bool CodeCompletionContext::wantConstructorResults() const { - switch (Kind) { + switch (CCKind) { case CCC_Recovery: case CCC_Statement: case CCC_Expression: @@ -76,8 +76,8 @@ bool CodeCompletionContext::wantConstructorResults() const { llvm_unreachable("Invalid CodeCompletionContext::Kind!"); } -StringRef clang::getCompletionKindString(enum CodeCompletionContext::Kind Kind) { - using CCKind = enum CodeCompletionContext::Kind; +StringRef clang::getCompletionKindString(CodeCompletionContext::Kind Kind) { + using CCKind = CodeCompletionContext::Kind; switch (Kind) { case CCKind::CCC_Other: return "Other"; |