r227950 - MS ABI: Records with required alignment can't have common linkage

David Majnemer david.majnemer at gmail.com
Mon Feb 2 23:35:55 PST 2015


Author: majnemer
Date: Tue Feb  3 01:35:55 2015
New Revision: 227950

URL: http://llvm.org/viewvc/llvm-project?rev=227950&view=rev
Log:
MS ABI: Records with required alignment can't have common linkage

This fixes PR22441.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/CodeGen/ms-align-tentative.c

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=227950&r1=227949&r2=227950&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Feb  3 01:35:55 2015
@@ -1685,6 +1685,7 @@ TypeInfo ASTContext::getTypeInfoImpl(con
     const ASTRecordLayout &Layout = getASTRecordLayout(RT->getDecl());
     Width = toBits(Layout.getSize());
     Align = toBits(Layout.getAlignment());
+    AlignIsRequired = RT->getDecl()->hasAttr<AlignedAttr>();
     break;
   }
 

Modified: cfe/trunk/test/CodeGen/ms-align-tentative.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-align-tentative.c?rev=227950&r1=227949&r2=227950&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-align-tentative.c (original)
+++ cfe/trunk/test/CodeGen/ms-align-tentative.c Tue Feb  3 01:35:55 2015
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-pc-win32 %s -emit-llvm -fms-compatibility -o - | FileCheck %s
+// RUN: %clang_cc1 -triple i386-pc-win32 -emit-llvm -fms-compatibility -o - < %s | FileCheck %s
 
 char __declspec(align(8192)) x;
 // CHECK-DAG: @x = global i8 0, align 8192
@@ -13,3 +13,8 @@ T __declspec(align(8192)) z;
 int __declspec(align(16)) redef;
 int __declspec(align(32)) redef = 8;
 // CHECK-DAG: @redef = global i32 8, align 32
+
+struct __declspec(align(64)) S {
+  char fd;
+} s;
+// CHECK-DAG: @s = global %struct.S zeroinitializer, align 64





More information about the cfe-commits mailing list