Commit Graph

1074 Commits

Author SHA1 Message Date
Geoffrey White
064b8773a4 CPP: Test LocalEnum and NestedEnum. 2019-08-06 15:38:10 +01:00
Nick Rolfe
257daddf3b Merge pull request #1702 from mgrettondann/cpp-add-thread_local-support-external
C++: add thread_local support
2019-08-06 14:51:27 +01:00
Jonas Jensen
d378da33e8 C++ IR: Fix performance of large array value init
There were two problems here.

1. The inline predicates `isInitialized` and `isValueInitialized` on
   `ArrayAggregateLiteral` caused their callers to materialize every
   `int` that was a valid index into the array. This was slow on huge
   value-initialized arrays.
2. The `isInitialized` predicate was used in the `TInstructionTag` IPA
   type, creating a numbered tuple for each integer in it. This seemed
   to be entirely unnecessary since the `TranslatedElement`s using those
   tags were already indexed appropriately.
2019-08-06 14:50:57 +02:00
Jonas Jensen
f160447c20 C++: Update test results to latest master 2019-08-06 14:42:47 +02:00
Geoffrey White
0029a33ee6 CPP: Deprecate Interface and remove the test. 2019-08-06 13:29:42 +01:00
Jonas Jensen
d0d6b2b70c C++: Add IR sanity queries to syntax-zoo test dir 2019-08-06 14:10:25 +02:00
Jonas Jensen
d18181f032 C++: Rename qlcfg -> syntax-zoo 2019-08-06 14:10:25 +02:00
Matthew Gretton-Dann
0e50a143af C++: Improve ReturnStackAllocatedMemory query
Update the ReturnStackAllocatedMmeory query to not give a false positive
for thread_local variables.
2019-08-06 11:22:32 +01:00
Matthew Gretton-Dann
a733625646 C++: Add Variable.isThreadLocal() 2019-08-06 11:22:26 +01:00
Dave Bartolomeo
6370391dbd C++: Add sanity test for definitions that don't dominate their uses. 2019-08-01 15:01:42 -07:00
Dave Bartolomeo
912679ef8c C++: Two IR fixes
My original fix in https://github.com/Semmle/ql/pull/1661 fixed my minimal test case, but did not fix the original failure in a Linux snapshot. The real fix is to simply not create a `TranslatedDeclarationEntry` for an extern declaration, and have `TranslatedDeclStmt` skip any such declarations. I've added a regression test for that case (multiple extern declarations with same location in a macro expansion, with control flow between them). I did verify that it generates correct IR, and that it fixes all of the "use not dominated by definition" failures in Linux.

The underlying extractor bug, that caused the above issue also caused PrintAST to print garbage. I've worked around the bug in PrintAST.qll.

