]> granicus.if.org Git - clang/commitdiff
The attached patch is a follow up from my previous one. The existing
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 18 Nov 2013 22:40:04 +0000 (22:40 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 18 Nov 2013 22:40:04 +0000 (22:40 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195050 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp
test/SemaCXX/decl-microsoft-call-conv.cpp

index 2fd9fc45d81e99c154d163d5eb5b79a0eb4ab6d2..436b4b63ae0bf6b68c1bbc270b98ab35c7f9dae0 100644 (file)
@@ -3240,9 +3240,11 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
     // 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());
index 9d42add81392243c5f5e9cc6ed425cda0f612136..e47a5c2a5cfaf26e2ab5d6e63c54c40bb37773f4 100644 (file)
@@ -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); }
+}