* Added declaration for deletePrevious function
* Added definition for deletePrevious function
* Fixed crash from deleteThis invalidating pointers
The crash was caused by deleteThis() invalidating the pointer to a constant variable usage. This happened when a usage followed an assignment. This fixes bug #8579.
* Added tokensFront to match tokensBack
This means deletePrevious can set the list's front if necessary.
* Initialised tokensFront in appropriate places
* Switched to using default Token constructor
* Switched to using Token default constructor
* Switched to using default constructor for Token
* Added missing argument to Token constructor
* Changed to use default constructor for Tokens
* Switched to using default constructor for Tokens
* Switched to using default constructor for Token
* Added new test for deleting front Token
Also made sure to use the correct constructor for Token in other tests.
* Syntax error
* Replaced tokensFront and tokensBack with a struct
This decreases the size of the Token class for performance purposes.
* Replaced tokensFront and tokensBack with a struct
* Added tokensFrontBack to destructor
* Reworked to use TokensBackFront struct
Also ran astyle.
* Reworked to use TokenList's TokensFrontBack member
* Reworked to use TokensFrontBack struct
* Reworked to use TokensFrontBack struct
* Reworked to work with TokensFrontBack struct
* Removed unnecessary scope operator
* Added missing parentheses
* Fixed syntax error
* Removed unnecessary constructor
* Default constructor now 0-initialises everything
This is safer for not using a temporary TokensFrontBack object, and doesn't use delegating constructors which aren't supported yet.
* Fixed unsafe null check
* Added missing explicit keyword
* Fixing stylistic nits
Removed default constructor as it has been superseded by the single-argument constructor with a default argument value.
Renamed listEnds to tokensFrontBack.
Fixed if statement that was supposed to be adding safety but would actually cause a crash if tokensFrontBack was null.
* Fixing stylistic nits
Removed default constructor and replaced it with a single-argument constructor with a default value.
* Fixing stylistic nits
Renamed _listEnds to _tokensFrontBack.
* Fixing stylistic nits
Renamed _listEnds to _tokensFrontBack.
* added support for reading borland c++ builder 6 projects
* add: fetch sysdefines from project
add: start providing bcb6 predefines (WIP)
* configure all the internal defines for BCB6
* make sure define strings don't start with ';'
* improvements on bwoesters BCB6 project support
- improved `*.bpr` XML handling by reducing the number of loops
- added `const` where aplicable
- optimized compiler argument parser performance
- reformatted code with provided astyle config
* - undo looping (keep it the same as the other implementations)
- keep parsing of cflags simple and separate from the synonym cleanup (no need for micro optimization in this place)
- move input validation to FileSettings::setDefines
- re-run astyle
* use [] instead of at() when comparing characters
* Remove duplicate namespace aliases so they don't produce syntax errors.
DACA2 results showed new SymbolDatabase syntax errors when duplicate
namespace aliases were simplified improperly. The solution is to remove
them in the tokenizer when found.
* Add tests for deleting namespace aliases at end of token list.
* Use eraseTokens to delete multiple tokens at once.
* Optimised simplifyKnownVariables
Changed the check for references to constant variables so instead of iterating through all tokens looking for references (which is very slow for large files), usages of each known variable are recorded so each usage can be checked for whether or not it is a reference. Just checking known usages is a lot quicker than checking through all tokens.
* Fixed test error caused by incorrect code
* Fixes to constant variable simplification optimisation
Indexing variables by varId is easier than by Token pointer, but means we also have to store a reference to the constant variable Token in another collection.
Switched to using unordered_map over map as it has slightly better find performance.
* Fixed incorrect simplification behaviour
This should remove constant variables correctly and efficiently. Requires additional functions, Token::deleteThisInPlace() and TokenList::front(Token*).
* Added setter for TokenList::first
This allows code that adds and removes Tokens from the list to do so without copying nodes into other nodes, which sometimes create difficulties.
* Added deleteThisInPlace function
This allows a token to delete itself without invalidating pointers to the node after it. If this token is the first or last in a list the calling code will have to remember to change the list's front or back.
* Added declaration for deleteThisInPlace()
* Removed premature MatchCompiler optimisation
* Added and removed some functions
Added declaration for deleteToken(Token*) which deletes a single token from the list
Removed public front(Token*) because it broke encapsulation
* Implemented deleteToken(Token*) function
* Removed 'delete this' from deleteThisInPlace
* Switched to using safer function
TokenList::deleteToken is better than calling straight into Token::deleteThisInPlace because it doesn't call delete this and doesn't break the TokenList's encapsulation.
* Replace constant variables in reverse order
This fixes the problem where you have two constant value assignment statements in a row. Replacing and deleting them in reverse order means we avoid the problem of deleteThis() potentially invalidating the pointer to the start of the next assignment statement
* Removed unneeded and unsafe deleteThisInPlace
* Removed unneeded and unsafe deleteThisInPlace
* Removed unneeded deleteToken
* Removed unneeded deleteToken
* Removed extra whitespace
* Don't remove the volatile keyword so we can properly overload functions.
I fixed all the checks that had tests that use volatile. There will
probably be more changes needed due to lack of test coverage for
volatile in some checks.
* Fix unused private function warning.
* Add support for namespace aliases and C++17 nested namespaces.
These are implemented as tokenizer simplifications so changes are not
needed to the tokenizer and symbol database.
* Fix codacy warning.
* SymbolDatabase: harden code for missing links
Missing links for templates are common so check links before using them
to prevent crashes.
* SymbolDatabase: replace link check and single token match with match of two tokens
On Windows searching for the last colon finds the colon which is part of
the path of the source file (e.g. "C:/projects/a.cpp"). Thus the path is
saved incomplete. This fix searches for the second instead of the last
colon and uses the data after the second colon as the path of the source
file.
* SymbolDatabase: improve checking of uninstantiated templates
* Add bailout and debug warning for '>' token without a link in SymbolDatabase::findFunction()..
Don't crash on bad code simplification from tokenizer.