[cfe-commits] r91137 - in /cfe/trunk: lib/Sema/SemaCodeComplete.cpp test/CodeCompletion/function-templates.cpp

Douglas Gregor dgregor at apple.com
Fri Dec 11 10:14:22 PST 2009


Author: dgregor
Date: Fri Dec 11 12:14:22 2009
New Revision: 91137

URL: http://llvm.org/viewvc/llvm-project?rev=91137&view=rev
Log:
Member function templates can occur after . or ->

Modified:
    cfe/trunk/lib/Sema/SemaCodeComplete.cpp
    cfe/trunk/test/CodeCompletion/function-templates.cpp

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=91137&r1=91136&r2=91137&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Dec 11 12:14:22 2009
@@ -587,7 +587,8 @@
   if (UsingShadowDecl *Using = dyn_cast<UsingShadowDecl>(ND))
     ND = Using->getTargetDecl();
 
-  return isa<ValueDecl>(ND) || isa<ObjCPropertyDecl>(ND);
+  return isa<ValueDecl>(ND) || isa<FunctionTemplateDecl>(ND) ||
+    isa<ObjCPropertyDecl>(ND);
 }
 
 // Find the next outer declaration context corresponding to this scope.

Modified: cfe/trunk/test/CodeCompletion/function-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/function-templates.cpp?rev=91137&r1=91136&r2=91137&view=diff

==============================================================================
--- cfe/trunk/test/CodeCompletion/function-templates.cpp (original)
+++ cfe/trunk/test/CodeCompletion/function-templates.cpp Fri Dec 11 12:14:22 2009
@@ -6,9 +6,18 @@
   X* dyn_cast(Y *Val);
 }
 
+class Foo {
+public:
+  template<typename T> T &getAs();
+};
+
 void f() {
-  std::  
-  // RUN: clang-cc -fsyntax-only -code-completion-at=%s:10:8 %s -o - | FileCheck -check-prefix=CC1 %s
+  std::sort(1, 2);
+  Foo().getAs<int>();
+  // RUN: clang-cc -fsyntax-only -code-completion-at=%s:15:8 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
   // CHECK-CC1: dyn_cast<<#class X#>>(<#Y *Val#>)
-  // CHECK-CC1: sort(<#RandomAccessIterator first#>, <#RandomAccessIterator last#>)
+  // CHECK-CC1: sort(<#RandomAccessIterator first#>, <#RandomAccessIterator last#>
+  // RUN: clang-cc -fsyntax-only -code-completion-at=%s:16:9 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+  // CHECK-CC2: getAs<<#typename T#>>()
+)
   





More information about the cfe-commits mailing list