I've also fixed a bug in the control flow for `try`/`catch`, where there was missing flow from the `CatchByType` of the last handler of a `try` to the enclosing handler (or `Unwind`). Hat tip to @AndreiDiaconu1 for spotting this bug.
2019-08-01 14:38:19 -07:00
zlaski-semmle
2bc66ae553 Merge pull request #1661 from dave-bartolomeo/dave/ExternDeclarations
C++: Stop generating `NoOp` instructions for declarations of externs
2019-07-31 19:09:06 -07:00
Dave Bartolomeo
972f0d97d3 C++: Stop generating NoOp instructions for declarations of externs
Previously, where we had a function-scoped `DeclarationEntry` for an extern variable or function, we would generate a `NoOp` instruction for it. There's nothing wrong with this by itself, although it was unnecessary. However, I've hit an extractor issue (Jira ticket already opened) that commonly causes multiple `DeclStmt`s to share a single `DeclarationEntry` child on extern declarations, so removing the `NoOp` instructions is an easy way to work around the extractor issue.
2019-07-30 16:49:24 -07:00
Ian Lynagh
8d8a2201b7 C++: Accept changes to getValueText 2019-07-30 23:24:52 +01:00
semmle-qlci
07fa55f331 Merge pull request #1647 from zlaski-semmle/zlaski/builtin-types-compatible-p
Approved by dave-bartolomeo
2019-07-30 20:43:39 +01:00
Ian Lynagh
6cce7ef2b7 C++: Add CFG test for constexpr_if 2019-07-30 14:07:35 +01:00
Ian Lynagh
7c763cc3bd C++: Add a test for constexpr if 2019-07-30 14:07:35 +01:00
Ziemowit Laski
889408be8f Add test case. 2019-07-29 17:17:42 -07:00
Ian Lynagh
cff1bb0b96 C++: Update lambda test output
Indexes are now 0-based.
2019-07-26 20:39:22 +01:00
Robert Marsh
05cad96086 Merge pull request #1605 from geoffw0/bitwiseneg
CPP: Make BitwiseSignCheck.ql more accurate
2019-07-24 12:33:40 -07:00
Robert Marsh
fa43ae241d Merge pull request #1615 from geoffw0/exprowninit
CPP: Test + workaround for UseInOwnInitializer.ql
2019-07-24 12:13:24 -07:00
Geoffrey White
75f77b5f47 Merge pull request #1532 from zlaski-semmle/zlaski/cpp386
[CPP-386] Add `getCanonicalQLClass()` for AST QL elements.
2019-07-24 09:38:39 +01:00
Ziemowit Laski
e989eabc0a Update test case (remove references to MacroInvocationStmt and MacroInvocationExpr) 2019-07-22 11:09:30 -07:00
Geoffrey White
d39d9bf1f0 CPP: Workaround FPs. 2019-07-22 11:48:25 +01:00
Geoffrey White
185ca590f2 CPP: Test exposing UseInOwnInitializer FPs. 2019-07-22 11:34:01 +01:00
Ziemowit Laski
a0570213d7 [CPP-386] Separate printing of casts and conversion, per Dave's request. 2019-07-19 16:56:22 -07:00
Ziemowit Laski
45d944411f [CPP-386] Fix Local{Class,Struct,Union}, macro invocations,
printing of member functions and operators.
2019-07-18 16:09:04 -07:00
Ziemowit Laski
926742561b [CPP-340] Eliminate superfluous print-outs of NestedStruct,
`NestedUnion` and `MemberFunction`
2019-07-17 13:39:43 -07:00
Geoffrey White
48a60651b6 CPP: Fix query. 2019-07-17 11:43:05 +01:00
Geoffrey White
aa368d8763 CPP: Add test cases. 2019-07-17 11:38:59 +01:00
Ziemowit Laski
f0982791e3 [CPP-340] Remove colons and extraenous QLDoc comments; add a few more classes. 2019-07-16 17:58:39 -07:00
zlaski-semmle
6764390970 Merge pull request #1586 from geoffw0/norm-taint-test
CPP: Normalize the taint tests
2019-07-16 11:49:42 -07:00
Geoffrey White
1b7d1c37ec CPP: Test showing that Adding365daysPerYear.ql doesn't actually care whether the return value of the time conversion function is checked. 2019-07-16 17:29:30 +01:00
Geoffrey White
4df176ae34 CPP: Add test coverage for isModifiedByArithmeticOperation. 2019-07-15 19:42:50 +01:00
Geoffrey White
cf194219b9 CPP: Fix FPs. 2019-07-15 14:58:35 +01:00
Geoffrey White
5362fef81c CPP: Additional AllocaInLoop test cases. 2019-07-15 14:50:02 +01:00
Ziemowit Laski
c906560edd Fix up expected IR output after rebase. 2019-07-13 12:57:25 -07:00
Ziemowit Laski
960a41be85 Handle __builtin_addressof. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
175ba7b3b0 Fix up .expected on the IR side. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
2637c22732 Fix up .expected file. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
e5fc07660d [CPP-386] Print QL AST classes next to elements in PrintAST trees. 2019-07-13 12:23:09 -07:00
Robert Marsh
41e46f6686 Merge pull request #1584 from geoffw0/swap
CPP: Model std::swap
2019-07-12 10:41:14 -07:00
Geoffrey White
a9b953f89a CPP: Flip test output for consistency and easy comparison with the other tests. 2019-07-12 18:18:08 +01:00
Geoffrey White
c2fd2e273e CPP: Model taint flow through std::swap. 2019-07-12 18:00:39 +01:00
Geoffrey White
f132bca06e CPP: Add a taint flow test of 'std::swap'. 2019-07-12 16:37:01 +01:00
semmledocs-ac
e1da6e915c Merge pull request #1515 from geoffw0/continuefalseloop
CPP: Improvements to ContinueInFalseLoop.ql
2019-07-12 08:38:22 +01:00
Dave Bartolomeo
c73b516862 Merge pull request #1541 from jbj/ir-operand-exact
C++ IR: Make instruction operand getters have only exact results
2019-07-11 13:13:20 -07:00
Dave Bartolomeo
00ff2bb6c4 Merge pull request #1554 from jbj/ir-ErrorExpr
C++ IR: support for translating ErrorExpr
2019-07-11 13:05:04 -07:00
Jonas Jensen
23001d5471 Merge pull request #1566 from rdmarsh2/rdmarsh/cpp/pure-functions-effect-model
C++: alias and side effect info for pure functions
2019-07-11 21:21:54 +02:00
Geoffrey White
62fb216102 CPP: Fix false positive. 2019-07-11 20:00:50 +01:00