Skip to content

Commit

Permalink
Fixed bug where words from macros did not always go through settings …
Browse files Browse the repository at this point in the history
…parsing.

- Due to WordTokens.newHash not getting set correctly.
    - Now getting a better default value and getting set as required.
    - Can think of option for better forced constructor.
  • Loading branch information
CJCombrink committed Dec 8, 2018
1 parent 7487c7b commit 9d8335d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions Parsers/CppParser/cppdocumentprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,12 @@ QVector<WordTokens> CppDocumentProcessor::parseMacros() const
* macro due to edits before the macro can be handled using the hash
* functionality.*/
WordTokens tokens;
tokens.column = mac.utf16charsBegin() - start;
tokens.line = line;
tokens.string = QString::fromUtf8( macroBytes.mid( int32_t( mac.utf16charsBegin() - start ) ) );
tokens.hash = qHash( tokens.string );
tokens.type = WordTokens::Type::Literal;
tokens.column = mac.utf16charsBegin() - start;
tokens.line = line;
tokens.string = QString::fromUtf8( macroBytes.mid( int32_t( mac.utf16charsBegin() - start ) ) );
tokens.hash = qHash( tokens.string );
tokens.type = WordTokens::Type::Literal;
tokens.newHash = true;

TmpOptional wordOpt = checkHash( tokens, tokens.hash );
if( wordOpt.first == true ) {
Expand Down
6 changes: 3 additions & 3 deletions Parsers/CppParser/cppdocumentprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ struct WordTokens
};

HashWords::key_type hash;
uint32_t line;
uint32_t column;
uint32_t line = 0;
uint32_t column = 0;
QString string;
WordList words;
bool newHash;
bool newHash = true;
Type type;
};

Expand Down

0 comments on commit 9d8335d

Please sign in to comment.