[llvm-commits] [PATCH] More strict error checking of datalayout strings

Patrik Hägglund H patrik.h.hagglund at ericsson.com
Thu Nov 22 04:10:46 PST 2012


Here are three patches that makes the error checking of datalayout strings more strict.

Also, in the last patch, the parseSpecifier code is simplified.

Let me know if you have any objections. Otherwise, I will commit them.

Regards,
Patrik Hägglund

 
[PATCH 1/3] Disallow the undocumented practice of starting the
 datalayout string with '-'.

Update some test cases accordingly.
---
 lib/VMCore/DataLayout.cpp                     | 3 ---
 test/Transforms/IndVarSimplify/iv-zext.ll     | 2 +-
 test/Transforms/InstCombine/align-external.ll | 2 +-
 test/Transforms/SimplifyLibCalls/Puts.ll      | 2 +- 


[PATCH 2/3] Add error handling in getInt.

Accordingly, update a testcase with a broken datalayout string.

Also, we never parse negative numbers, because '-' is used as a
separator. Therefore, use unsigned as result type.
---
 lib/VMCore/DataLayout.cpp          | 72 ++++++++++++++++++--------------------
 test/Transforms/GVN/crash-no-aa.ll |  3 +- 


[PATCH 3/3] More strict error checking in parseSpecifier +
 simplified code.

For example, don't allow empty strings to be passed to getInt. Use
asserts instead of returning an error message string.
---
 include/llvm/DataLayout.h |   5 +-
 lib/VMCore/DataLayout.cpp | 148 +++++++++++++++++++++-------------------------
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Disallow-the-undocumented-practice-of-starting-the-d.patch
Type: application/octet-stream
Size: 2171 bytes
Desc: 0001-Disallow-the-undocumented-practice-of-starting-the-d.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121122/75e12d67/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-error-handling-in-getInt.patch
Type: application/octet-stream
Size: 6714 bytes
Desc: 0002-Add-error-handling-in-getInt.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121122/75e12d67/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-More-strict-error-checking-in-parseSpecifier-simplif.patch
Type: application/octet-stream
Size: 8245 bytes
Desc: 0003-More-strict-error-checking-in-parseSpecifier-simplif.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121122/75e12d67/attachment-0002.obj>


More information about the llvm-commits mailing list