diff options
author | Fangrui Song <maskray@google.com> | 2018-07-30 19:24:48 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-07-30 19:24:48 +0000 |
commit | 6907ce2f8f7410b179beb6e2db9c8d16a257ce9f (patch) | |
tree | 31081ac1b3df5965102999757410e052925e03af /clang/lib/Sema/CodeCompleteConsumer.cpp | |
parent | ce9b3e084c43e99fbcfeb730ddb5fd0e575d5237 (diff) | |
download | bcm5719-llvm-6907ce2f8f7410b179beb6e2db9c8d16a257ce9f.tar.gz bcm5719-llvm-6907ce2f8f7410b179beb6e2db9c8d16a257ce9f.zip |
Remove trailing space
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h}
llvm-svn: 338291
Diffstat (limited to 'clang/lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r-- | clang/lib/Sema/CodeCompleteConsumer.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index 9c4d315a692..8af54b99393 100644 --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/lib/Sema/CodeCompleteConsumer.cpp @@ -49,7 +49,7 @@ bool CodeCompletionContext::wantConstructorResults() const { case CCC_ObjCMessageReceiver: case CCC_ParenthesizedExpression: return true; - + case CCC_TopLevel: case CCC_ObjCInterface: case CCC_ObjCImplementation: @@ -164,7 +164,7 @@ StringRef clang::getCompletionKindString(CodeCompletionContext::Kind Kind) { // Code completion string implementation //===----------------------------------------------------------------------===// -CodeCompletionString::Chunk::Chunk(ChunkKind Kind, const char *Text) +CodeCompletionString::Chunk::Chunk(ChunkKind Kind, const char *Text) : Kind(Kind), Text("") { switch (Kind) { case CK_TypedText: @@ -178,7 +178,7 @@ CodeCompletionString::Chunk::Chunk(ChunkKind Kind, const char *Text) case CK_Optional: llvm_unreachable("Optional strings cannot be created from text"); - + case CK_LeftParen: this->Text = "("; break; @@ -190,11 +190,11 @@ CodeCompletionString::Chunk::Chunk(ChunkKind Kind, const char *Text) case CK_LeftBracket: this->Text = "["; break; - + case CK_RightBracket: this->Text = "]"; break; - + case CK_LeftBrace: this->Text = "{"; break; @@ -206,11 +206,11 @@ CodeCompletionString::Chunk::Chunk(ChunkKind Kind, const char *Text) case CK_LeftAngle: this->Text = "<"; break; - + case CK_RightAngle: this->Text = ">"; break; - + case CK_Comma: this->Text = ", "; break; @@ -242,7 +242,7 @@ CodeCompletionString::Chunk::CreateText(const char *Text) { return Chunk(CK_Text, Text); } -CodeCompletionString::Chunk +CodeCompletionString::Chunk CodeCompletionString::Chunk::CreateOptional(CodeCompletionString *Optional) { Chunk Result; Result.Kind = CK_Optional; @@ -250,30 +250,30 @@ CodeCompletionString::Chunk::CreateOptional(CodeCompletionString *Optional) { return Result; } -CodeCompletionString::Chunk +CodeCompletionString::Chunk CodeCompletionString::Chunk::CreatePlaceholder(const char *Placeholder) { return Chunk(CK_Placeholder, Placeholder); } -CodeCompletionString::Chunk +CodeCompletionString::Chunk CodeCompletionString::Chunk::CreateInformative(const char *Informative) { return Chunk(CK_Informative, Informative); } -CodeCompletionString::Chunk +CodeCompletionString::Chunk CodeCompletionString::Chunk::CreateResultType(const char *ResultType) { return Chunk(CK_ResultType, ResultType); } -CodeCompletionString::Chunk +CodeCompletionString::Chunk CodeCompletionString::Chunk::CreateCurrentParameter( const char *CurrentParameter) { return Chunk(CK_CurrentParameter, CurrentParameter); } -CodeCompletionString::CodeCompletionString(const Chunk *Chunks, +CodeCompletionString::CodeCompletionString(const Chunk *Chunks, unsigned NumChunks, - unsigned Priority, + unsigned Priority, CXAvailabilityKind Availability, const char **Annotations, unsigned NumAnnotations, @@ -281,7 +281,7 @@ CodeCompletionString::CodeCompletionString(const Chunk *Chunks, const char *BriefComment) : NumChunks(NumChunks), NumAnnotations(NumAnnotations), Priority(Priority), Availability(Availability), - ParentName(ParentName), BriefComment(BriefComment) { + ParentName(ParentName), BriefComment(BriefComment) { assert(NumChunks <= 0xffff); assert(NumAnnotations <= 0xffff); @@ -308,17 +308,17 @@ const char *CodeCompletionString::getAnnotation(unsigned AnnotationNr) const { std::string CodeCompletionString::getAsString() const { std::string Result; llvm::raw_string_ostream OS(Result); - + for (iterator C = begin(), CEnd = end(); C != CEnd; ++C) { switch (C->Kind) { case CK_Optional: OS << "{#" << C->Optional->getAsString() << "#}"; break; case CK_Placeholder: OS << "<#" << C->Text << "#>"; break; - - case CK_Informative: + + case CK_Informative: case CK_ResultType: - OS << "[#" << C->Text << "#]"; + OS << "[#" << C->Text << "#]"; break; - + case CK_CurrentParameter: OS << "<#" << C->Text << "#>"; break; default: OS << C->Text; break; } @@ -350,7 +350,7 @@ StringRef CodeCompletionTUInfo::getParentName(const DeclContext *DC) { const NamedDecl *ND = dyn_cast<NamedDecl>(DC); if (!ND) return {}; - + // Check whether we've already cached the parent name. StringRef &CachedParentName = ParentNames[DC]; if (!CachedParentName.empty()) @@ -368,7 +368,7 @@ StringRef CodeCompletionTUInfo::getParentName(const DeclContext *DC) { if (ND->getIdentifier()) Contexts.push_back(DC); } - + DC = DC->getParent(); } @@ -382,11 +382,11 @@ StringRef CodeCompletionTUInfo::getParentName(const DeclContext *DC) { else { OS << "::"; } - + const DeclContext *CurDC = Contexts[I-1]; if (const ObjCCategoryImplDecl *CatImpl = dyn_cast<ObjCCategoryImplDecl>(CurDC)) CurDC = CatImpl->getCategoryDecl(); - + if (const ObjCCategoryDecl *Cat = dyn_cast<ObjCCategoryDecl>(CurDC)) { const ObjCInterfaceDecl *Interface = Cat->getClassInterface(); if (!Interface) { @@ -395,13 +395,13 @@ StringRef CodeCompletionTUInfo::getParentName(const DeclContext *DC) { CachedParentName = StringRef((const char *)(uintptr_t)~0U, 0); return {}; } - + OS << Interface->getName() << '(' << Cat->getName() << ')'; } else { OS << cast<NamedDecl>(CurDC)->getName(); } } - + CachedParentName = AllocatorRef->CopyString(OS.str()); } @@ -413,7 +413,7 @@ CodeCompletionString *CodeCompletionBuilder::TakeString() { sizeof(CodeCompletionString) + sizeof(Chunk) * Chunks.size() + sizeof(const char *) * Annotations.size(), alignof(CodeCompletionString)); - CodeCompletionString *Result + CodeCompletionString *Result = new (Mem) CodeCompletionString(Chunks.data(), Chunks.size(), Priority, Availability, Annotations.data(), Annotations.size(), @@ -459,14 +459,14 @@ void CodeCompletionBuilder::AddChunk(CodeCompletionString::ChunkKind CK, void CodeCompletionBuilder::addParentContext(const DeclContext *DC) { if (DC->isTranslationUnit()) return; - + if (DC->isFunctionOrMethod()) return; - + const NamedDecl *ND = dyn_cast<NamedDecl>(DC); if (!ND) return; - + ParentName = getCodeCompletionTUInfo().getParentName(DC); } @@ -492,11 +492,11 @@ CodeCompleteConsumer::OverloadCandidate::getFunctionType() const { switch (Kind) { case CK_Function: return Function->getType()->getAs<FunctionType>(); - + case CK_FunctionTemplate: return FunctionTemplate->getTemplatedDecl()->getType() ->getAs<FunctionType>(); - + case CK_FunctionType: return Type; } @@ -526,13 +526,13 @@ bool PrintingCodeCompleteConsumer::isResultFilteredOut(StringRef Filter, llvm_unreachable("Unknown code completion result Kind."); } -void +void PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef, CodeCompletionContext Context, CodeCompletionResult *Results, unsigned NumResults) { std::stable_sort(Results, Results + NumResults); - + StringRef Filter = SemaRef.getPreprocessor().getCodeCompletionFilter(); // Print the results. @@ -545,7 +545,7 @@ PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef, OS << *Results[I].Declaration; if (Results[I].Hidden) OS << " (Hidden)"; - if (CodeCompletionString *CCS + if (CodeCompletionString *CCS = Results[I].CreateCodeCompletionString(SemaRef, Context, getAllocator(), CCTUInfo, @@ -574,14 +574,14 @@ PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef, } OS << '\n'; break; - + case CodeCompletionResult::RK_Keyword: OS << Results[I].Keyword << '\n'; break; - + case CodeCompletionResult::RK_Macro: OS << Results[I].Macro->getName(); - if (CodeCompletionString *CCS + if (CodeCompletionString *CCS = Results[I].CreateCodeCompletionString(SemaRef, Context, getAllocator(), CCTUInfo, @@ -590,9 +590,9 @@ PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef, } OS << '\n'; break; - + case CodeCompletionResult::RK_Pattern: - OS << "Pattern : " + OS << "Pattern : " << Results[I].Pattern->getAsString() << '\n'; break; } @@ -624,7 +624,7 @@ static std::string getOverloadAsString(const CodeCompletionString &CCS) { return OS.str(); } -void +void PrintingCodeCompleteConsumer::ProcessOverloadCandidates(Sema &SemaRef, unsigned CurrentArg, OverloadCandidate *Candidates, @@ -655,19 +655,19 @@ void CodeCompletionResult::computeCursorKindAndAvailability(bool Accessible) { break; } LLVM_FALLTHROUGH; - + case RK_Declaration: { // Set the availability based on attributes. switch (getDeclAvailability(Declaration)) { case AR_Available: case AR_NotYetIntroduced: - Availability = CXAvailability_Available; + Availability = CXAvailability_Available; break; - + case AR_Deprecated: Availability = CXAvailability_Deprecated; break; - + case AR_Unavailable: Availability = CXAvailability_NotAvailable; break; @@ -676,11 +676,11 @@ void CodeCompletionResult::computeCursorKindAndAvailability(bool Accessible) { if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(Declaration)) if (Function->isDeleted()) Availability = CXAvailability_NotAvailable; - + CursorKind = getCursorKindForDecl(Declaration); if (CursorKind == CXCursor_UnexposedDecl) { - // FIXME: Forward declarations of Objective-C classes and protocols - // are not directly exposed, but we want code completion to treat them + // FIXME: Forward declarations of Objective-C classes and protocols + // are not directly exposed, but we want code completion to treat them // like a definition. if (isa<ObjCInterfaceDecl>(Declaration)) CursorKind = CXCursor_ObjCInterfaceDecl; @@ -717,9 +717,9 @@ StringRef CodeCompletionResult::getOrderedName(std::string &Saved) const { // Handle declarations below. break; } - + DeclarationName Name = Declaration->getDeclName(); - + // If the name is a simple identifier (by far the common case), or a // zero-argument selector, just return a reference to that identifier. if (IdentifierInfo *Id = Name.getAsIdentifierInfo()) @@ -728,12 +728,12 @@ StringRef CodeCompletionResult::getOrderedName(std::string &Saved) const { if (IdentifierInfo *Id = Name.getObjCSelector().getIdentifierInfoForSlot(0)) return Id->getName(); - + Saved = Name.getAsString(); return Saved; } - -bool clang::operator<(const CodeCompletionResult &X, + +bool clang::operator<(const CodeCompletionResult &X, const CodeCompletionResult &Y) { std::string XSaved, YSaved; StringRef XStr = X.getOrderedName(XSaved); @@ -741,11 +741,11 @@ bool clang::operator<(const CodeCompletionResult &X, int cmp = XStr.compare_lower(YStr); if (cmp) return cmp < 0; - + // If case-insensitive comparison fails, try case-sensitive comparison. cmp = XStr.compare(YStr); if (cmp) return cmp < 0; - + return false; } |