Commit Graph

1248 Commits

Author SHA1 Message Date
Daniel Marjamäki 632a6b664c AST: Harden handling of C++11 2017-04-10 23:29:15 +02:00
Daniel Marjamäki 2c43075ece AST: weird clang syntax 2017-04-10 23:05:41 +02:00
Daniel Marjamäki 5e1b6aee8c AST: Fix hang for weird VLA code 2017-04-10 22:17:34 +02:00
Daniel Marjamäki ffeadbdde4 AST: improved handling for struct initialization 's = { [0] = 123 }' 2017-04-10 07:25:18 +02:00
Daniel Marjamäki d92c529aa6 AST: Fix wrong handling of struct initialization, caused hang 2017-04-09 22:06:13 +02:00
Daniel Marjamäki e6005dfa3c AST: Fix AST for lambda '[&]{..}' 2017-04-09 17:49:55 +02:00
Daniel Marjamäki 8ffed6862d Tokenizer: Add --check-config warning for macro with semicolon in argument 2017-04-07 19:19:10 +02:00
Daniel Marjamäki 392a06a44b AST: better handling of '(struct X){...}' 2017-04-06 21:28:13 +02:00
Daniel Marjamäki 50da7d4919 Tokenizer: Write syntax error if there is C++ code in C file. 2017-04-06 08:50:35 +02:00
Daniel Marjamäki e6ed08c4d8 Fixed #7976 (Internal error. Token::astOperand1() cyclic dependency. (ticket nr 2, new regression)) 2017-04-05 11:00:02 +02:00
Daniel Marjamäki 9c5a136f04 Fixed #7975 (crash: Tokenizer::createLinks2 problem with enable_if<x&&y,C*>) 2017-04-03 21:48:22 +02:00
Daniel Marjamäki abb43b6a81 Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))') 2017-04-02 19:44:33 +02:00
Daniel Marjamäki c18fe8262b Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))') 2017-03-19 07:26:11 +01:00
Daniel Marjamäki ecc59859e1 Don't simplify _Bool in TokenList 2017-03-04 11:13:28 +01:00
Simon Martin 0943b2145b Ticket #7891: Do not remove spaces in the internal representation for template instantiations. 2017-02-05 17:35:29 +01:00
Matthias Krüger f80e888b7e run astyle
[ci-skip]
2017-01-31 16:22:31 +01:00
Simon Martin 5262ed018e Ticket #7440: Function calls should not abort pointer alias analysis for local variables. 2017-01-27 22:56:28 +01:00
Simon Martin bd92ddd386 Ticket #7850: Properly handle C functions called "class". 2017-01-06 21:16:28 +01:00
Robert Reif 4123b457d7 Fixed #7441 (SymbolDatabase: No scope when function return type not specified) 2017-01-06 11:53:17 +01:00
Robert Reif 4c25e798b1 Fixed #7865 (Tokenizer::createLinks2(): does does set links for <> in struct template) 2016-12-31 22:05:29 +01:00
Daniel Marjamäki 1b21767954 Fixed #5666 (False positive when modifiying std::string by pointer) 2016-12-26 17:13:35 +01:00
Daniel Marjamäki 426d1b4196 Merge pull request #846 from simartin/ticket_7805
Ticket #7805: Ignore enumerators when simplifying known variables.
2016-12-21 17:58:48 +01:00
Simon Martin 5119ae84b8 Ticket #7805: Ignore enumerators when simplifying known variables. 2016-12-17 14:05:26 +01:00
Daniel Marjamäki d4f2512421 Tokenizer::simplifyKnownVariables: Added bailout when pointer alias is simplified and loop is encountered 2016-12-11 19:12:23 +01:00
orbitcowboy 8a45c3192b There is not need to clear a string directly after its creation. 2016-11-30 10:39:14 +01:00
Stefan Weil 57b57428c2 Fix some typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Daniel Marjamäki 74fa69fe5e Fixed #7821 (syntax error, first token is &) 2016-11-20 17:59:50 +01:00
Daniel Marjamäki 5b377ea2e4 Fixed #7821 (segmentation fault, invalid last token) 2016-11-20 14:15:51 +01:00
Daniel Marjamäki efa3aba32a Remove Tokenizer::simplifyNull() 2016-10-18 21:44:02 +02:00
Daniel Marjamäki 9cea2d6dfa Tokenizer: Removed simplifications of standard functions that should be handled through configuration. 2016-10-18 19:25:58 +02:00
Daniel Marjamäki d09a8dde57 Improved char literal handling. In the 'normal' tokenlist these should not be simplified to integer literals. 2016-10-12 10:20:24 +02:00
Daniel Marjamäki bcbc8ef017 Fixed #7747 (Syntax error when setting the bitcount of an enum defined inside a struct) 2016-10-04 15:57:43 +02:00
Robert Reif 62ac40fc5e Fixed #7706 ((debug) Executable scope 'foo' with unknown function.) 2016-08-20 22:43:27 +02:00
Daniel Marjamäki 7d6c587580 Fixed #6113 (Tokenizer::simplifyFunctionPointer: wrong simplification of usage 'return (*f)();') 2016-08-04 19:10:08 +02:00
Daniel Marjamäki 864cef2fd2 astyle formatting
[ci skip]
2016-08-02 09:03:03 +02:00
Daniel Marjamäki 31484133c0 Fixed #7158 (Tokenizer::createLinks2(): does not set links for < > in 'enum { value = boost::mpl::at_c<B,C> };') 2016-08-01 22:26:11 +02:00
Daniel Marjamäki 71f62950ed Tokenizer::findGarbageCode: Make it less picky about 'UNKNOWN_MACRO if ..' 2016-07-26 14:35:11 +02:00
Daniel Marjamäki 7ff9545b10 Fixed #7637 (FP syntax error assignment in switch) 2016-07-26 12:15:55 +02:00
Daniel Marjamäki fd19ab4ed1 fix garbage code handling 2016-07-26 08:50:00 +02:00
Daniel Marjamäki adf16fae8b Remove handling of ##, __FILE__, __LINE__ from tokenizer 2016-07-25 07:58:03 +02:00
Daniel Marjamäki ed4a47de45 Tokenizer: Improve syntax checking of switch,if,while 2016-07-22 16:54:24 +02:00
Daniel Marjamäki 3eef225b36 Revert preprocessor fix for struct tag macros. There are performance problems. 2016-07-19 18:59:58 +02:00
Daniel Marjamäki 4cc4ebd5cd Travis: run slow unit test on travis that is too slow to run on development machines 2016-07-19 17:10:49 +02:00
Daniel Marjamäki 72ead10d93 cleanup tests 2016-07-18 10:52:38 +02:00
Daniel Marjamäki 45ee29d5dc Fixed #7604 (simplifyCalculation: expression '0 && x[2]' is not simplified properly) 2016-07-17 15:52:53 +02:00
Daniel Marjamäki 6e3d5dc0d1 Fixed #7580 (False positive when using logical operator keywords 'and', 'or') 2016-07-16 20:21:31 +02:00
Daniel Marjamäki be755af762 Removed todo testcase for #5783 2016-05-26 18:47:36 +02:00
Daniel Marjamäki 06a594a9e0 Fixed #6207 ('not' misinterpreted as alternative C token) 2016-05-24 13:33:21 +02:00
Daniel Marjamäki 06d5e73e88 Fixed #7471 (Tokenizer::prepareTernaryOpForAST: typedef with comma inside ?:) 2016-05-22 11:33:21 +02:00
Alexander Mai 303a85a930 #4195 segmentation fault of cppcheck (invalid code). Fix segfault which turned up after refactoring the enum handling code. 2016-05-17 22:19:23 +02:00
Alexander Mai 9d1302d523 #7490 sizeof('a') should be sizeof(int) in C mode. Previous fix was hardcoding 4 for C. 2016-05-14 22:52:43 +02:00
Daniel Marjamäki 2cb03b3fd0 Fixed #7409 (Tokenizer: Links not set properly 'Data<T&&>') 2016-05-14 20:40:30 +02:00
Alexander Mai 251fc022fa #7490 sizeof('a') should be 4 in C mode 2016-05-14 13:05:44 +02:00
Daniel Marjamäki 1caa79c45f Tokenizer::simplifyPointerConst: Remove simplification. Its purpose was to avoid crash for garbage code (#6900). This fixes #7485. 2016-05-08 21:32:34 +02:00
PKEuS f0fb7a8245 Simplify __attribute__ earlier (#7462) 2016-05-04 13:51:34 +02:00
PKEuS b65cacf4b1 Tokenizer::simplifyStaticConst(): Support "struct" and operator:: (#7403) 2016-05-04 12:33:19 +02:00
Daniel Marjamäki dc2a92263a Fixed #7426 (RFC: time to replace simplifyEnum?) 2016-04-22 06:02:54 +02:00
amai2012 9f4d4bdde7 #6167 Refactoring: rename test functions. Rename TestTokenizer::removeCast*. TestTokenizer::varid* doesn't exist (anymore?). 2016-03-27 17:36:07 +02:00
Daniel Marjamäki ac8341e3de keep type suffixes after constant folding using bit operations 2016-03-21 21:20:02 +01:00
Daniel Marjamäki 253bfe432c Fixed #7410 (Tokenizer: function pointer with throw()) 2016-02-29 08:02:02 +01:00
Daniel Marjamäki c0056d2455 Fixed #7347 (AST: wrong ast when template variable is declared and initiailized in if 'if (A::B<C> abc = 123)') 2016-01-26 10:40:44 +01:00
Daniel Marjamäki 7663b6ee75 Fixed #7348 (AST: wrong ast for cast that starts with :: '(::X*)x;') 2016-01-25 10:29:24 +01:00
Daniel Marjamäki 26612ab846 Fixed #5332 (Tokenizer: if braces not added properly 'if (x==123) label: {}') 2016-01-23 11:43:48 +01:00
Daniel Marjamäki 8568a80208 Fixed #6883 (Template parsing error) 2016-01-20 16:10:58 +01:00
Daniel Marjamäki ab441f3fb1 Tokenizer:vardecl: split up reference variables declared in class better 2016-01-19 15:27:11 +01:00
Daniel Marjamäki a0971355b7 Tweaked Tokenizer::simplifyAsm2() 2016-01-04 19:18:10 +01:00
Daniel Marjamäki f1d3d5b47d TestTokenizer::simplifyAsm2: replace invalid example code with valid code 2016-01-04 10:50:52 +01:00
Daniel Marjamäki b748453b30 Tokenizer: Improve handling of block declarations (C extension) 2016-01-04 09:59:53 +01:00
Daniel Marjamäki 79e663dd6f Settings: Remove '_' prefix for public member variables 2016-01-03 16:18:17 +01:00
Daniel Marjamäki cd89e68f60 Fixed #6931 (noexcept and override qualifiers plus less than operator results in a syntax error) 2016-01-03 12:22:07 +01:00
Daniel Marjamäki 91d0f0fee0 astyle formatting
[ci skip]
2016-01-03 09:38:03 +01:00
Daniel Marjamäki ed12b4dc44 Fixed #7253 (AST wrong on nested reinterpret_cast) 2016-01-03 09:37:38 +01:00
Daniel Marjamäki 95009a4630 Merge pull request #745 from lanurmi/2016_ad
Update copyright year to 2007-2016.
2016-01-01 22:57:19 +01:00
Daniel Marjamäki f5715c1496 Rename Unspecified platform type to Native 2016-01-01 16:39:41 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 8171154e12 Fixed #7230 (Confusing code snippet in error message) 2015-12-31 01:15:49 +01:00
Daniel Marjamäki 15ecb26a6c Tokenizer: Moved simplifyAssignmentInFunctionCall from simplifyTokenList1 to simplifyTokenList2 2015-12-28 13:58:41 +01:00
PKEuS 8f22e4924c Updated AStyle to version 2.05.1
Tweaked runastyle.bat a little bit.
2015-12-17 15:53:13 +01:00
Daniel Marjamäki 8fd62e0cf9 Fixed #4931 (Wrong calculation of constants (simplifying: +,<<,% operations)) 2015-11-20 19:43:11 +01:00
PKEuS 1566b72c5b Fixed broken AST for simple expressions with delete operator.
Fixed cppcheck internal warning
2015-11-18 21:37:37 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS feae241fc0 Fixed simplification of pointers (#6829) 2015-11-10 14:45:24 +01:00
PKEuS 7a90b763f6 Tokenizer::simplifyLabelsCaseDefault(): Do not insert ; between two cases. 2015-11-06 19:59:23 +01:00
PKEuS 95a0c0f14c Limit the number of cases created by Tokenizer::simplifyCaseRange(). 2015-11-06 19:21:56 +01:00
PKEuS 1fe1d7ea4a Extended Tokenizer::simplifyCaseRange() to support also ranges of chars. 2015-11-06 18:46:43 +01:00
PKEuS 41b1b9d850 Support case ranges (gcc extension, #6490) 2015-11-06 18:39:03 +01:00
PKEuS be36539ad7 Fixed AST generation for C++11-style initialization (#6528) 2015-11-06 17:34:26 +01:00
PKEuS 62bc827eb0 Fixed createLinks2() when inheriting from a template (#6601) 2015-11-06 10:44:37 +01:00
PKEuS 8374e8414b Fixed use-after-free in clang test suite introduced recently (#7087) 2015-11-03 19:24:19 +01:00
PKEuS b97f9e576d Fixed crash in clang test suite introduced by previous commit. 2015-11-02 22:53:05 +01:00
PKEuS b049050792 Fixed wrong parsing of ^{} 2015-11-02 22:14:41 +01:00
PKEuS 4ee56d2306 Fixed simplifyAssignmentInFunctionCall for complex expressions (#6927) 2015-10-27 20:01:40 +01:00
Daniel Marjamäki fc2bf2ef08 Fixed #7065 (AST: More explicit handling of lambda functions, generate ast for ';new Fred;') 2015-10-20 23:55:29 +02:00
Alexander Mai 3b1d849476 Correct template syntax check which got introduced by an attempt fix #6865. Disable test for #6865, adjust some modified tests and add new regression tests 2015-10-19 20:03:33 +02:00
Daniel Marjamäki b856ac51dd Fixed #7064 (Tokenizer: Wrong simplification of 'a.public:') 2015-10-19 10:01:57 +02:00
Daniel Marjamäki 9be284e80f AST: proper operator precedence for c++11 initializer {} and :: 2015-10-18 16:58:15 +02:00
Daniel Marjamäki 9bb2af1893 Fixed #7059 (AST: handle C++ initialization with {} better) 2015-10-18 13:43:39 +02:00
Daniel Marjamäki ec87b09d89 Fixed #7056 (iscast does not handle '(ulong)~0' properly, Tokenizer::simplifyCalculations wrongly simplifies '(ulong)~0' to 'ulong~0') 2015-10-17 18:58:13 +02:00
Daniel Marjamäki 30af2fcd73 iscast: handle '(ulong)~0' better 2015-10-17 18:25:27 +02:00
Daniel Marjamäki c88297c971 Fixed #7054 (AST: handle C++ initialization with {} better) 2015-10-17 17:03:24 +02:00