Author: rafael
Date: Mon Nov 18 16:40:04 2013
New Revision: 195050

URL: http://llvm.org/viewvc/llvm-project?rev=195050&view=rev
Log:
The attached patch is a follow up from my previous one. The existing
logic was not handling typedefs as free functions. This was not
causing problems with the existing tests, but does with the microsoft
abi where they have to get a different calling convention.

I will try to refactor this into a method on Declarator in a second.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=195050&r1=195049&r2=195050&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Nov 18 16:40:04 2013
@@ -3240,9 +3240,11 @@ static TypeSourceInfo *GetFullTypeForDec
     // top-level template type arguments.
     bool FreeFunction;
     if (!D.getCXXScopeSpec().isSet()) {
-      FreeFunction = ((D.getContext() != Declarator::MemberContext &&
-                       D.getContext() != Declarator::LambdaExprContext) ||
-                      D.getDeclSpec().isFriendSpecified());
+      const DeclSpec &Spec = D.getDeclSpec();
+      FreeFunction = (D.getContext() != Declarator::MemberContext &&
+                      D.getContext() != Declarator::LambdaExprContext) ||
+                     Spec.isFriendSpecified() ||
+                     Spec.getStorageClassSpec() == DeclSpec::SCS_typedef;
     } else {
       DeclContext *DC = S.computeDeclContext(D.getCXXScopeSpec());
       FreeFunction = (DC && !DC->isRecord());

Modified: cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp?rev=195050&r1=195049&r2=195050&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp (original)
+++ cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp Mon Nov 18 16:40:04 2013
@@ -167,3 +167,12 @@ namespace test2 {
   };
   extern template void foo::bar(const void *);
 }
+
+namespace test3 {
+  struct foo {
+    typedef void bar();
+  };
+  bool zed(foo::bar *);
+  void bah() {}
+  void baz() { zed(bah); }
+}


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to