aboutsummaryrefslogtreecommitdiffstats
path: root/slang_rs_export_type.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix potential nullptr dereference.Stephen Hines2015-06-161-1/+1
| | | | | | | | | | Bug: 21597073 We must use dyn_cast_or_null<> instead of dyn_cast<>, because we aren't guaranteed to always be passed a NamedDecl. Change-Id: I7b00eacc639a688f8e2fdbeea80b87a01372e232 (cherry picked from commit 33ea573b6df7b7fe48d2b68d4c479f33082e3c0d)
* Move the error for pointers in structures earlier in the compile.Stephen Hines2015-06-161-10/+42
| | | | | | | | | | | | | Bug: 21597073 This fixes an issue where a function argument is not checked for compatibility until the reflected code generation (at which point the message is far more cryptic). We do this by checking parameters for externally-visible functions and externally-visible globals in our ValidateType() routine. Change-Id: I5ab9db1a11ed0e395c7623f1c9997632da057269 (cherry picked from commit ab94bccca64c9b126cbd1b732aa5e681d8639b99)
* Add Half support in slangPirama Arumuga Nainar2015-06-031-1/+7
| | | | | | | | | | | | | | | Bug: 7342860 - Enable NativeHalfType and HalfArgsAndReturns for Langopts for API >= 23 - Add half and its vector variants to the list of reflected types - Use addF16 as the FieldPacker method for setting Float16 values. - Add tests that HalfArgumentsAndReturns is not enabled on API < 23. This should serve as an indirect test that NativeHalfType is also disabled. Change-Id: I164ff6f8a3ed206326b904afa5430230b97d41c8 (cherry picked from commit e4dd17d7b2a292a600756da7680beecd78f74033)
* Update slang for LLVM rebase to r222494.Stephen Hines2014-11-241-2/+2
| | | | Change-Id: I19e441e193637ddb39b3afb3bc95579755ac0a90
* am 340b5550: Fix dangling reference to a local std::string.Stephen Hines2014-09-051-1/+1
|\ | | | | | | | | * commit '340b5550cf63b6beae3b12c2e91377bce7704c34': Fix dangling reference to a local std::string.
| * Fix dangling reference to a local std::string.Stephen Hines2014-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 16031597 llvm::StringRefs are just lightweight wrappers around strings, and don't retain/own any of the storage for the actual underlying string. This causes lifetime issues if any local std::string objects that are then wrapped by llvm::StringRef ever escape. When the local object goes out of scope, we are left with a dangling reference. Valgrind helped us to catch this happening for constant array exports, which only ever use a statically named "<ConstantArray>" reference, so we can simply replace it with static C string (wrapped by llvm::StringRef). Change-Id: I0a9fae2687bc9f53d091d56cf15f99bb75ca46e4
* | am 03ec6ed2: am 10dc6f31: Merge "Replace the NULL macro with nullptr literal."Stephen Hines2014-08-221-112/+113
|\ \ | |/ |/| | | | | * commit '03ec6ed2ecb9adf0cf125b0fa6c96844f093d4d0': Replace the NULL macro with nullptr literal.
| * Replace the NULL macro with nullptr literal.Chris Wailes2014-08-201-112/+113
| | | | | | | | Change-Id: I33609969cd0d7aa55eaa83fb2c65f5faa6d55fa0
| * Fix two bugs for 64-bit slang.Tim Murray2014-08-131-14/+9
| | | | | | | | | | | | | | | | | | | | The first is to handle structs in invoke parameter lists by assuming struct and not struct*. The second is to not cache LLVM types for RS object types because it breaks on 64-bit compilation. Cherry-pick of d56a92fc2b1d417ce53d9550548fe1661fa37d40 Change-Id: I26d7dd7395ef0146eb84d43cbec5cf8d49d09697
* | Fix unsigned long reflection with slang.Tim Murray2014-08-181-2/+2
| | | | | | | | | | | | bug 16846318 Change-Id: If6c207b757a716029aae58a6b12601e16c296438
* | Fix two bugs for 64-bit slang.Tim Murray2014-08-051-14/+9
|/ | | | | | The first is to handle structs in invoke parameter lists by assuming struct and not struct*. The second is to not cache LLVM types for RS object types because it breaks on 64-bit compilation. Change-Id: I26d7dd7395ef0146eb84d43cbec5cf8d49d09697
* Add an option to emit 32-bit and 64-bit bitcode.Stephen Hines2014-07-091-3/+15
| | | | | | Bug: 16031597 Change-Id: Ifb3c4eca5e7ae16106260c2b5f5da6854c021a3a
* Replace macros with equivalent inline functions.Jean-Luc Brouillet2014-05-231-42/+51
| | | | Change-Id: Ibb9db8ffe20513ca1ec56403c632e10e82a4fe86
* Remove obsolete commentsJean-Luc Brouillet2014-05-231-2/+0
| | | | Change-Id: I30ca59ef860fbc976b8fe6bc21cbd50146b19a6a
* Add details to the TODO, simplify dummy namesJean-Luc Brouillet2014-05-161-2/+12
| | | | Change-Id: I37451d8217c3d61ea76db377785045edb2d5c4b0
* Make virtual getTypeStoreSize and getTypeAllocSizeJean-Luc Brouillet2014-05-151-9/+5
| | | | Change-Id: I898d7b21d7856559e75d80c6147fc4b4229c75dd
* Move DataType enum out of RSExportPrimitiveDataType.Jean-Luc Brouillet2014-05-151-55/+51
| | | | | It applies to more than just Primitives and should not have been in there. Change-Id: If2b6a9d2a87a05176a74bcf7212f65cf1cdf67fe
* Remove obsolete unused codeJean-Luc Brouillet2014-05-141-91/+1
| | | | Change-Id: Iead651dc9e0321d36bb653bc178ac1a9af6d34f9
* Remove rs_spec_gen and associated macros.Jean-Luc Brouillet2014-04-301-98/+164
| | | | | | | | | | | | | | | | | | | Also, enable new data types to be defined, out of order. More CLs are coming to continue refactoring the code and removing duplication. modified: Android.mk deleted: RSSpec.mk modified: slang_rs_export_element.cpp modified: slang_rs_export_type.cpp modified: slang_rs_export_type.h modified: slang_rs_metadata_spec_encoder.cpp modified: slang_rs_object_ref_count.cpp modified: slang_rs_object_ref_count.h deleted: slang_rs_spec_table.cpp modified: slang_rs_type_spec.h Change-Id: I3eb3e4357bbe9af26011df714795de8e495fec68
* Update Slang for Clang/LLVM 3.5a.Tim Murray2014-04-251-1/+2
| | | Change-Id: Icd59efa1197098076555c505c31939866e504a83
* Add ReportErrror/Warning to RSContext.Jean-Luc Brouillet2014-01-161-140/+82
| | | | | | Remove a lot of boilerplate code by adding error reporting methods to RSContext. There are still a few additional files that could be cleaned. That will be for another CL someday. Change-Id: I6a261735720227ac87d94dbdea5ce4a7b8ef6cca
* Support reflection of enums.Stephen Hines2013-12-061-27/+40
| | | | | | | Prior versions would just crash when attempting to reflect an enum type. This patch maps enums to integers for reflection in Java. Change-Id: I5b278d670564ceb606a6b96804f76a798bedc89c
* Handle implicit array dimensions properly.Stephen Hines2013-08-231-5/+1
| | | | | Bug: 10461673 Change-Id: I681f918d89983522dd162d7f4606ed5811ab2560
* Update slang for LLVM merge to r183849.Stephen Hines2013-06-131-2/+3
| | | | | | | | s/getLinkage/getFormalLinkage Path.h -> PathV1.h Fix test output diagnostics related to pragma location Change-Id: I7ab5372e848494ac40f1284eb6f9accc18092ad7
* Updates for LLVM merge to r171906 on 20130108.Stephen Hines2013-01-211-8/+6
| | | | Change-Id: I4cf3718041d8876d4a23a412b6b4fa4226ec3b50
* Fix rs_matrix destructor issue.Stephen Hines2013-01-071-1/+8
| | | | | | | | | | | | | Bug: 7949301 This change fixes the destructor issue for rs_matrix types. We need to skip creating a destructor if there are no reference-counted RS object types in the struct. We still need to zero-init all RS object types (ref-counted or not, as is the case for rs_matrix*). I also fix another issue where a missing struct definition could cause an early parser crash (i.e. before the standard clang errors kick in and notice that you are using an undefined struct). Change-Id: If2009d96f35a8cb693431aaeae3cb4b5642695fa
* Fix overly strict check for float3 in structures.Stephen Hines2012-11-281-1/+3
| | | | | | | | We were accidentally being too strict and generating an error for float3 in structures, even when they were not exported. This change restores the original functionality. Change-Id: I8f0b5881d670c37a23ca2efc575440a083befcbe
* Validate FS (and RS) ASTs.Stephen Hines2012-10-111-26/+83
| | | | | | | | | | | | | This change adds a new RSCheckAST class that is used to handle validation of the final AST. The checks include existing RS checks (for accepted types) and new checks for Filterscript (like disallowing pointers, unions and > 32 bit types completely). The refactoring also fixes a subtle union bug that existed in prior versions of llvm-rs-cc. We also add an implicit pragma for "rs_fp_relaxed" by default on Filterscript. Bug: 7166741 Change-Id: Ia077783b4caba0bbd89df2ab3827e9f4d1009eea
* Structs containing vectors of dimension 3 cannot be exported before ICS.Stephen Hines2012-08-311-0/+9
| | | | | | | | | | | | BUG=5609007 BUG=34600 (http://code.google.com/p/android/issues/detail?id=34600) We forbid the use of things like float3 in exported structures for older target APIs, because it results in a runtime exception every time. This is due to not padding the elements appropriately on the driver-side, while the LLVM representation is padded. Change-Id: I297af3418e733f0ab3996999be4a8f746f24da40
* Apply changes to migrate to CLANG-160673-20120724.Shih-wei Liao2012-08-021-1/+2
| | | | Change-Id: I666df2ff91532318883dd48ea1249178b2ebda81
* Multiple levels of pointers cannot be exported.Stephen Hines2012-04-111-4/+7
| | | | Change-Id: I533d26827fa650a481df65b2e20ac6dbc3559244
* Generate an error when exporting RS objects in structs/arrays.Stephen Hines2012-04-051-17/+70
| | | | | | | | | | | | | BUG=6009244 Note that this error triggers when the following conditions are met: 1) We are running with a pre-JB target API. 2) We detect an RS object type inside another composite (struct/array) type. 3) The variable is going to be exported (i.e. non-static). 4) The variable must also be of a non-pointer type, since pointers only reflect a bind() routine that does not use FieldPacker. Change-Id: Id7ca47a4affed2a8774d1c9644e11d4ab02ff27f
* Revert "Generate an error for exporting rs_objects in structs/arrays."Stephen Hines2012-04-041-56/+23
| | | This reverts commit f5abb503e67587ad89bcec99ed925d4a75448dcd
* Generate an error for exporting rs_objects in structs/arrays.Stephen Hines2012-04-031-23/+56
| | | | | | | | | BUG=6009244 This is only an error in pre-JB builds that can't support proper ref-counting within a FieldPacker. Change-Id: Ib96b5ec2befa48ec44890391e518ad557e9a9117
* start cpp reflectionJason Sams2012-03-121-0/+48
| | | | | | BUG=5972398 Change-Id: Iede58fde457d16293345e741f80109f89e653ad5
* Removing DataKind completely from llvm-rs-cc.Stephen Hines2012-03-091-18/+3
| | | | | | BUG=5972398 Change-Id: I76fdb98fa60bd70468d088f9034acf00e443d6c8
* More cleanup for reflection code.Stephen Hines2012-03-081-5/+5
| | | | | | | | | | BUG=5972398 1) Remove non-USER export kinds. 2) Removing some DataKind references. 3) More name refactoring to use getRSReflectionType(). Change-Id: I008aeb37820df37acea0db9300ff9594a40cb086
* Add getRSReflectionType to facilitate new C++ code.Stephen Hines2012-03-081-0/+45
| | | | | | BUG=5972398 Change-Id: I5d1efdbde6eb0b7bb139bdf672a056a4aa5f26e1
* Style violation cleanup.Stephen Hines2012-02-241-6/+5
| | | | Change-Id: Idb127f2fd6e637039454f47299360aec5a4edfe8
* Apply changes to migrate to LLVM upstream Oct 20th 2011.Logan Chien2011-10-221-104/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - StructType::isAnonymous is renamed to StructType::isLiteral. - PassManagerBuilder has been moved from llvm/Support/PassManagerBuilder.h to llvm/Transforms/IPO/PassManagerBuilder.h - Include llvm/Transforms/IPO.h for llvm::createInternalizePass. - clang::DiagClient has be renamed to clang::DiagnosticConsumer. Besides, we have to implement one additional pure virtual method 'clone' for create a clone of slang::DiagnosticBuffer. - llvm::Linker::LinkModules comes with one additional parameter. Passing llvm::Linker::DestroySource should be equivalent to the old code we were using. - slang::Slang is now derived from clang::ModuleLoader and implemented loadModule pure virtual method (though we will always return NULL.) - clang::Preprocessor is taking one additional parameter for clang::ModuleLoader. - clang::Diagnostic has been changed. A lot of the method has been moved to clang::DiagnosticsEngine, and we can no longer 'Report' a diagnostic from clang::Diagnostic. We have to use clang::DiagnosticEngine instead. - llvm::setCodeModel has been removed. Change-Id: I1f2a4cbeaf61a8ed1d0d635a5a0e1baa90d99d07
* Fix double delete (from RSExportable during teardown).Stephen Hines2011-07-211-2/+0
| | | | | | | | | I should not have attempted to delete the storage in this case. At this point in compilation, we have already appended it to a list of objects to be cleaned up. This results in a mistaken double deletion of the same object, which in turn causes the compiler to seg fault (instead of terminating nicely). Change-Id: I479153e146ef3ed3a5c728494c35d7d2b75fc292
* Remove ArrayRefs!Stephen Hines2011-07-191-5/+2
| | | | Change-Id: Ie49fde338437a600384f10c5c7a730691bd0b9a4
* Apply changes to migrate to upstream API.Shih-wei Liao2011-07-191-20/+20
| | | | Change-Id: Ibe6060a0d1c42b9725524de7f4cb95551b711717
* Remove all explicit ArrayRef constructors.Stephen Hines2011-07-141-2/+1
| | | | | | Related BUG=5028838 Change-Id: I5867f8e5d7097ef349a6d1eda1681b0014ac66c9
* Apply API changes to migrate to CLANG upstream.Shih-wei Liao2011-06-221-15/+17
| | | | Change-Id: I376a8a24c238c4e27d37c4f846b93e2f6e38d79c
* Check RS functions (esp. init/root) for validity.Stephen Hines2011-05-021-4/+2
| | | | Change-Id: Ice65c8b691550e2d11caf621e0f88c822316601b
* Forbid RS objects from being contained in unions.Stephen Hines2011-04-251-36/+145
| | | | | | | This change also refactors variable validation in general for RS. BUG=4283858 Change-Id: I4527986a07c9cf2babdc5b855cdb1f00e3535d5b
* Apply changes to migrate to upstream as of April 8th, 2011 from logan.Shih-wei Liao2011-04-191-1/+2
| | | | | | | | - Use llvm::StructType::get(LLVMContext &, ArrayRef<const Type *>, bool) to create struct type instead of the ellipsis version. Otherwise, an error about ambigious overload function will occur. Change-Id: I8012d8d9fa10a89f28e858533d427807df7214d5
* Fix struct size bug.Shih-wei Liao2011-03-111-1/+1
| | | | | | | | | | | clang/AST/RecordLayout.h now uses CharUnits, which will return the size of a struct using number of bytes as the unit. So we no longer need the division which converts number of bits to number of bytes. RL->getSize().getQuantity() is equivalent to something like sizeof operator. Change-Id: Ib3a4ec67349a275dfb8a73c4eac860395b101a05
* Apply changes to migrate to LLVM Mar 6th 2011.Logan2011-03-091-12/+16
| | | | | | | | | | | | | | | | | | | - API for name mangling. (Changing from non-public APIs to the public one) - API changes for clang::Diagnostic::getNumErrors -> clang::Diagnostic::hasErrorOccurred - API changes for clang::CharUnits and Quantity type. - API changes libLLVMSystem -> libLLVMSupport. - Change clang::Token::eom -> clang::Token::eod. - Remove SourceRange parameter for DeclRefExpr::Create and MemberExpr::Create. - Add const qualifier for several unsafe type cast.