@@ -959,19 +959,46 @@ class CPPCHECKLIB Token {
959959 */
960960 static void eraseTokens (Token *begin, const Token *end);
961961
962+ /* *
963+ * Insert new token after this token. This function will handle
964+ * relations between next and previous token also.
965+ * @param tokenStr String for the new token.
966+ */
967+ RET_NONNULL Token* insertToken (const std::string& tokenStr)
968+ {
969+ return insertToken (tokenStr, false );
970+ }
962971 /* *
963972 * Insert new token after this token. This function will handle
964973 * relations between next and previous token also.
965974 * @param tokenStr String for the new token.
966975 * @param originalNameStr String used for Token::originalName().
967- * the first one on the tokens list.
968976 */
969- RET_NONNULL Token* insertToken (const std::string& tokenStr, const std::string& originalNameStr = emptyString, const std::string& macroNameStr = emptyString)
977+ RET_NONNULL Token* insertToken (const std::string& tokenStr, const std::string& originalNameStr)
978+ {
979+ return insertToken (tokenStr, originalNameStr, false );
980+ }
981+ /* *
982+ * Insert new token after this token. This function will handle
983+ * relations between next and previous token also.
984+ * @param tokenStr String for the new token.
985+ * @param originalNameStr String used for Token::originalName().
986+ * @param macroNameStr String used for Token::getMacroName().
987+ */
988+ RET_NONNULL Token* insertToken (const std::string& tokenStr, const std::string& originalNameStr, const std::string& macroNameStr)
970989 {
971990 return insertToken (tokenStr, originalNameStr, macroNameStr, false );
972991 }
973992
974- RET_NONNULL Token* insertTokenBefore (const std::string& tokenStr, const std::string& originalNameStr = emptyString, const std::string& macroNameStr = emptyString)
993+ RET_NONNULL Token* insertTokenBefore (const std::string& tokenStr)
994+ {
995+ return insertToken (tokenStr, true );
996+ }
997+ RET_NONNULL Token* insertTokenBefore (const std::string& tokenStr, const std::string& originalNameStr)
998+ {
999+ return insertToken (tokenStr, originalNameStr, true );
1000+ }
1001+ RET_NONNULL Token* insertTokenBefore (const std::string& tokenStr, const std::string& originalNameStr, const std::string& macroNameStr)
9751002 {
9761003 return insertToken (tokenStr, originalNameStr, macroNameStr, true );
9771004 }
@@ -1404,6 +1431,8 @@ class CPPCHECKLIB Token {
14041431 */
14051432 static const char *chrInFirstWord (const char *str, char c);
14061433
1434+ RET_NONNULL Token* insertToken (const std::string& tokenStr, bool prepend);
1435+ RET_NONNULL Token* insertToken (const std::string& tokenStr, const std::string& originalNameStr, bool prepend);
14071436 RET_NONNULL Token* insertToken (const std::string& tokenStr, const std::string& originalNameStr, const std::string& macroNameStr, bool prepend);
14081437
14091438 std::string mStr ;
0 commit comments