From b7e4083e70bf59166ebf6e1520939eec0f46e015 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 14 Oct 2018 11:10:11 -0400 Subject: [PATCH] Internals: Cleanup temp string inserts for clang-tidy. No functional change. --- src/V3EmitC.cpp | 1 + src/V3EmitCSyms.cpp | 1 + src/V3EmitMk.cpp | 1 + src/V3LangCode.h | 1 + src/V3Number.cpp | 4 ++-- src/V3PreProc.cpp | 6 +++--- src/V3Task.cpp | 5 +++-- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index a9d3cf1bf..d60c01094 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1866,6 +1866,7 @@ void EmitCImp::emitSavableImp(AstNodeModule* modp) { string funcname = de ? "__Vdeserialize" : "__Vserialize"; string writeread = de ? "read" : "write"; string op = de ? ">>" : "<<"; + // NOLINTNEXTLINE(performance-inefficient-string-concatenation) puts("void "+modClassName(modp)+"::"+funcname+"("+classname+"& os) {\n"); // Place a computed checksum to insure proper structure save/restore formatting // OK if this hash includes some things we won't dump, since just looking for loading the wrong model diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index 7a8f53c79..afa3e88ce 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -526,6 +526,7 @@ void EmitCSyms::emitSymImp() { string classname = de ? "VerilatedDeserialize" : "VerilatedSerialize"; string funcname = de ? "__Vdeserialize" : "__Vserialize"; string op = de ? ">>" : "<<"; + // NOLINTNEXTLINE(performance-inefficient-string-concatenation) puts("void "+symClassName()+"::"+funcname+"("+classname+"& os) {\n"); puts( "// LOCAL STATE\n"); // __Vm_namep presumably already correct diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index c9cc6dc03..04b1902dd 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -208,6 +208,7 @@ public: for (V3StringSet::const_iterator it = cppFiles.begin(); it != cppFiles.end(); ++it) { string cppfile = *it; string basename = V3Os::filenameNonExt(cppfile); + // NOLINTNEXTLINE(performance-inefficient-string-concatenation) of.puts(basename+".o: "+cppfile+"\n"); of.puts("\t$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $<\n"); } diff --git a/src/V3LangCode.h b/src/V3LangCode.h index 6d66e632d..d79d57e0f 100644 --- a/src/V3LangCode.h +++ b/src/V3LangCode.h @@ -23,6 +23,7 @@ #include "config_build.h" #include "verilatedos.h" + #include #include #include diff --git a/src/V3Number.cpp b/src/V3Number.cpp index 77470d155..9f4209473 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -556,8 +556,8 @@ string V3Number::displayed(FileLine*fl, const string& vformat) const { int intfmtsize = atoi(fmtsize.c_str()); bool zeropad = fmtsize.length()>0 && fmtsize[0]=='0'; while ((int)(str.length()) < intfmtsize) { - if (zeropad) str = "0"+str; - else str = " "+str; + if (zeropad) str.insert(0, "0"); + else str.insert(0, " "); } return str; } diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 32ada81e8..9e0c63dbc 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -818,7 +818,7 @@ int V3PreProcImp::getRawToken() { static string rtncmt; // Keep the c string till next call rtncmt = m_lineCmt; if (m_lineCmtNl) { - if (!m_rawAtBol) rtncmt = "\n"+rtncmt; + if (!m_rawAtBol) rtncmt.insert(0, "\n"); m_lineCmtNl = false; } yyourtext(rtncmt.c_str(), rtncmt.length()); @@ -1099,7 +1099,7 @@ int V3PreProcImp::getStateToken() { if (state() == ps_JOIN) { // Handle {left}```FOO(ARG) where `FOO(ARG) might be empty if (m_joinStack.empty()) fatalSrc("`` join stack empty, but in a ``"); string lhs = m_joinStack.top(); m_joinStack.pop(); - out = lhs+out; + out.insert(0, lhs); UINFO(5,"``-end-defarg Out:"<name()+"__Vopenarray"; - string varCode = ("VerilatedDpiOpenVar "+name - +" (&"+propName+", &"+portp->name()+");\n"); + string varCode = ("VerilatedDpiOpenVar " + // NOLINTNEXTLINE(performance-inefficient-string-concatenation) + +name+" (&"+propName+", &"+portp->name()+");\n"); cfuncp->addStmtsp(new AstCStmt(portp->fileline(), varCode)); args += "&"+name; }