summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenObjC/encode-test.m
Commit message (Collapse)AuthorAgeFilesLines
* [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefsAkira Hatanaka2019-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | clang was encoding pointers to typedefs as if they were pointers to structs because that is apparently what gcc is doing. For example: ``` @class Class1; typedef NSArray<Class1 *> MyArray; void foo1(void) { const char *s0 = @encode(MyArray *); // "^{NSArray=#}" const char *s1 = @encode(NSArray<Class1 *> *); // "@" } ``` This commit removes the code that was there to make clang compatible with gcc and make clang emit the correct encoding for ObjC pointers, which is "@". rdar://problem/50563529 Differential Revision: https://reviews.llvm.org/D61974 llvm-svn: 362034
* [Sema] Make string literal init an rvalue.Eli Friedman2019-02-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | This allows substantially simplifying the expression evaluation code, because we don't have to special-case lvalues which are actually string literal initialization. This currently throws away an optimization where we would avoid creating an array APValue for string literal initialization. If we really want to optimize this case, we should fix APValue so it can store simple arrays more efficiently, like llvm::ConstantDataArray. This shouldn't affect the memory usage for other string literals. (Not sure if this is a blocker; I don't think string literal init is common enough for this to be a serious issue, but I could be wrong.) The change to test/CodeGenObjC/encode-test.m is a weird side-effect of these changes: we currently don't constant-evaluate arrays in C, so the strlen call shouldn't be folded, but lvalue string init managed to get around that check. I this this is fine. Fixes https://bugs.llvm.org/show_bug.cgi?id=40430 . llvm-svn: 353569
* Handle ObjCEncodeExpr in extractStringLiteralCharacter.Akira Hatanaka2017-01-311-0/+11
| | | | | | | | | This fixes an assertion failure that occurs later in the function when an ObjCEncodeExpr is cast to StringLiteral. rdar://problem/30111207 llvm-svn: 293596
* Switch CGObjCMac to use ConstantInitBuilder. Whew.John McCall2016-11-301-1/+1
| | | | | | | Not strictly NFC because I did change the order of emission of some global constants, but it shouldn't make any difference. llvm-svn: 288229
* CodeGen: mark ObjC cstring literals as unnamed_addrSaleem Abdulrasool2016-09-181-1/+1
| | | | | | | | These are all emitted into a section with a cstring_literal attribute. The attribute permits the linker to coalesce the string contents. The address of the strings are not important. llvm-svn: 281855
* CodeGen: mark ObjC cstring literals as constantSaleem Abdulrasool2016-09-181-1/+1
| | | | | | | | These strings are constants, mark them as such. This doesn't matter too much in practice on MachO since the constants are placed into a special section and not referred to directly. llvm-svn: 281854
* Add test coverage for @encode(SEL); completely untested until now.Nico Weber2015-09-151-0/+3
| | | | llvm-svn: 247717
* Changed renaming of local symbols by inserting a dot vefore the numeric suffixSunil Srivastava2015-05-121-1/+1
| | | | | | | details in http://reviews.llvm.org/D9483 goes with llvm checkin r237150 llvm-svn: 237151
* Don't manually insert L prefixes.Rafael Espindola2014-11-061-1/+1
| | | | | | Simply marking the symbol private conveys the desire to hide them to LLVM. llvm-svn: 221451
* Use private linkage for globals we already name with \01L and \01l.Rafael Espindola2014-02-271-1/+1
| | | | | | | | | | | | In llvm the only semantic difference between internal and private is that llvm tries to hide private globals my mangling them with a private prefix. Since the globals changed by this patch already had the magic don't mangle marker, there should be no change in the generated assembly. A followup patch should then be able to drop the \01L and \01l prefixes and let llvm mangle as appropriate. llvm-svn: 202419
* Objective-C. provide legacy encoding of *id and *Class typesFariborz Jahanian2014-01-281-0/+8
| | | | | | instead of crashing. // rdar://15824769. llvm-svn: 200338
* Objective-C encoding. Fixes up encodeing forFariborz Jahanian2013-06-041-1/+1
| | | | | | | arrays of empty structs. // rdar://14053082 (also pr13062). llvm-svn: 183234
* Robustify the @encode code and add support for _Atomic.John McCall2012-12-201-0/+4
| | | | | | Fixes PR14628. llvm-svn: 170639
* Restructure how the driver communicates information about theJohn McCall2012-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | target Objective-C runtime down to the frontend: break this down into a single target runtime kind and version, and compute all the relevant information from that. This makes it relatively painless to add support for new runtimes to the compiler. Make the new -cc1 flag, -fobjc-runtime=blah-x.y.z, available at the driver level as a better and more general alternative to -fgnu-runtime and -fnext-runtime. This new concept of an Objective-C runtime also encompasses what we were previously separating out as the "Objective-C ABI", so fragile vs. non-fragile runtimes are now really modelled as different kinds of runtime, paving the way for better overall differentiation. As a sort of special case, continue to accept the -cc1 flag -fobjc-runtime-has-weak, as a sop to PLCompatibilityWeak. I won't go so far as to say "no functionality change", even ignoring the new driver flag, but subtle changes in driver semantics are almost certainly not intended. llvm-svn: 158793
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-021-1/+1
| | | | | | | | | | | | | | | | | | | increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
* For the purpose of @encode'ing, accept 'void' typeFariborz Jahanian2011-06-161-0/+4
| | | | | | | (even though it is incomplete type) because gcc says so. // rdar://9622422 llvm-svn: 133208
* Reapply the commits that r131401 reverted and add a fix for PR9927.Argyrios Kyrtzidis2011-05-171-0/+17
| | | | llvm-svn: 131446
* Revert 131377, 131369 and 131365.Rafael Espindola2011-05-161-17/+0
| | | | | | 131365 caused PR9927. llvm-svn: 131401
* Fix generation of obj-c @encoding for members with zero size.Argyrios Kyrtzidis2011-05-151-0/+10
| | | | | | Also follow gcc in that arrays of elements with zero size are encoded as arrays with zero elements. llvm-svn: 131369
* Create proper Objective-C @encoding for C++ classes; fixes rdar://9357400.Argyrios Kyrtzidis2011-05-141-0/+7
| | | | | | | | | | | | | | | | | | Go through and expand the members of bases into the encoding string (and encode the VTable as well). Unlike gcc which expands virtual bases as many times as they appear in the hierarchy, clang will only expand them once at the end, to reflect the actual layout. Note that there doesn't seem to be a way to indicate in the encoding that packing/alignment of members is different that normal, in which case the encoding will be out-of-sync with the real layout. If the runtime switches to just consider the size of types without taking into account alignment, we could easily make padding explicit in the encoding (e.g. using arrays of chars). The encoding strings would be longer then though. Also encode a flexible array member as array of 0 size, like gcc, not as a pointer. llvm-svn: 131365
* IRgen/Obj-C: Fix encoding of "long double".Daniel Dunbar2010-10-111-0/+6
| | | | | | - The mind boggles. llvm-svn: 116226
* Merge encode-test-1.m into encode-test.mDaniel Dunbar2010-10-111-0/+29
| | | | llvm-svn: 116225
* FileCheck'ize test.Daniel Dunbar2010-10-111-6/+20
| | | | llvm-svn: 116224
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Tests use the new clang.Fariborz Jahanian2009-12-141-1/+1
| | | | llvm-svn: 91290
* Fix a crash when ivar type is a __strong SEL. Fallout fromFariborz Jahanian2009-11-301-0/+1
| | | | | | recent change to make SEL a builtin type (fixes radar 7425510). llvm-svn: 90145
* Fixe a crash in encoding of SEL type caused by recent changes.Fariborz Jahanian2009-11-231-0/+2
| | | | llvm-svn: 89696
* Move -fnext-runtime defaulting to driver (and change clang-cc default toDaniel Dunbar2009-11-171-1/+1
| | | | | | -fnext-runtime), instead of using getDefaultLangOptions. llvm-svn: 89058
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-6/+6
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Fix a couple recent ABI regressions noticed during code review (fallout from ↵Steve Naroff2009-07-221-2/+2
| | | | | | | | the ObjC type system rewrite). It's unfortunate that the mangling includes the low-level structs. Nevertheless, we need this for binary compatibility with GCC. llvm-svn: 76755
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-2/+2
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* rdar://6827200 - [sema] reject statically allocated arrays of interface typesChris Lattner2009-04-271-3/+3
| | | | | | | Upgrade "array of interface" warning to an error. In addition to being a terrible idea, this crashes codegen. llvm-svn: 70178
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Fix a grep error that caused CodeGenObjC/encode-test.m to fail.Sebastian Redl2008-12-281-1/+1
| | | | llvm-svn: 61455
* Last patch, for now, to privde ObjC's encoding of types.Fariborz Jahanian2008-12-231-1/+10
| | | | | | We now pass all gcc's encoding compatibility tests. llvm-svn: 61387
* More encoding support; in this case, encoding ofFariborz Jahanian2008-12-221-1/+5
| | | | | | outer-most const of pointer types. llvm-svn: 61355
* Test case makes a platform assumption, so force triple.Sebastian Redl2008-12-211-1/+1
| | | | llvm-svn: 61310
* Finish up saving original parameter type andFariborz Jahanian2008-12-201-1/+14
| | | | | | using it in ObjC's method parameter encoding. llvm-svn: 61293
* Strangely enough, name of ObjC class is not encoded into theFariborz Jahanian2008-12-201-1/+14
| | | | | | | | full encoding of the class which has an ivar of pointer to this class. Its name is encoded in the type for the ivar in the ivar-list metadata. This patch conforms to the above rule. llvm-svn: 61282
* More encoding support. This time forFariborz Jahanian2008-12-191-1/+39
| | | | | | @encode of classes and bitfields. llvm-svn: 61268
* Test case for my last @encode patch.Fariborz Jahanian2008-12-191-0/+17
llvm-svn: 61247
OpenPOWER on IntegriCloud