Use reference instead of pointer

This commit is contained in:
thomasb8138 2017-02-22 21:55:46 +01:00
parent 78a20b72a3
commit cb177712f6
2 changed files with 3 additions and 4 deletions

View File

@ -269,7 +269,7 @@ std::string TokenStreamRewriter::getText(const std::string &programName, const I
std::string buf;
// First, optimize instruction stream
std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> indexToOp = reduceToSingleOperationPerIndex(&rewrites);
std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> indexToOp = reduceToSingleOperationPerIndex(rewrites);
// Walk buffer, executing instructions and emitting tokens
size_t i = start;
@ -305,9 +305,8 @@ std::string TokenStreamRewriter::getText(const std::string &programName, const I
}
std::unordered_map<size_t, TokenStreamRewriter::RewriteOperation*> TokenStreamRewriter::reduceToSingleOperationPerIndex(
std::vector<TokenStreamRewriter::RewriteOperation*> *rewrites_ptr) {
std::vector<TokenStreamRewriter::RewriteOperation*> &rewrites) {
std::vector<TokenStreamRewriter::RewriteOperation*> &rewrites = *rewrites_ptr;
// WALK REPLACES
for (size_t i = 0; i < rewrites.size(); ++i) {

View File

@ -267,7 +267,7 @@ namespace antlr4 {
///
/// Return a map from token index to operation.
/// </summary>
virtual std::unordered_map<size_t, RewriteOperation*> reduceToSingleOperationPerIndex(std::vector<RewriteOperation*> *rewrites);
virtual std::unordered_map<size_t, RewriteOperation*> reduceToSingleOperationPerIndex(std::vector<RewriteOperation*> &rewrites);
virtual std::string catOpText(std::string *a, std::string *b);