Commit Graph

9295 Commits

Author SHA1 Message Date
Ted Kremenek 8c4c74f4fb Fix diagnostic for reporting bad escape sequence.
Patch by Paul Curtis!

llvm-svn: 120759
2010-12-03 00:09:56 +00:00
Douglas Gregor 6dd3a6a181 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.

llvm-svn: 120744
2010-12-02 21:47:04 +00:00
Fariborz Jahanian fb40bda54e Improve on objc diagnostics. // rdar://8721692
llvm-svn: 120737
2010-12-02 21:00:16 +00:00
Peter Collingbourne 19b961d5f9 Merge transparent union types using member's unqualified type
llvm-svn: 120736
2010-12-02 21:00:06 +00:00
Ted Kremenek 9e618ed1c9 Fix range in printf warnings for invalid conversion specifiers.
llvm-svn: 120735
2010-12-02 20:57:51 +00:00
Peter Collingbourne 102ad54099 Merge transparent union types using member's canonical param type
llvm-svn: 120729
2010-12-02 20:02:29 +00:00
Chris Lattner c5cc2fb980 fix PR8726 by teaching the aggregate init optimization code to handle
structs with references in them correctly.

llvm-svn: 120722
2010-12-02 18:29:00 +00:00
Fariborz Jahanian 3086ddffd7 Test for // rdar://8594790
llvm-svn: 120717
2010-12-02 17:58:10 +00:00
Bob Wilson 2e71fb55c1 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.

llvm-svn: 120716
2010-12-02 17:31:16 +00:00
Fariborz Jahanian 50198098b9 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).

llvm-svn: 120713
2010-12-02 17:02:11 +00:00
Bob Wilson 27d87807f6 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.

llvm-svn: 120694
2010-12-02 07:13:31 +00:00
Chris Lattner 27a3631bac 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:

 call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 400, i32 4, i1 false)
 %.array = getelementptr inbounds [100 x i32]* %Arr, i32 0, i32 0
 %tmp = load i32* %X.addr, align 4
 store i32 %tmp, i32* %.array

and test10 into:

  call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 392, i32 8, i1 false)
  %tmp = getelementptr inbounds %struct.b* %S, i32 0, i32 0
  %tmp1 = getelementptr inbounds %struct.a* %tmp, i32 0, i32 0
  %tmp2 = load i32* %X.addr, align 4
  store i32 %tmp2, i32* %tmp1, align 4
  %tmp5 = getelementptr inbounds %struct.b* %S, i32 0, i32 3
  %tmp10 = getelementptr inbounds %struct.a* %tmp5, i32 0, i32 4
  %tmp11 = load i32* %X.addr, align 4
  store i32 %tmp11, i32* %tmp10, align 4

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.

llvm-svn: 120692
2010-12-02 07:07:26 +00:00
Eric Christopher 8a2ee390be Add support for the common and nocommon attributes.
rdar://8560647

llvm-svn: 120650
2010-12-02 02:45:55 +00:00
Eric Christopher c629a5c7d0 FileCheckize.
llvm-svn: 120648
2010-12-02 02:30:43 +00:00
Eric Christopher 690c2d1ed6 FileCheckize.
llvm-svn: 120647
2010-12-02 02:13:27 +00:00
Chris Lattner e6af88628f 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:

  %str = alloca [10000 x i8], align 16
  %tmp = getelementptr inbounds [10000 x i8]* %str, i64 0, i64 0
  call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 10000, i32 16, i1 false)
  store i8 97, i8* %tmp, align 16
  %0 = getelementptr [10000 x i8]* %str, i64 0, i64 1
  store i8 98, i8* %0, align 1
  %1 = getelementptr [10000 x i8]* %str, i64 0, i64 2
  store i8 99, i8* %1, align 2

Which is much smaller in space and also likely faster.

This is part of PR279

llvm-svn: 120645
2010-12-02 01:58:41 +00:00
Bob Wilson 13e3b00e76 Test use of arm_neon.h with -fno-lax-vector-conversions.
llvm-svn: 120642
2010-12-02 01:18:30 +00:00
Bob Wilson 5ceace4d14 Add a testcase for Radar 8228022.
Make sure the -Wvector-conversions does not cause unnecessary warnings when
using Neon intrinsics with the correct types.

llvm-svn: 120634
2010-12-02 00:25:18 +00:00
Douglas Gregor 8d6d06761f 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.

Fixes <rdar://problem/8714395>.

llvm-svn: 120607
2010-12-01 21:43:58 +00:00
Douglas Gregor aa49ecc458 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.

llvm-svn: 120599
2010-12-01 20:32:20 +00:00
Douglas Gregor d1f69f6a1d 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.

llvm-svn: 120582
2010-12-01 17:42:47 +00:00
John McCall f3735e01ce Restore the lvalue-to-rvalue conversion patch with a minimal fix.
llvm-svn: 120555
2010-12-01 04:43:34 +00:00
Peter Collingbourne 8f6218bfa0 test: add .cu extension
llvm-svn: 120553
2010-12-01 04:22:41 +00:00
Peter Collingbourne 6ab610ce57 Basic, Sema: add support for CUDA location attributes
llvm-svn: 120545
2010-12-01 03:15:31 +00:00
Douglas Gregor e2e50d331c Implement AST import support for class template specializations.
llvm-svn: 120523
2010-12-01 01:36:18 +00:00
Fariborz Jahanian 68500913ec When unknown method is sent to a receiver of
'Class' type, disgnostic should refere to a
class method. Fixes // rdar://8592156

