Douglas Gregor [Thu, 2 Dec 2010 21:47:04 +0000 (21:47 +0000)]
When we're performing an explicit cast of some sort, don't complain
about deprecated Objective-C pointer conversions. Plus, make sure to
actually set an appropriate AssignmentAction when performing an
implicit conversion from an InitializationSequence. Fixes regressions
in the GCC DejaGNU testsuite.
Bob Wilson [Thu, 2 Dec 2010 17:31:16 +0000 (17:31 +0000)]
Attempt to fix linux buildbots by adding -ffreestanding for arm_neon tests.
The arm_neon.h header includes stdint.h and it picks up the system header
without -ffreestanding.
IR Gen. part of API support for __block cxx
objects imported into blocks. //rdar://8594790.
Will have a test case coming (as well as one
sent to llvm test suite).
Douglas Gregor [Thu, 2 Dec 2010 16:14:14 +0000 (16:14 +0000)]
Remove NDEBUG-controlled extra data from
TemplateArgumentLocInfo. Unfortunately, this means that we lose some
internal consistency checking when building a debug Clang. However,
having data structures change size/layout depending on NDEBUG causes
pain for clients of the Clang API.
Bob Wilson [Thu, 2 Dec 2010 07:13:31 +0000 (07:13 +0000)]
Add a test for calling a Neon intrinsic macro with the wrong vector type.
This does not work so well with the -fno-lax-vector-conversions option for
testing the arm_neon.h header but that is a really useful test, so I split
this out to a separate Sema test to check for the warning.
Chris Lattner [Thu, 2 Dec 2010 07:07:26 +0000 (07:07 +0000)]
Improve codegen for initializer lists to use memset more aggressively
when an initializer is variable (I handled the constant case in a previous
patch). This has three pieces:
1. Enhance AggValueSlot to have a 'isZeroed' bit to tell CGExprAgg that
the memory being stored into has previously been memset to zero.
2. Teach CGExprAgg to not emit stores of zero to isZeroed memory.
3. Teach CodeGenFunction::EmitAggExpr to scan initializers to determine
whether they are profitable to emit a memset + inividual stores vs
stores for everything.
The heuristic used is that a global has to be more than 16 bytes and
has to be 3/4 zero to be candidate for this xform. The two testcases
are illustrative of the scenarios this catches. We now codegen test9 into:
Previously we produced 99 stores of zero for test9 and also tons for test10.
This xforms should substantially speed up -O0 builds when it kicks in as well
as reducing code size and optimizer heartburn on insane cases. This resolves
PR279.
Chris Lattner [Thu, 2 Dec 2010 01:58:41 +0000 (01:58 +0000)]
Enhance the init generation logic to emit a memset followed by a few stores when
a global is larger than 32 bytes and has fewer than 6 non-zero values in the
initializer. Previously we'd turn something like this:
char test8(int X) {
char str[10000] = "abc";
into a 10K global variable which we then memcpy'd from. Now we generate:
Bob Wilson [Thu, 2 Dec 2010 00:25:18 +0000 (00:25 +0000)]
Add a testcase for Radar 8228022.
Make sure the -Wvector-conversions does not cause unnecessary warnings when
using Neon intrinsics with the correct types.
Bob Wilson [Thu, 2 Dec 2010 00:25:15 +0000 (00:25 +0000)]
Swap order of checking for compatible vector types.
Check for compatible gcc, Altivec and Neon vectors before handling the
lax-vector-conversions case. Otherwise there is no way to avoid the
warnings from -Wvector-conversions.
Douglas Gregor [Wed, 1 Dec 2010 23:49:52 +0000 (23:49 +0000)]
Extend ExternalASTSource with the ability to lazily complete the
definition of an Objective-C class. Unlike with C/C++ classes, we
don't have a well-defined point in Sema where Objective-C classes are
checked for completeness, nor do we need to involve Sema when
completing a class. Therefore, we take the appropriate of having the
external AST source mark a particular Objective-C class as having an
external declaration; when using one of the accessors of an
Objective-C class that has an external declaration, we request that
the external AST source fill in the Objective-C class definition.
Douglas Gregor [Wed, 1 Dec 2010 21:43:58 +0000 (21:43 +0000)]
Improve our handling of cv-qualifiers in Objective-C pointer
conversions. Previously, we would end up collapsing qualification
conversions into the Objective-C pointer conversion step, including
(possibly) stripping qualifiers that shouldn't be removed.
This generalizes BuildSimilarlyQualifiedPointerType() to also work on
Objective-C object pointers, then eliminates the (redundant, not
totally correct) BuildSimilarlyQualifiedObjCObjectPointerType()
function.
Douglas Gregor [Wed, 1 Dec 2010 20:32:20 +0000 (20:32 +0000)]
Not content to implement just "extern" explicit template
instantiations, GCC also supports "inline" and "static" explicit
template instantiations. Parse and warn about such constructs, but
don't implement the semantics of either "inline" or "static". They
don't seem to be widely used.
Douglas Gregor [Wed, 1 Dec 2010 17:42:47 +0000 (17:42 +0000)]
After parsing a ':' in an enum-specifier within class context,
disambiguate between an expression (for a bit-field width) and a type
(for a fixed underlying type). Since the disambiguation can be
expensive (due to tentative parsing), we perform a simplistic
disambiguation based on one-token lookahead before going into the
full-blown tentative parsing. Based on a patch by Daniel Wallin.
Douglas Gregor [Wed, 1 Dec 2010 16:10:38 +0000 (16:10 +0000)]
Improve the diagnostic when the fixed underlying type of a
redeclaration of an enum type differs from that of the original
declaration, from Daniel Wallin
Dan Gohman [Wed, 1 Dec 2010 02:59:44 +0000 (02:59 +0000)]
Don't check the isysroot path for Path::isValid(); if the user has
specified a syntactically invalid path, it's better to let the OS
diagnose the problem than to silently skip it.
John McCall [Tue, 30 Nov 2010 23:21:46 +0000 (23:21 +0000)]
A CGRecordLayout object persists. Since its contained types may
refer to opaque types, they must be held via PATypeHolders. I'm
not sure why this hasn't blown up before.
Such function decls,as objc's objc_msgSend, builtins in
a specific language. We are adding such language info. by
extensing Builtins.def and via a language flag added
to LIBBUILTIN/BUILTIN and check for that when deciding
a name is builtin or not. Implements //rdar://8689273.
Douglas Gregor [Tue, 30 Nov 2010 06:16:57 +0000 (06:16 +0000)]
When using a precompiled preamble with detailed preprocessing records,
trap the serialized preprocessing records (macro definitions, macro
instantiations, macro definitions) from the generation of the
precompiled preamble, then replay those when walking the list of
preprocessed entities. This eliminates a bug where clang_getCursor()
wasn't able to find preprocessed-entity cursors in the preamble.
Douglas Gregor [Tue, 30 Nov 2010 05:52:55 +0000 (05:52 +0000)]
Teach c-index-test to reparse the source file a few times when testing
clang_getCursor() via -cursor-at=??? and CINDEXTEST_EDITING is set in
the environment. This mirrors how we test code completion and
source-loading in the presence of this environment variable.
Douglas Gregor [Tue, 30 Nov 2010 05:23:00 +0000 (05:23 +0000)]
When loading a precompiled preamble, use the file ID of the
precompiled preamble as the "main" source file's file ID within the
source manager. This makes compiling with a precompiled preamble
produce the same source locations as when compiling without the
precompiled preamble; prior to this change, we ended up with different
file IDs for source locations within the precompiled preamble
vs. those after the precompiled preamble, even for entities (e.g.,
preprocessing entities) in the same file.