Commit Graph

12 Commits

Author SHA1 Message Date
Richard Smith 0421ce7b22 Teach Expr::HasSideEffects about all the Expr types, and fix a bug where it
was mistakenly classifying dynamic_casts which might throw as having no side
effects.

Switch it from a visitor to a switch, so it is kept up-to-date as future Expr
nodes are added. Move it from ExprConstant.cpp to Expr.cpp, since it's not
really related to constant expression evaluation.

Since we use HasSideEffect to determine whether to emit an unused global with
internal linkage, this has the effect of suppressing emission of globals in
some cases.

I've left many of the Objective-C cases conservatively assuming that the
expression has side-effects. I'll leave it to someone with better knowledge
of Objective-C than mine to improve them.

llvm-svn: 161388
2012-08-07 04:16:51 +00:00
Douglas Gregor f5d6c74433 When @encode'ing a C++ class that has empty base classes, we can end
up with gaps when the class inherits from the same empty base class
more than once. Fixes <rdar://problem/11324167>.

llvm-svn: 155738
2012-04-27 22:30:01 +00:00
Argyrios Kyrtzidis 81c0b5c200 Fix assertion hit when @encoding C++ classes. rdar://10172840 & http://llvm.org/PR10990
llvm-svn: 140542
2011-09-26 18:14:24 +00:00
Argyrios Kyrtzidis c7e50c5cbd Fix a bug in objc @encoding of C++ classes.
llvm-svn: 138235
2011-08-22 16:03:14 +00:00
Argyrios Kyrtzidis 95a76f3715 Fix regression with @encode string. rdar://9624314.
llvm-svn: 133312
2011-06-17 23:19:38 +00:00
Argyrios Kyrtzidis 49b35de2a1 Reapply the commits that r131401 reverted and add a fix for PR9927.
llvm-svn: 131446
2011-05-17 00:46:38 +00:00
Rafael Espindola c0d4cb17c1 Revert 131377, 131369 and 131365.
131365 caused PR9927.

llvm-svn: 131401
2011-05-16 12:30:54 +00:00
Argyrios Kyrtzidis dd72aafffc Create proper Objective-C @encoding for C++ classes; fixes rdar://9357400.
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
2011-05-14 20:32:43 +00:00
Fariborz Jahanian e0587be735 Fix a crash encoding ivars of vector types and
to match gcc's encoding. Fixes //rdar: // 8519948.

llvm-svn: 115980
2010-10-07 21:25:25 +00:00
Douglas Gregor 527786ea3a Various small fixes for construction/destruction of Objective-C++
instance variables:
  - Use isRecordType() rather than isa<RecordType>(), so that we see
  through typedefs in ivar types.
  - Mark the destructor as referenced
  - Perform C++ access control on the destructor

llvm-svn: 104206
2010-05-20 02:24:22 +00:00
John McCall a9e6e8d654 Teach the ObjC mangler to ignore member pointers just like gcc does.
llvm-svn: 104001
2010-05-17 23:56:34 +00:00
Fariborz Jahanian c5158203dd Implement encoding of methods which have instantiated
template arguments.

llvm-svn: 103221
2010-05-07 00:28:49 +00:00