Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
angle
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
angle
Commits
bd10cf55
Commit
bd10cf55
authored
Jun 20, 2013
by
Nicolas Capens
Committed by
Shannon Woods
Jul 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Assign unique id's to symbols inserted directly into a symbol table level.
TRAC #23359 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Nicolas Capens
parent
51a53c7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
18 deletions
+10
-18
SymbolTable.cpp
src/compiler/SymbolTable.cpp
+2
-0
SymbolTable.h
src/compiler/SymbolTable.h
+8
-18
No files found.
src/compiler/SymbolTable.cpp
View file @
bd10cf55
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#include "common/angleutils.h"
#include "common/angleutils.h"
int
TSymbolTableLevel
::
uniqueId
=
0
;
TType
::
TType
(
const
TPublicType
&
p
)
:
TType
::
TType
(
const
TPublicType
&
p
)
:
type
(
p
.
type
),
precision
(
p
.
precision
),
qualifier
(
p
.
qualifier
),
primarySize
(
p
.
primarySize
),
secondarySize
(
p
.
secondarySize
),
array
(
p
.
array
),
layoutQualifier
(
p
.
layoutQualifier
),
arraySize
(
p
.
arraySize
),
type
(
p
.
type
),
precision
(
p
.
precision
),
qualifier
(
p
.
qualifier
),
primarySize
(
p
.
primarySize
),
secondarySize
(
p
.
secondarySize
),
array
(
p
.
array
),
layoutQualifier
(
p
.
layoutQualifier
),
arraySize
(
p
.
arraySize
),
maxArraySize
(
0
),
arrayInformationType
(
0
),
interfaceBlockType
(
0
),
structure
(
0
),
structureSize
(
0
),
deepestStructNesting
(
0
),
fieldName
(
0
),
mangled
(
0
),
typeName
(
0
)
maxArraySize
(
0
),
arrayInformationType
(
0
),
interfaceBlockType
(
0
),
structure
(
0
),
structureSize
(
0
),
deepestStructNesting
(
0
),
fieldName
(
0
),
mangled
(
0
),
typeName
(
0
)
...
...
src/compiler/SymbolTable.h
View file @
bd10cf55
...
@@ -113,7 +113,7 @@ protected:
...
@@ -113,7 +113,7 @@ protected:
//
//
struct
TParameter
{
struct
TParameter
{
TString
*
name
;
TString
*
name
;
TType
*
type
;
TType
*
type
;
};
};
//
//
...
@@ -196,8 +196,10 @@ public:
...
@@ -196,8 +196,10 @@ public:
TSymbolTableLevel
()
{
}
TSymbolTableLevel
()
{
}
~
TSymbolTableLevel
();
~
TSymbolTableLevel
();
bool
insert
(
TSymbol
&
symbol
)
bool
insert
(
TSymbol
&
symbol
)
{
{
symbol
.
setUniqueId
(
++
uniqueId
);
//
//
// returning true means symbol was added to the table
// returning true means symbol was added to the table
//
//
...
@@ -216,21 +218,12 @@ public:
...
@@ -216,21 +218,12 @@ public:
return
(
*
it
).
second
;
return
(
*
it
).
second
;
}
}
const_iterator
begin
()
const
{
return
level
.
begin
();
}
const_iterator
end
()
const
{
return
level
.
end
();
}
void
relateToOperator
(
const
char
*
name
,
TOperator
op
);
void
relateToOperator
(
const
char
*
name
,
TOperator
op
);
void
relateToExtension
(
const
char
*
name
,
const
TString
&
ext
);
void
relateToExtension
(
const
char
*
name
,
const
TString
&
ext
);
protected
:
protected
:
tLevel
level
;
tLevel
level
;
static
int
uniqueId
;
// for unique identification in code generation
};
};
enum
ESymbolLevel
enum
ESymbolLevel
...
@@ -244,7 +237,7 @@ enum ESymbolLevel
...
@@ -244,7 +237,7 @@ enum ESymbolLevel
class
TSymbolTable
{
class
TSymbolTable
{
public
:
public
:
TSymbolTable
()
:
uniqueId
(
0
)
TSymbolTable
()
{
{
//
//
// The symbol table cannot be used until push() is called, but
// The symbol table cannot be used until push() is called, but
...
@@ -280,14 +273,13 @@ public:
...
@@ -280,14 +273,13 @@ public:
precisionStack
.
pop_back
();
precisionStack
.
pop_back
();
}
}
bool
declare
(
TSymbol
&
symbol
)
bool
declare
(
TSymbol
&
symbol
)
{
{
return
insert
(
currentLevel
(),
symbol
);
return
insert
(
currentLevel
(),
symbol
);
}
}
bool
insert
(
ESymbolLevel
level
,
TSymbol
&
symbol
)
bool
insert
(
ESymbolLevel
level
,
TSymbol
&
symbol
)
{
{
symbol
.
setUniqueId
(
++
uniqueId
);
return
table
[
level
]
->
insert
(
symbol
);
return
table
[
level
]
->
insert
(
symbol
);
}
}
...
@@ -305,7 +297,6 @@ public:
...
@@ -305,7 +297,6 @@ public:
void
relateToExtension
(
ESymbolLevel
level
,
const
char
*
name
,
const
TString
&
ext
)
{
void
relateToExtension
(
ESymbolLevel
level
,
const
char
*
name
,
const
TString
&
ext
)
{
table
[
level
]
->
relateToExtension
(
name
,
ext
);
table
[
level
]
->
relateToExtension
(
name
,
ext
);
}
}
int
getMaxSymbolId
()
{
return
uniqueId
;
}
bool
setDefaultPrecision
(
const
TPublicType
&
type
,
TPrecision
prec
){
bool
setDefaultPrecision
(
const
TPublicType
&
type
,
TPrecision
prec
){
if
(
IsSampler
(
type
.
type
))
if
(
IsSampler
(
type
.
type
))
...
@@ -347,7 +338,6 @@ protected:
...
@@ -347,7 +338,6 @@ protected:
std
::
vector
<
TSymbolTableLevel
*>
table
;
std
::
vector
<
TSymbolTableLevel
*>
table
;
typedef
std
::
map
<
TBasicType
,
TPrecision
>
PrecisionStackLevel
;
typedef
std
::
map
<
TBasicType
,
TPrecision
>
PrecisionStackLevel
;
std
::
vector
<
PrecisionStackLevel
>
precisionStack
;
std
::
vector
<
PrecisionStackLevel
>
precisionStack
;
int
uniqueId
;
// for unique identification in code generation
};
};
#endif // _SYMBOL_TABLE_INCLUDED_
#endif // _SYMBOL_TABLE_INCLUDED_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment