[cfe-commits] r149587 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGen/inline.c test/CodeGen/inline2.c

Eli Friedman eli.friedman at gmail.com
Wed Feb 1 21:33:05 PST 2012


On Wed, Feb 1, 2012 at 9:13 PM, Anton Yartsev <anton.yartsev at gmail.com> wrote:
> Author: ayartsev
> Date: Wed Feb  1 23:13:59 2012
> New Revision: 149587
>
> URL: http://llvm.org/viewvc/llvm-project?rev=149587&view=rev
> Log:
> Fix for PR10657 (http://llvm.org/bugs/show_bug.cgi?id=10657)
> extern inline case considered
>
> Modified:
>    cfe/trunk/lib/AST/ASTContext.cpp
>    cfe/trunk/test/CodeGen/inline.c
>    cfe/trunk/test/CodeGen/inline2.c

The changes you are making to the tests are clearly wrong.  Please
revert, and we can discuss the correct way to fix your testcase.

-Eli

> Modified: cfe/trunk/lib/AST/ASTContext.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=149587&r1=149586&r2=149587&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
> +++ cfe/trunk/lib/AST/ASTContext.cpp Wed Feb  1 23:13:59 2012
> @@ -6673,7 +6673,9 @@
>     // always be deferred.  Normal inline functions can be deferred in C99/C++.
>     // Implicit template instantiations can also be deferred in C++.
>     if (Linkage == GVA_Internal  || Linkage == GVA_C99Inline ||
> -        Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation)
> +        Linkage == GVA_CXXInline ||
> +        (Linkage == GVA_StrongExternal && FD->isInlineSpecified()) ||
> +        Linkage == GVA_TemplateInstantiation)
>       return false;
>     return true;
>   }
>
> Modified: cfe/trunk/test/CodeGen/inline.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/inline.c?rev=149587&r1=149586&r2=149587&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/inline.c (original)
> +++ cfe/trunk/test/CodeGen/inline.c Wed Feb  1 23:13:59 2012
> @@ -1,10 +1,8 @@
>  // RUN: echo "GNU89 tests:"
>  // RUN: %clang %s -O1 -emit-llvm -S -o %t -std=gnu89
> -// RUN: grep "define available_externally i32 @ei()" %t
>  // RUN: grep "define i32 @foo()" %t
>  // RUN: grep "define i32 @bar()" %t
> -// RUN: grep "define void @unreferenced1()" %t
> -// RUN: not grep unreferenced2 %t
> +// RUN: not grep unreferenced %t
>  // RUN: grep "define void @gnu_inline()" %t
>  // RUN: grep "define available_externally void @gnu_ei_inline()" %t
>  // RUN: grep "define i32 @test1" %t
> @@ -19,8 +17,7 @@
>  // RUN: grep "define i32 @ei()" %t
>  // RUN: grep "define available_externally i32 @foo()" %t
>  // RUN: grep "define i32 @bar()" %t
> -// RUN: not grep unreferenced1 %t
> -// RUN: grep "define void @unreferenced2()" %t
> +// RUN: not grep unreferenced %t
>  // RUN: grep "define void @gnu_inline()" %t
>  // RUN: grep "define available_externally void @gnu_ei_inline()" %t
>  // RUN: grep "define i32 @test1" %t
> @@ -53,6 +50,7 @@
>  extern __inline void unreferenced2() {}
>
>  __inline __attribute((__gnu_inline__)) void gnu_inline() {}
> +void test_gnu_inline() { gnu_inline(); }
>
>  // PR3988
>  extern __inline __attribute__((gnu_inline)) void gnu_ei_inline() {}
> @@ -71,6 +69,7 @@
>  // PR3989
>  extern __inline void test3() __attribute__((gnu_inline));
>  __inline void __attribute__((gnu_inline)) test3() {}
> +void test_test3() { test3(); }
>
>  extern int test4(void);
>  extern __inline __attribute__ ((__gnu_inline__)) int test4(void)
> @@ -92,11 +91,10 @@
>
>  __inline int test6() { return 0; }
>  extern int test6();
> +void test_test6() { test6(); }
>
> -
> -// No PR#, but this once crashed clang in C99 mode due to buggy extern inline
> -// redeclaration detection.
> -void test7() { }
> +// PR10657
> +extern __inline void test7() {}
>  void test7();
>
>  // PR11062; the fact that the function is named strlcpy matters here.
>
> Modified: cfe/trunk/test/CodeGen/inline2.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/inline2.c?rev=149587&r1=149586&r2=149587&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/inline2.c (original)
> +++ cfe/trunk/test/CodeGen/inline2.c Wed Feb  1 23:13:59 2012
> @@ -1,61 +1,63 @@
> -// RUN: %clang_cc1 -O1 -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix GNU89 %s
> -// RUN: %clang_cc1 -O1 -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix C99 %s
> +// RUN: echo "GNU89 tests:"
> +// RUN: %clang_cc1 -O1 -triple i386-apple-darwin9 -emit-llvm -o %t -std=gnu89 %s
> +// RUN: grep "define i32 @f0()" %t
> +// RUN: grep "define i32 @f1()" %t
> +// RUN: grep "define i32 @f2()" %t
> +// RUN: grep "define i32 @f3()" %t
> +// RUN: grep "define i32 @f5()" %t
> +// RUN: grep "define i32 @f6()" %t
> +// RUN: grep "define i32 @f7()" %t
> +// RUN: grep "define i32 @fA()" %t
> +// RUN: grep "define available_externally i32 @f4()" %t
> +// RUN: grep "define available_externally i32 @f8()" %t
> +// RUN: grep "define available_externally i32 @f9()" %t
> +
> +// RUN: echo "C99 tests:"
> +// RUN: %clang_cc1 -O1 -triple i386-apple-darwin9 -emit-llvm -o %t -std=c99 %s
> +// RUN: grep "define i32 @f0()" %t
> +// RUN: grep "define i32 @f1()" %t
> +// RUN: grep "define i32 @f2()" %t
> +// RUN: grep "define i32 @f3()" %t
> +// RUN: grep "define i32 @f5()" %t
> +// RUN: grep "define i32 @f6()" %t
> +// RUN: grep "define i32 @f7()" %t
> +// RUN: grep "define available_externally i32 @fA()" %t
> +// RUN: grep "define i32 @f4()" %t
> +// RUN: grep "define i32 @f8()" %t
> +// RUN: grep "define i32 @f9()" %t
>
> -// CHECK-GNU89: define i32 @f0()
> -// CHECK-C99: define i32 @f0()
>  int f0(void);
>  int f0(void) { return 0; }
>
> -// CHECK-GNU89: define i32 @f1()
> -// CHECK-C99: define i32 @f1()
>  inline int f1(void);
>  int f1(void) { return 0; }
>
> -// CHECK-GNU89: define i32 @f2()
> -// CHECK-C99: define i32 @f2()
>  int f2(void);
>  inline int f2(void) { return 0; }
>
> -// CHECK-GNU89: define i32 @f3()
> -// CHECK-C99: define i32 @f3()
>  extern inline int f3(void);
>  int f3(void) { return 0; }
>
> -// CHECK-GNU89: define i32 @f5()
> -// CHECK-C99: define i32 @f5()
>  extern inline int f5(void);
>  inline int f5(void) { return 0; }
>
> -// CHECK-GNU89: define i32 @f6()
> -// CHECK-C99: define i32 @f6()
>  inline int f6(void);
>  extern inline int f6(void) { return 0; }
>
> -// CHECK-GNU89: define i32 @f7()
> -// CHECK-C99: define i32 @f7()
>  extern inline int f7(void);
>  extern int f7(void) { return 0; }
>
> -// CHECK-GNU89: define i32 @fA()
>  inline int fA(void) { return 0; }
>
> -// CHECK-GNU89: define available_externally i32 @f4()
> -// CHECK-C99: define i32 @f4()
>  int f4(void);
>  extern inline int f4(void) { return 0; }
>
> -// CHECK-GNU89: define available_externally i32 @f8()
> -// CHECK-C99: define i32 @f8()
>  extern int f8(void);
>  extern inline int f8(void) { return 0; }
>
> -// CHECK-GNU89: define available_externally i32 @f9()
> -// CHECK-C99: define i32 @f9()
>  extern inline int f9(void);
>  extern inline int f9(void) { return 0; }
>
> -// CHECK-C99: define available_externally i32 @fA()
> -
>  int test_all() {
>   return f0() + f1() + f2() + f3() + f4() + f5() + f6() + f7() + f8() + f9()
>     + fA();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list