[cfe-commits] r112194 - in /cfe/trunk: lib/Sema/SemaCodeComplete.cpp test/Index/complete-at-exprstmt.m
Douglas Gregor
dgregor at apple.com
Thu Aug 26 09:46:39 PDT 2010
Author: dgregor
Date: Thu Aug 26 11:46:39 2010
New Revision: 112194
URL: http://llvm.org/viewvc/llvm-project?rev=112194&view=rev
Log:
Tweak the @selector completion to collapse multiple informative and
typed-text blocks into one of each.
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Index/complete-at-exprstmt.m
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=112194&r1=112193&r2=112194&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Thu Aug 26 11:46:39 2010
@@ -4064,16 +4064,19 @@
continue;
}
+ std::string Accumulator;
for (unsigned I = 0, N = Sel.getNumArgs(); I != N; ++I) {
- std::string Piece = Sel.getIdentifierInfoForSlot(I)->getName().str();
- Piece += ':';
- if (I < NumSelIdents)
- Pattern->AddInformativeChunk(Piece);
- else if (I == NumSelIdents)
- Pattern->AddTypedTextChunk(Piece);
- else
- Pattern->AddTextChunk(Piece);
+ if (I == NumSelIdents) {
+ if (!Accumulator.empty()) {
+ Pattern->AddInformativeChunk(Accumulator);
+ Accumulator.clear();
+ }
+ }
+
+ Accumulator += Sel.getIdentifierInfoForSlot(I)->getName().str();
+ Accumulator += ':';
}
+ Pattern->AddTypedTextChunk(Accumulator);
Results.AddResult(Pattern);
}
Results.ExitScope();
Modified: cfe/trunk/test/Index/complete-at-exprstmt.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-at-exprstmt.m?rev=112194&r1=112193&r2=112194&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-at-exprstmt.m (original)
+++ cfe/trunk/test/Index/complete-at-exprstmt.m Thu Aug 26 11:46:39 2010
@@ -46,10 +46,10 @@
// CHECK-CC3: TypedefDecl:{TypedText SEL}
// CHECK-CC3: NotImplemented:{ResultType MyClass *}{TypedText self}
// RUN: c-index-test -code-completion-at=%s:19:13 %s | FileCheck -check-prefix=CHECK-CC4 %s
-// CHECK-CC4: NotImplemented:{TypedText add:}{Text to:} (30)
-// CHECK-CC4: NotImplemented:{TypedText add:}{Text to:}{Text plus:} (30)
+// CHECK-CC4: NotImplemented:{TypedText add:to:} (30)
+// CHECK-CC4: NotImplemented:{TypedText add:to:plus:} (30)
// CHECK-CC4: NotImplemented:{TypedText myMethod:} (30)
// RUN: c-index-test -code-completion-at=%s:19:17 %s | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:} (30)
-// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:}{Text plus:} (30)
+// CHECK-CC5: NotImplemented:{Informative add:}{TypedText to:plus:} (30)
More information about the cfe-commits
mailing list