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
5adde29d
Commit
5adde29d
authored
14 years ago
by
Anders Carlsson
Browse files
Options
Downloads
Patches
Plain Diff
Use the newly added function in ASTRecordLayoutBuilder.
llvm-svn: 120131
parent
abb3b21b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clang/lib/AST/RecordLayoutBuilder.cpp
+3
-38
3 additions, 38 deletions
clang/lib/AST/RecordLayoutBuilder.cpp
with
3 additions
and
38 deletions
clang/lib/AST/RecordLayoutBuilder.cpp
+
3
−
38
View file @
5adde29d
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
#include
"clang/AST/Attr.h"
#include
"clang/AST/Attr.h"
#include
"clang/AST/CXXInheritance.h"
#include
"clang/AST/Decl.h"
#include
"clang/AST/Decl.h"
#include
"clang/AST/DeclCXX.h"
#include
"clang/AST/DeclCXX.h"
#include
"clang/AST/DeclObjC.h"
#include
"clang/AST/DeclObjC.h"
...
@@ -600,7 +601,7 @@ protected:
...
@@ -600,7 +601,7 @@ protected:
/// IndirectPrimaryBases - Virtual base classes, direct or indirect, that are
/// IndirectPrimaryBases - Virtual base classes, direct or indirect, that are
/// primary base classes for some other direct or indirect base class.
/// primary base classes for some other direct or indirect base class.
llvm
::
SmallSet
<
const
CXXRecordDecl
*
,
32
>
IndirectPrimaryBases
;
CXXIndirectPrimaryBaseSet
IndirectPrimaryBases
;
/// FirstNearlyEmptyVBase - The first nearly empty virtual base class in
/// FirstNearlyEmptyVBase - The first nearly empty virtual base class in
/// inheritance graph order. Used for determining the primary base class.
/// inheritance graph order. Used for determining the primary base class.
...
@@ -666,11 +667,6 @@ protected:
...
@@ -666,11 +667,6 @@ protected:
virtual
uint64_t
GetVirtualPointersSize
(
const
CXXRecordDecl
*
RD
)
const
;
virtual
uint64_t
GetVirtualPointersSize
(
const
CXXRecordDecl
*
RD
)
const
;
/// IdentifyPrimaryBases - Identify all virtual base classes, direct or
/// indirect, that are primary base classes for some other direct or indirect
/// base class.
void
IdentifyPrimaryBases
(
const
CXXRecordDecl
*
RD
);
virtual
bool
IsNearlyEmpty
(
const
CXXRecordDecl
*
RD
)
const
;
virtual
bool
IsNearlyEmpty
(
const
CXXRecordDecl
*
RD
)
const
;
/// LayoutNonVirtualBases - Determines the primary base class (if any) and
/// LayoutNonVirtualBases - Determines the primary base class (if any) and
...
@@ -733,30 +729,6 @@ bool RecordLayoutBuilder::IsNearlyEmpty(const CXXRecordDecl *RD) const {
...
@@ -733,30 +729,6 @@ bool RecordLayoutBuilder::IsNearlyEmpty(const CXXRecordDecl *RD) const {
return
false
;
return
false
;
}
}
void
RecordLayoutBuilder
::
IdentifyPrimaryBases
(
const
CXXRecordDecl
*
RD
)
{
const
ASTRecordLayout
::
PrimaryBaseInfo
&
BaseInfo
=
Context
.
getASTRecordLayout
(
RD
).
getPrimaryBaseInfo
();
// If the record has a primary base class that is virtual, add it to the set
// of primary bases.
if
(
BaseInfo
.
isVirtual
())
IndirectPrimaryBases
.
insert
(
BaseInfo
.
getBase
());
// Now traverse all bases and find primary bases for them.
for
(
CXXRecordDecl
::
base_class_const_iterator
i
=
RD
->
bases_begin
(),
e
=
RD
->
bases_end
();
i
!=
e
;
++
i
)
{
assert
(
!
i
->
getType
()
->
isDependentType
()
&&
"Cannot layout class with dependent bases."
);
const
CXXRecordDecl
*
Base
=
cast
<
CXXRecordDecl
>
(
i
->
getType
()
->
getAs
<
RecordType
>
()
->
getDecl
());
// Only bases with virtual bases participate in computing the
// indirect primary virtual base classes.
if
(
Base
->
getNumVBases
())
IdentifyPrimaryBases
(
Base
);
}
}
void
void
RecordLayoutBuilder
::
SelectPrimaryVBase
(
const
CXXRecordDecl
*
RD
)
{
RecordLayoutBuilder
::
SelectPrimaryVBase
(
const
CXXRecordDecl
*
RD
)
{
for
(
CXXRecordDecl
::
base_class_const_iterator
I
=
RD
->
bases_begin
(),
for
(
CXXRecordDecl
::
base_class_const_iterator
I
=
RD
->
bases_begin
(),
...
@@ -801,14 +773,7 @@ void RecordLayoutBuilder::DeterminePrimaryBase(const CXXRecordDecl *RD) {
...
@@ -801,14 +773,7 @@ void RecordLayoutBuilder::DeterminePrimaryBase(const CXXRecordDecl *RD) {
// Compute all the primary virtual bases for all of our direct and
// Compute all the primary virtual bases for all of our direct and
// indirect bases, and record all their primary virtual base classes.
// indirect bases, and record all their primary virtual base classes.
for
(
CXXRecordDecl
::
base_class_const_iterator
i
=
RD
->
bases_begin
(),
RD
->
getIndirectPrimaryBases
(
IndirectPrimaryBases
);
e
=
RD
->
bases_end
();
i
!=
e
;
++
i
)
{
assert
(
!
i
->
getType
()
->
isDependentType
()
&&
"Cannot lay out class with dependent bases."
);
const
CXXRecordDecl
*
Base
=
cast
<
CXXRecordDecl
>
(
i
->
getType
()
->
getAs
<
RecordType
>
()
->
getDecl
());
IdentifyPrimaryBases
(
Base
);
}
// If the record has a dynamic base class, attempt to choose a primary base
// If the record has a dynamic base class, attempt to choose a primary base
// class. It is the first (in direct base class order) non-virtual dynamic
// class. It is the first (in direct base class order) non-virtual dynamic
...
...
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