mirror of
https://github.com/verilator/verilator.git
synced 2026-10-07 10:33:13 +02:00
Internals: More const. No functional change intended.
This commit is contained in:
+10
-10
@@ -101,9 +101,9 @@ void VFileContent::pushText(const string& text) {
|
||||
// Insert line-by-line
|
||||
string::size_type line_start = 0;
|
||||
while (true) {
|
||||
string::size_type line_end = leftover.find('\n', line_start);
|
||||
const string::size_type line_end = leftover.find('\n', line_start);
|
||||
if (line_end != string::npos) {
|
||||
string oneline(leftover, line_start, line_end - line_start + 1);
|
||||
const string oneline(leftover, line_start, line_end - line_start + 1);
|
||||
m_lines.push_back(oneline); // Keeps newline
|
||||
UINFO(9, "PushStream[ct" << m_id << "+" << (m_lines.size() - 1) << "]: " << oneline);
|
||||
line_start = line_end + 1;
|
||||
@@ -148,7 +148,7 @@ FileLine::FileLine(FileLine::EmptySecret) {
|
||||
|
||||
m_warnOn = 0;
|
||||
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
|
||||
V3ErrorCode code = V3ErrorCode(codei);
|
||||
const V3ErrorCode code = V3ErrorCode(codei);
|
||||
warnOff(code, code.defaultsOff());
|
||||
}
|
||||
}
|
||||
@@ -264,8 +264,8 @@ string FileLine::filebasenameNoExt() const {
|
||||
}
|
||||
|
||||
string FileLine::firstColumnLetters() const {
|
||||
char a = ((firstColumn() / 26) % 26) + 'a';
|
||||
char b = (firstColumn() % 26) + 'a';
|
||||
const char a = ((firstColumn() / 26) % 26) + 'a';
|
||||
const char b = (firstColumn() % 26) + 'a';
|
||||
return string(1, a) + string(1, b);
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ std::ostream& operator<<(std::ostream& os, FileLine* fileline) {
|
||||
}
|
||||
|
||||
bool FileLine::warnOff(const string& msg, bool flag) {
|
||||
V3ErrorCode code(msg.c_str());
|
||||
const V3ErrorCode code(msg.c_str());
|
||||
if (code < V3ErrorCode::EC_FIRST_WARN) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -308,14 +308,14 @@ bool FileLine::warnOff(const string& msg, bool flag) {
|
||||
|
||||
void FileLine::warnLintOff(bool flag) {
|
||||
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
|
||||
V3ErrorCode code = V3ErrorCode(codei);
|
||||
const V3ErrorCode code = V3ErrorCode(codei);
|
||||
if (code.lintError()) warnOff(code, flag);
|
||||
}
|
||||
}
|
||||
|
||||
void FileLine::warnStyleOff(bool flag) {
|
||||
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
|
||||
V3ErrorCode code = V3ErrorCode(codei);
|
||||
const V3ErrorCode code = V3ErrorCode(codei);
|
||||
if (code.styleError()) warnOff(code, flag);
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,7 @@ bool FileLine::warnIsOff(V3ErrorCode code) const {
|
||||
void FileLine::modifyStateInherit(const FileLine* fromp) {
|
||||
// Any warnings that are off in "from", become off in "this".
|
||||
for (int codei = V3ErrorCode::EC_MIN; codei < V3ErrorCode::_ENUM_MAX; codei++) {
|
||||
V3ErrorCode code = V3ErrorCode(codei);
|
||||
const V3ErrorCode code = V3ErrorCode(codei);
|
||||
if (fromp->warnIsOff(code)) warnOff(code, true);
|
||||
}
|
||||
}
|
||||
@@ -388,7 +388,7 @@ string FileLine::source() const {
|
||||
string FileLine::prettySource() const {
|
||||
string out = source();
|
||||
// Drop ignore trailing newline
|
||||
string::size_type pos = out.find('\n');
|
||||
const string::size_type pos = out.find('\n');
|
||||
if (pos != string::npos) out = string(out, 0, pos);
|
||||
// Column tracking counts tabs = 1, so match that when print source
|
||||
return VString::spaceUnprintable(out);
|
||||
|
||||
Reference in New Issue
Block a user