[JSONImporter] misses checks whether the data it imports makes sense.
commit3a82151a98615376d4e66c9a5c67f3123f3cd554
authorMichael Kruse <llvm@meinersbur.de>
Wed, 24 May 2017 15:09:35 +0000 (24 15:09 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Wed, 24 May 2017 15:09:35 +0000 (24 15:09 +0000)
treeb1c087928ad791d4e907693333f2fc221cbeb4f6
parent6876f12b9aee27f7ff36ab08a280eae7dce1f0f4
[JSONImporter] misses checks whether the data it imports makes sense.

Without this patch, the JSONImporter did not verify if the data it loads
were correct or not  (Bug llvm.org/PR32543). I add some checks in the
JSONImporter class and some test cases.

Here are the checks (and test cases) I added :

JSONImporter::importContext
- The "context" key does not exist.
- The context was not parsed successfully by ISL.
- The isl_set has the wrong number of parameters.
- The isl_set is not a parameter set.

JSONImporter::importSchedule
- The "statements" key does not exist.
- There is not the right number of statement in the file.
- The "schedule" key does not exist.
- The schedule was not parsed successfully by ISL.

JSONImporter::importAccesses
- The "statements" key does not exist.
- There is not the right number of statement in the file.
- The "accesses" key does not exist.
- There is not the right number of memory accesses in the file.
- The "relation" key does not exist.
- The memory access was not parsed successfully by ISL.

JSONImporter::areArraysEqual
- The "type" key does not exist.
- The "sizes" key does not exist.
- The "name" key does not exist.

JSONImporter::importArrays
/!\ Do not check if there is an key name "arrays" because it is not
considered as an error.
All checks are already in place or implemented in
JSONImporter::areArraysEqual.

Contributed-by: Nicolas Bonfante <nicolas.bonfante@insa-lyon.fr>
Differential Revision: https://reviews.llvm.org/D32739

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@303759 91177308-0d34-0410-b5e6-96231b3b80d8
41 files changed:
lib/Exchange/JSONExporter.cpp
test/JSONExporter/ImportAccesses/ImportAccesses-Bad-relation.ll [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ImportAccesses-No-accesses-key.ll [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-MemAcc.ll [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ImportAccesses-Not-enough-statements.ll [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ImportAccesses-Relation-mispelled.ll [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ImportAccesses-Statements-mispelled.ll [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ImportAccesses-Undeclared-ScopArrayInfo.ll [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ImportAccesses-Wrong-number-dimensions.ll [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ia2___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ia3___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ia4___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ia5___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ia6___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ia7___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ia8___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportAccesses/ia___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportArrays/ImportArrays-Mispelled-type.ll [new file with mode: 0644]
test/JSONExporter/ImportArrays/ImportArrays-No-name.ll [new file with mode: 0644]
test/JSONExporter/ImportArrays/ImportArrays-No-sizes-key.ll [new file with mode: 0644]
test/JSONExporter/ImportArrays/ImportArrays-No-type-key.ll [new file with mode: 0644]
test/JSONExporter/ImportArrays/ia2___%bb9---%bb26.jscop.transformed [new file with mode: 0644]
test/JSONExporter/ImportArrays/ia3___%bb9---%bb26.jscop.transformed [new file with mode: 0644]
test/JSONExporter/ImportArrays/ia4___%bb9---%bb26.jscop.transformed [new file with mode: 0644]
test/JSONExporter/ImportArrays/ia___%bb9---%bb26.jscop.transformed [new file with mode: 0644]
test/JSONExporter/ImportContext/ImportContext-Context-mispelled.ll [new file with mode: 0644]
test/JSONExporter/ImportContext/ImportContext-Not-parameter-set.ll [new file with mode: 0644]
test/JSONExporter/ImportContext/ImportContext-Unvalid-Context.ll [new file with mode: 0644]
test/JSONExporter/ImportContext/ImportContext-Wrong-dimension.ll [new file with mode: 0644]
test/JSONExporter/ImportContext/ic2___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportContext/ic3___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportContext/ic4___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportContext/ic___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportSchedule/ImportSchedule-No-schedule-key.ll [new file with mode: 0644]
test/JSONExporter/ImportSchedule/ImportSchedule-Schedule-not-valid.ll [new file with mode: 0644]
test/JSONExporter/ImportSchedule/ImportSchedule-Statements-mispelled.ll [new file with mode: 0644]
test/JSONExporter/ImportSchedule/ImportSchedule-Wrong-number-statements.ll [new file with mode: 0644]
test/JSONExporter/ImportSchedule/is2___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportSchedule/is3___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportSchedule/is4___%for.cond---%for.end10.jscop [new file with mode: 0644]
test/JSONExporter/ImportSchedule/is___%for.cond---%for.end10.jscop [new file with mode: 0644]