Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
preprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
preprocessor
Commits
75b000a0
Verified
Commit
75b000a0
authored
Aug 14, 2019
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
Macro processor: ensure that all read-accessors return a const reference
Useless copies are thus avoided in some situations.
parent
8c1e48a0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#1611
passed
Aug 14, 2019
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/macro/Directives.hh
+2
-2
2 additions, 2 deletions
src/macro/Directives.hh
src/macro/Expressions.hh
+7
-7
7 additions, 7 deletions
src/macro/Expressions.hh
with
9 additions
and
9 deletions
src/macro/Directives.hh
+
2
−
2
View file @
75b000a0
...
...
@@ -71,7 +71,7 @@ namespace macro
Include
(
ExpressionPtr
expr_arg
,
Environment
&
env_arg
,
Tokenizer
::
location
location_arg
)
:
Directive
(
env_arg
,
move
(
location_arg
)),
expr
{
move
(
expr_arg
)}
{
}
void
interpret
(
ostream
&
output
,
bool
no_line_macro
)
override
;
inline
string
getName
()
const
{
return
name
;
}
inline
const
string
&
getName
()
const
{
return
name
;
}
};
...
...
@@ -84,7 +84,7 @@ namespace macro
IncludePath
(
ExpressionPtr
expr_arg
,
Environment
&
env_arg
,
Tokenizer
::
location
location_arg
)
:
Directive
(
env_arg
,
move
(
location_arg
)),
expr
{
move
(
expr_arg
)}
{
}
void
interpret
(
ostream
&
output
,
bool
no_line_macro
)
override
;
inline
string
getPath
()
const
{
return
path
;
}
inline
const
string
&
getPath
()
const
{
return
path
;
}
};
...
...
...
...
This diff is collapsed.
Click to expand it.
src/macro/Expressions.hh
+
7
−
7
View file @
75b000a0
...
...
@@ -378,8 +378,8 @@ namespace macro
public
:
inline
size_t
size
()
const
{
return
tup
.
size
();
}
inline
bool
empty
()
const
{
return
tup
.
empty
();
}
inline
vector
<
ExpressionPtr
>
getValue
()
const
{
return
tup
;
}
inline
ExpressionPtr
at
(
int
i
)
const
{
return
tup
.
at
(
i
);
}
inline
const
vector
<
ExpressionPtr
>
&
getValue
()
const
{
return
tup
;
}
inline
const
ExpressionPtr
&
at
(
int
i
)
const
{
return
tup
.
at
(
i
);
}
BoolPtr
is_equal
(
const
BaseTypePtr
&
btp
)
const
override
;
inline
BoolPtr
istuple
()
const
override
{
return
make_shared
<
Bool
>
(
true
,
env
,
location
);
}
BoolPtr
contains
(
const
BaseTypePtr
&
btp
)
const
override
;
...
...
@@ -418,8 +418,8 @@ namespace macro
ExpressionPtr
clone
()
const
noexcept
override
;
public
:
inline
size_t
size
()
const
{
return
arr
.
size
();
}
inline
vector
<
ExpressionPtr
>
getValue
()
const
{
return
arr
;
}
inline
ExpressionPtr
at
(
int
i
)
const
{
return
arr
.
at
(
i
);
}
inline
const
vector
<
ExpressionPtr
>
&
getValue
()
const
{
return
arr
;
}
inline
const
ExpressionPtr
&
at
(
int
i
)
const
{
return
arr
.
at
(
i
);
}
inline
bool
empty
()
const
{
return
arr
.
empty
()
&&
!
range1
&&
!
range2
;
}
BaseTypePtr
plus
(
const
BaseTypePtr
&
bt
)
const
override
;
BaseTypePtr
minus
(
const
BaseTypePtr
&
bt
)
const
override
;
...
...
@@ -466,7 +466,7 @@ namespace macro
make_shared
<
Variable
>
(
name
,
env
,
location
);
}
public
:
inline
string
getName
()
const
noexcept
{
return
name
;
}
inline
const
string
&
getName
()
const
noexcept
{
return
name
;
}
inline
codes
::
BaseType
getType
()
const
{
return
env
.
getType
(
name
);
}
};
...
...
@@ -491,8 +491,8 @@ namespace macro
public
:
inline
void
printName
(
ostream
&
output
)
const
noexcept
{
output
<<
name
;
}
void
printArgs
(
ostream
&
output
)
const
noexcept
;
inline
string
getName
()
const
{
return
name
;
}
inline
vector
<
ExpressionPtr
>
getArgs
()
const
{
return
args
;
}
inline
const
string
&
getName
()
const
{
return
name
;
}
inline
const
vector
<
ExpressionPtr
>
&
getArgs
()
const
{
return
args
;
}
};
...
...
...
...
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