summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/offsetof.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Perform lvalue-to-rvalue conversions on __builtin_offsetof array argument indexRichard Smith2011-10-171-0/+7
| | | | | | before typechecking, as suggested by John. llvm-svn: 142308
* PR7769: Fix references to anonymous structs/unions in base classes inEli Friedman2010-08-051-0/+13
| | | | | | offsetof expressions. llvm-svn: 110327
* Implement support for variable length arrays in C++. VLAs are limitedDouglas Gregor2010-05-221-1/+1
| | | | | | | | | | | | | in several important ways: - VLAs of non-POD types are not permitted. - VLAs cannot be used in conjunction with C++ templates. These restrictions are intended to keep VLAs out of the parts of the C++ type system where they cause the most trouble. Fixes PR5678 and <rdar://problem/8013618>. llvm-svn: 104443
* Teach __builtin_offsetof to compute the offsets of members of baseDouglas Gregor2010-04-291-1/+18
| | | | | | | | classes, since we only warn (not error) on offsetof() for non-POD types. We store the base path within the OffsetOfExpr itself, then evaluate the offsets within the constant evaluator. llvm-svn: 102571
* Diagnose __builtin_offsetof expressions that refer to bit-fieldsDouglas Gregor2010-04-281-0/+8
| | | | llvm-svn: 102548
* Completely reimplement __builtin_offsetof, based on a patch by RobertoDouglas Gregor2010-04-281-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amadini. This change introduces a new expression node type, OffsetOfExpr, that describes __builtin_offsetof. Previously, __builtin_offsetof was implemented using a unary operator whose subexpression involved various synthesized array-subscript and member-reference expressions, which was ugly and made it very hard to instantiate as a template. OffsetOfExpr represents the AST more faithfully, with proper type source information and a more compact representation. OffsetOfExpr also has support for dependent __builtin_offsetof expressions; it can be value-dependent, but will never be type-dependent (like sizeof or alignof). This commit introduces template instantiation for __builtin_offsetof as well. There are two major caveats to this patch: 1) CodeGen cannot handle the case where __builtin_offsetof is not a constant expression, so it produces an error. So, to avoid regressing in C, we retain the old UnaryOperator-based __builtin_offsetof implementation in C while using the shiny new OffsetOfExpr implementation in C++. The old implementation can go away once we have proper CodeGen support for this case, which we expect won't cause much trouble in C++. 2) __builtin_offsetof doesn't work well with non-POD class types, particularly when the designated field is found within a base class. I will address this in a subsequent patch. Fixes PR5880 and a bunch of assertions when building Boost.Python tests. llvm-svn: 102542
* When pretty-printing tag types, only print the tag if we're in C (andJohn McCall2010-03-101-1/+1
| | | | | | | | | | therefore not creating ElaboratedTypes, which are still pretty-printed with the written tag). Most of these testcase changes were done by script, so don't feel too sorry for my fingers. llvm-svn: 98149
* 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
* Suppress warnings and errors about certain uses of non-POD types (inDouglas Gregor2009-12-121-0/+2
| | | | | | | | __builtin_offsetof, passing through an ellipsis) when we're in an unevaluated context. This is the first part of the fix to PR5761, which deals with the simple case of an unevaluated context. llvm-svn: 91210
* Make sure to call PerformObjectMemberConversion where necessary.Eli Friedman2009-12-041-0/+3
| | | | llvm-svn: 90555
* Fix/re-enable test.Eli Friedman2009-05-031-3/+1
| | | | llvm-svn: 70800
* Disable this test case, I'm tired of seeing red. :)Daniel Dunbar2009-05-031-1/+3
| | | | llvm-svn: 70799
* Fix a thinko and a test.Anders Carlsson2009-05-021-1/+1
| | | | llvm-svn: 70637
* Downgrade the invalid offsetof error to a warning.Anders Carlsson2009-05-021-1/+1
| | | | llvm-svn: 70634
* It's an error to call offsetof on a non-POD type.Anders Carlsson2009-05-011-0/+15
llvm-svn: 70595
OpenPOWER on IntegriCloud