Add MISINDENT lint warning for misleading indentation.

This commit is contained in:
Wilson Snyder
2023-07-01 10:45:25 -04:00
parent 54b4b6b378
commit 3c964147be
12 changed files with 225 additions and 8 deletions
+6
View File
@@ -433,6 +433,12 @@ string FileLine::source() const VL_MT_SAFE {
} // LCOV_EXCL_STOP
return m_contentp->getLine(m_contentLineno);
}
string FileLine::sourcePrefix(int toColumn) const VL_MT_SAFE {
const std::string src = source();
if (toColumn > static_cast<int>(src.length())) toColumn = static_cast<int>(src.length());
if (toColumn < 1) return "";
return src.substr(0, toColumn - 1);
}
string FileLine::prettySource() const VL_MT_SAFE {
string out = source();
// Drop ignore trailing newline