[cfe-commits] r82577 - in /cfe/trunk: lib/Sema/SemaCodeComplete.cpp test/CodeCompletion/functions.cpp
Douglas Gregor
dgregor at apple.com
Tue Sep 22 14:42:17 PDT 2009
Author: dgregor
Date: Tue Sep 22 16:42:17 2009
New Revision: 82577
URL: http://llvm.org/viewvc/llvm-project?rev=82577&view=rev
Log:
Teach code-completion to introduce a ", ..." placeholder for variadic functions
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/CodeCompletion/functions.cpp
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=82577&r1=82576&r2=82577&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Tue Sep 22 16:42:17 2009
@@ -657,6 +657,11 @@
// Add the placeholder string.
CCStr->AddPlaceholderChunk(PlaceholderStr.c_str());
}
+
+ if (const FunctionProtoType *Proto
+ = Function->getType()->getAs<FunctionProtoType>())
+ if (Proto->isVariadic())
+ CCStr->AddPlaceholderChunk(", ...");
}
/// \brief Add template parameter chunks to the given code completion string.
Modified: cfe/trunk/test/CodeCompletion/functions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/functions.cpp?rev=82577&r1=82576&r2=82577&view=diff
==============================================================================
--- cfe/trunk/test/CodeCompletion/functions.cpp (original)
+++ cfe/trunk/test/CodeCompletion/functions.cpp Tue Sep 22 16:42:17 2009
@@ -1,9 +1,9 @@
void f(int i, int j = 2, int k = 5);
-void f(float x, float y);
+void f(float x, float y...);
void test() {
::
// RUN: clang-cc -fsyntax-only -code-completion-at=%s:5:5 %s -o - | FileCheck -check-prefix=CC1 %s &&
// CHECK-CC1: f(<#int i#>{#, <#int j#>{#, <#int k#>#}#})
- // CHECK-CC1: f(<#float x#>, <#float y#>)
+ // CHECK-CC1: f(<#float x#>, <#float y#><#, ...#>)
// RUN: true
More information about the cfe-commits
mailing list