llvm-project/clang/test/PCH
Douglas Gregor 882211c1da Completely reimplement __builtin_offsetof, based on a patch by Roberto
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
2010-04-28 22:16:22 +00:00
..
Inputs Add PCH test for C++ namespaces, missing from a previous commit 2010-02-24 21:52:55 +00:00
libroot/usr/include Introduce the notion of "Relocatable" precompiled headers, which are built 2009-07-07 00:12:59 +00:00
asm.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
asm.h PCH support for inline assembly statements. 2009-04-17 20:57:14 +00:00
attrs.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
attrs.h PCH support for declaration attributes 2009-04-15 21:30:51 +00:00
blocks.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
blocks.h PCH support for blocks 2009-04-17 19:21:43 +00:00
builtins.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
builtins.h Lazy deserialization of the declaration chains associated with 2009-04-21 22:25:48 +00:00
changed-files.c Use Daniel's trick for XFAIL'd tests 2010-03-25 16:40:13 +00:00
cxx-method.cpp Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
cxx_exprs.cpp Roll r95513 back in. 2010-02-07 06:32:43 +00:00
cxx_exprs.h Roll r95513 back in. 2010-02-07 06:32:43 +00:00
enum.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
enum.h Add PCH support for ImplicitCastExprs. This is the first expression 2009-04-14 23:32:43 +00:00
exprs.c Completely reimplement __builtin_offsetof, based on a patch by Roberto 2010-04-28 22:16:22 +00:00
exprs.h Completely reimplement __builtin_offsetof, based on a patch by Roberto 2010-04-28 22:16:22 +00:00
ext_vector.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
ext_vector.h Add Sema::ExtVectorDecls and Sema::ObjCCategoryImpls to the PCH file. Since these vectors are very, very rarely used and, when used in headers, and even when used are relatively small, we load them eagerly. 2009-04-27 20:06:05 +00:00
external-defs.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
external-defs.h Clean up and de-XFAIL-ify PCH test for external definitions 2009-04-22 22:09:39 +00:00
functions.c Whenever we complain about a failed initialization of a function or 2010-04-22 00:20:18 +00:00
functions.h Whenever we complain about a failed initialization of a function or 2010-04-22 00:20:18 +00:00
fuzzy-pch.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
fuzzy-pch.h Allow some differences between the predefines buffer used to build a 2009-04-28 18:58:38 +00:00
headermap.h Fix header-search problems with precompiled headers, where the 2010-03-16 16:35:32 +00:00
headermap.m Fix header-search problems with precompiled headers, where the 2010-03-16 16:35:32 +00:00
line-directive.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
line-directive.h Include the SourceManager's line table in the PCH file. We can now 2009-04-13 16:31:14 +00:00
method_pool.h Prep for new warning. 2009-07-21 22:54:02 +00:00
method_pool.m Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
multiple_decls.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
multiple_decls.h Fix two embarrassing PCH bugs: 2009-04-17 21:46:47 +00:00
namespaces.cpp Add PCH test for C++ namespaces, missing from a previous commit 2010-02-24 21:52:55 +00:00
nonvisible-external-defs.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
nonvisible-external-defs.h Support locally-declared external declarations in PCH files 2009-04-22 22:18:58 +00:00
objc_exprs.h Add PCH read/write support for Objective-C Selectors. 2009-04-23 10:39:46 +00:00
objc_exprs.m Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
objc_import.h Add PCH support for #import. 2009-04-24 20:03:17 +00:00
objc_import.m Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
objc_methods.h More PushOnScopeChain() FIXME's. 2009-04-23 16:00:56 +00:00
objc_methods.m Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
objc_property.h PCH support for Objective-C property declarations (UNTESTED!) 2009-04-22 23:20:34 +00:00
objc_property.m Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
objc_stmts.h Improve the AST representation of Objective-C @try/@catch/@finally 2010-04-23 22:50:49 +00:00
objc_stmts.m Improve the AST representation of Objective-C @try/@catch/@finally 2010-04-23 22:50:49 +00:00
pr4489.c Forcibly disable test/PCH/pr4489.c, it is flaky on one of the buildbots. 2010-04-09 15:30:57 +00:00
preprocess.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
preprocess.h Make precompiled headers work with -E. When we're only preprocessing 2009-05-12 01:31:05 +00:00
reloc.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
source-manager-stack.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
stmts.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
stmts.h Test PCH support for VLAs 2009-04-22 00:21:21 +00:00
struct.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
struct.h PCH support for a few very, very simple kinds of expressions. Hook up 2009-04-14 21:18:50 +00:00
tentative-defs.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
tentative-defs.h Support tentative definitions in precompiled headers. This isn't likely 2009-04-22 22:02:47 +00:00
types.c Improve diagnostics like "initializing <type> from an expression of 2010-04-09 17:53:29 +00:00
types.h Test PCH support for VLAs 2009-04-22 00:21:21 +00:00
va_arg.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
va_arg.h PCH tests for va_arg expressions. Verified that the blocks test does create a BlockDeclRefExpr 2009-04-17 20:06:59 +00:00
variables.c Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00
variables.h Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'. 2009-12-15 20:14:24 +00:00