llvm-svn: 120517
2010-12-01 01:07:24 +00:00
Fariborz Jahanian 3a4ea9a76c Declaring local static in global block
literal declaration caused crash in CodeGen.
This patch fixes it. pr8707

llvm-svn: 120486
2010-11-30 23:07:14 +00:00
Argyrios Kyrtzidis e72f7154f1 Follow through references to catch returned stack addresses, local blocks, label addresses or references to temporaries, e.g:
const int& g2() {
  int s1;
  int &s2 = s1; // expected-note {{binding reference variable 's2' here}}
  return s2; // expected-warning {{reference to stack memory associated with local variable 's1' returned}}
}

llvm-svn: 120483
2010-11-30 22:57:32 +00:00
Douglas Gregor a082a49d9e Implement basic AST importing and merging support for class template
declarations.

llvm-svn: 120448
2010-11-30 19:14:50 +00:00
Fariborz Jahanian 1fdbaa84aa Add objc_getClass as an objc builtin function
(// rdar://8592641). Also rename LANGUAGEID to
LanguageID.

llvm-svn: 120437
2010-11-30 18:25:34 +00:00
Douglas Gregor f88e35ba0b 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.

llvm-svn: 120396
2010-11-30 06:16:57 +00:00
Nico Weber ebd45a004d Fix bug in r120299 spotted by dgregor.
llvm-svn: 120389
2010-11-30 04:44:33 +00:00
John McCall 4cec5f806b Fix another case of giving the wrong value kind to a dependent cast to
a non-dependent type.

llvm-svn: 120384
2010-11-30 02:05:44 +00:00
Nick Lewycky 5421621d2b Replace \r\n with \n. No functional change.
llvm-svn: 120379
2010-11-30 01:47:38 +00:00
Argyrios Kyrtzidis 091d97c709 Revert r120331 since it causes spurious warnings and a possible assertion hit when self-host.
llvm-svn: 120351
2010-11-29 23:42:03 +00:00
Fariborz Jahanian e1802eefac Incomplete enum types not to be treated as integer type
when checking for integer signed/unsigned-ness. PR8694,
// rdar://8707031

llvm-svn: 120345
2010-11-29 23:18:09 +00:00
Argyrios Kyrtzidis 569cad9734 Emit warnings if we are returning a reference to a local temporary.
The issue was brought to our attention by Matthieu Monrocq.

llvm-svn: 120331
2010-11-29 22:32:08 +00:00
Nico Weber 44887f69d5 Always use a function's decl context when building default arguments. Fixes http://http://llvm.org/pr8479.
llvm-svn: 120299
2010-11-29 18:19:25 +00:00
John McCall 032092ffc2 Revert r120063, it was wrong.
llvm-svn: 120296
2010-11-29 18:01:58 +00:00
Douglas Gregor 6399366d17 Add a test for C++ [stmt.label]p1, from Sashan!
llvm-svn: 120291
2010-11-29 16:37:40 +00:00
NAKAMURA Takumi c66906a6cb test/CMakeLists.txt: Implement the target "check-all". For now, it has no dependencies.
llvm-svn: 120280
2010-11-29 01:18:56 +00:00
Nico Weber dcf6fc5dc4 Revert parts of r120266 that I did not mean to commit
llvm-svn: 120267
2010-11-28 22:58:38 +00:00
Nico Weber 20c9f1db48 Minor whitespace and comment fixes. No functionality change.
llvm-svn: 120266
2010-11-28 22:53:37 +00:00
Anders Carlsson 66bbf50877 Look through parentheses when deciding whether an expr is a temporary object. Fixes PR8683.
llvm-svn: 120247
2010-11-28 16:40:49 +00:00
Sebastian Redl 002a3c506a Forgot a file in r120182
llvm-svn: 120184
2010-11-26 18:37:14 +00:00
Sebastian Redl 346203105f Allow access to non-static members without an object in sizeof expressions, in C++0x. Patch by Jakub Wieczorek.
llvm-svn: 120182
2010-11-26 16:28:07 +00:00
John McCall 29ac8e2ecd For internal consistency's sake, compute the value kind of a dependent cast
based on the known properties of the casted-to type.  Fixes a crash on spirit.

llvm-svn: 120180
2010-11-26 10:57:22 +00:00
Zhongxing Xu ec0b8e32ee Regionstore: support derived-to-base cast by creating a CXXBaseObjectRegion.
llvm-svn: 120173
2010-11-26 08:21:53 +00:00
Zhongxing Xu 33f13595c9 handle CXXFunctionalCastExpr in visitLValue and Environment.
llvm-svn: 120143
2010-11-25 03:18:57 +00:00
Nick Lewycky ef4f456866 Tie DefineVTablesUsed() in with recursive function instantiation so that we emit
a useful template instantiation stack. Fixes PR8640.

This also causes a slight change to where the "instantianted from" note shows up
in truly esoteric cases (see the change to test/SemaCXX/destructor.cpp), but
that isn't directly the fault of this patch.

llvm-svn: 120135
2010-11-25 00:35:20 +00:00