Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
097353cb
Commit
097353cb
authored
15 years ago
by
Daniel Dunbar
Browse files
Options
Downloads
Patches
Plain Diff
Darwin x86-32: Multi-dimensional arrays were not handled correctly,
spotted by Eli! llvm-svn: 71490
parent
38811708
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
clang/lib/CodeGen/CGCall.cpp
+12
-9
12 additions, 9 deletions
clang/lib/CodeGen/CGCall.cpp
clang/test/CodeGen/x86_32-arguments.c
+6
-0
6 additions, 0 deletions
clang/test/CodeGen/x86_32-arguments.c
with
18 additions
and
9 deletions
clang/lib/CodeGen/CGCall.cpp
+
12
−
9
View file @
097353cb
...
@@ -166,10 +166,9 @@ static bool isEmptyField(ASTContext &Context, const FieldDecl *FD) {
...
@@ -166,10 +166,9 @@ static bool isEmptyField(ASTContext &Context, const FieldDecl *FD) {
return
true
;
return
true
;
QualType
FT
=
FD
->
getType
();
QualType
FT
=
FD
->
getType
();
// Arrays of empty records count as empty.
// Constant arrays of empty records count as empty, strip them off.
if
(
const
ConstantArrayType
*
AT
=
Context
.
getAsConstantArrayType
(
FT
))
while
(
const
ConstantArrayType
*
AT
=
Context
.
getAsConstantArrayType
(
FT
))
if
(
isEmptyRecord
(
Context
,
AT
->
getElementType
()))
FT
=
AT
->
getElementType
();
return
true
;
return
isEmptyRecord
(
Context
,
FT
);
return
isEmptyRecord
(
Context
,
FT
);
}
}
...
@@ -218,14 +217,18 @@ static const Type *isSingleElementStruct(QualType T, ASTContext &Context) {
...
@@ -218,14 +217,18 @@ static const Type *isSingleElementStruct(QualType T, ASTContext &Context) {
if
(
isEmptyField
(
Context
,
FD
))
if
(
isEmptyField
(
Context
,
FD
))
continue
;
continue
;
// Treat single element arrays as the element
// If we already found an element then this isn't a single-element
if
(
const
ConstantArrayType
*
AT
=
Context
.
getAsConstantArrayType
(
FT
))
// struct.
if
(
AT
->
getSize
().
getZExtValue
()
==
1
)
FT
=
AT
->
getElementType
();
if
(
Found
)
if
(
Found
)
return
0
;
return
0
;
// Treat single element arrays as the element.
while
(
const
ConstantArrayType
*
AT
=
Context
.
getAsConstantArrayType
(
FT
))
{
if
(
AT
->
getSize
().
getZExtValue
()
!=
1
)
break
;
FT
=
AT
->
getElementType
();
}
if
(
!
CodeGenFunction
::
hasAggregateLLVMType
(
FT
))
{
if
(
!
CodeGenFunction
::
hasAggregateLLVMType
(
FT
))
{
Found
=
FT
.
getTypePtr
();
Found
=
FT
.
getTypePtr
();
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
clang/test/CodeGen/x86_32-arguments.c
+
6
−
0
View file @
097353cb
...
@@ -145,4 +145,10 @@ struct s34 { struct { int : 0 } a; float b; } f34(void) {}
...
@@ -145,4 +145,10 @@ struct s34 { struct { int : 0 } a; float b; } f34(void) {}
// RUN: grep 'define i16 @f35()' %t &&
// RUN: grep 'define i16 @f35()' %t &&
struct
s35
{
struct
{
int
:
0
}
a
;
char
b
;
char
c
;
}
f35
(
void
)
{}
struct
s35
{
struct
{
int
:
0
}
a
;
char
b
;
char
c
;
}
f35
(
void
)
{}
// RUN: grep 'define i16 @f36()' %t &&
struct
s36
{
struct
{
int
:
0
}
a
[
2
][
10
];
char
b
;
char
c
;
}
f36
(
void
)
{}
// RUN: grep 'define float @f37()' %t &&
struct
s37
{
float
c
[
1
][
1
];
}
f37
(
void
)
{}
// RUN: true
// RUN: true
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment