Commit Graph

10443 Commits

Author SHA1 Message Date
Fariborz Jahanian bc2ee9382c Match pointer of compatible vection types.
// rdar://9208404

llvm-svn: 129536
2011-04-14 20:33:36 +00:00
Douglas Gregor af670a81e9 When determining the "usage" type of a declaration for the purposes of code
completion, look through block pointer and function pointer types to the
result type of the block/function. Fixes <rdar://problem/9282583>.

llvm-svn: 129535
2011-04-14 20:33:34 +00:00
Anton Korobeynikov 231e875b5c Implement ARM pcs attribute. Basically it's another way of calling convention selection (AAPCS or
AAPCS+VFP), similar to fastcall / stdcall / whatevercall seen on x86.

In particular, all library functions should always be AAPCS regardless of floating point ABI used.

llvm-svn: 129534
2011-04-14 20:06:49 +00:00
Richard Smith f7b6202e6c Implement C++0x [lex.pptoken]p3's handling of <::.
llvm-svn: 129525
2011-04-14 18:36:27 +00:00
Douglas Gregor 23c8476748 Parse an '@' in an Objective-C++ class member specification,
diagnosing it as an error rather than looping infinitely. Also,
explicitly disallow @defs in Objective-C++. Fixes <rdar://problem/9260136>.

llvm-svn: 129521
2011-04-14 17:21:19 +00:00
Sebastian Redl 9ab988fe00 Chained PCH: Remember when additional specializations are added to a function template from a previous PCH. Fixes the only crasher when using massive chains on Clang's Sema component. We still have some incomplete codegen there.
llvm-svn: 129516
2011-04-14 14:07:59 +00:00
Argyrios Kyrtzidis 36e4ae3e57 When creating an implicit member expression through a qualified-id, check that the class
named by the nested-name-specifier is same or base of the class in which the member expression appears.

It seems we also had an ill-formed test case, mon dieu! Fixes rdar://8576107.

llvm-svn: 129493
2011-04-14 00:46:47 +00:00
Anders Carlsson d162fb83f2 In C++, when initializing an array from a pascal string, it's OK if the array
is 1 element smaller than the string, because we can just strip off the last
null character. This matches GCC.

llvm-svn: 129490
2011-04-14 00:41:11 +00:00
Anders Carlsson a5a9bafeb9 Rename test.
llvm-svn: 129486
2011-04-13 23:55:47 +00:00
Chandler Carruth a7773f719e Add -no-canonical-prefixes to tests which assert on the name of the
built clang binary that is used by the test. Build systems that use
symlinks for build outputs will fail these assertions otherwise.

llvm-svn: 129482
2011-04-13 22:28:36 +00:00
Fariborz Jahanian 38675543c5 Issue the 2nd fixit even if fix-it hint is supressed.
// rdar://9091893

llvm-svn: 129481
2011-04-13 22:18:37 +00:00
Fariborz Jahanian e72509c10c No fixit hint for builtin expressions which are
defined in a macro. // rdar://9091893

llvm-svn: 129465
2011-04-13 20:31:26 +00:00
Bill Wendling a865185ad6 Removing the unaligned load tests from builtins-x86.c since they're generated by a regular 'load' now.
llvm-svn: 129464
2011-04-13 20:17:22 +00:00
Chandler Carruth 0a7aa3b60b Teach -Wuninitialized about C++'s typeid expression, including both the
evaluated and unevaluated contexts. Add some testing of sizeof and
typeid.

Both of the typeid tests added here were triggering warnings previously.
Now the one false positive is suppressed without suppressing the warning
on actually buggy code.

llvm-svn: 129431
2011-04-13 08:18:42 +00:00
Francois Pichet 48c946e5ef In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal to the type of one of the base classes then downgrade the missing typename error to a warning. Up to now this is the only case I found where MSVC doesn't require "typename" at class scope. Really strange!
This fixes 1 error when parsing the MSVC 2008 header files.
Example:

template<class T> class A {
public:
  typedef int TYPE;
};
template<class T> class B : public A<T> {
public:
  A<T>::TYPE a; // no typename required because A<T> is a base class.
};

llvm-svn: 129425
2011-04-13 02:38:49 +00:00
Fariborz Jahanian 82bc436c28 Redeclaration of 'self' should be flagged in
objective-c instead of crashing in IRgen.
// rdar://9154582.

llvm-svn: 129412
2011-04-12 23:39:33 +00:00
Daniel Dunbar 9c8cd4c097 IRgen/Obj-C: Emit CFStrings and NSStrings with the alignment of the char type,
there is no reason to align them higher.
 - This roughly matches llvm-gcc's r126913.
 - It is an open question whether or not we should do this for cstring's in
   general (code size vs optimization potential), for now we just match llvm-gcc
   until someone wants to run some experiments.

llvm-svn: 129410
2011-04-12 23:30:52 +00:00
John McCall 58989b7125 We can't emit an aggregate cast as its sub-expression in general just
because the result is ignored.  The particular example here is with
property l-values, but there could be all sorts of lovely casts that this
isn't safe for.  Sink the check into the one case that seems to actually
be capable of honoring this.

llvm-svn: 129397
2011-04-12 22:02:02 +00:00
Ted Kremenek ced5feaec9 Teach VariadicMethodTypeChecker to not crash when processing methods declared in protocols.
llvm-svn: 129395
2011-04-12 21:47:05 +00:00
Ted Kremenek 8a4c760c20 ArrayBoundCheckerV2: don't arbitrarily warn about indexing before the 0-index of a symbolic region. In many cases that isn't really the base offset.
llvm-svn: 129366
2011-04-12 17:21:33 +00:00
Lenny Maiorani f3539ad5c7 This patch adds modeling of strcmp() to the CString checker. Validates inputs are not NULL and are real C strings, then does the comparison and binds the proper return value. Unit tests included.
llvm-svn: 129364
2011-04-12 17:08:43 +00:00
Fariborz Jahanian 240400b746 Fix a regression where the initializer implements
the initialized's protocol and yet clang warns.
objective-c issue, // rdar://9267196

llvm-svn: 129363
2011-04-12 16:34:14 +00:00
Richard Smith 0f538460d2 Fix AST serialization of reference-to-reference types. This previously caused
a crash when deserializing the AST for this:

  typedef char (&R);
    extern R &r;

llvm-svn: 129358
2011-04-12 10:38:03 +00:00
Ted Kremenek f52718899f static analyzer: invalidate by-ref arguments passed to constructors in a 'new' expression.
llvm-svn: 129349
2011-04-12 05:12:39 +00:00
Ted Kremenek 57a4a152b2 Fix bug in SimpleSValBuilder where '--' pointer arithmetic was treated like '++' pointer arithmetic.
llvm-svn: 129348
2011-04-12 03:49:37 +00:00
Douglas Gregor c05f657d83 Don't suggest dynamic_cast or typeid as code completion results when
RTTI is disabled. Similarly, don't suggest throw or try as code
completion results when C++ exceptions are disabled. Fixes
<rdar://problem/9193560>.

llvm-svn: 129346
2011-04-12 02:47:21 +00:00
John McCall a97f329869 Template static data members can have weak_odr linkage, not just
weak linkage.  Also, fix a problem where global weak variables
with non-trivial initializers were getting guard variables, or at
least were checking for them and then crashing.

llvm-svn: 129342
2011-04-12 01:46:54 +00:00
John McCall b4744a3f4d Whoops.
llvm-svn: 129341
2011-04-12 01:15:45 +00:00
Douglas Gregor 8e93666a71 Objective-C++: The global namespace is an associated namespace of an
Objective-C pointer type. Fixes <rdar://problem/9142559>.

llvm-svn: 129339
2011-04-12 01:02:45 +00:00
John McCall 32f44bd0fc Ignore indirect field declarations. Fixes PR9570.
llvm-svn: 129337
2011-04-12 01:01:22 +00:00
John McCall f31fac4712 Formatting.
llvm-svn: 129336
2011-04-12 00:59:32 +00:00
John McCall 9fcede85dd This test works now; enable it.
llvm-svn: 129335
2011-04-12 00:57:12 +00:00
Ted Kremenek 4f939da02d RegionStoreManager::invalidateRegions: treat classes the same as structs.
llvm-svn: 129333
2011-04-12 00:44:31 +00:00
John McCall 2979fe01da After some discussion with Doug, we decided that it made a lot more sense
for __unknown_anytype resolution to destructively modify the AST.  So that's
what it does now, which significantly simplifies some of the implementation.
Normal member calls work pretty cleanly now, and I added support for
propagating unknown-ness through &.

llvm-svn: 129331
2011-04-12 00:42:48 +00:00
Ted Kremenek e0d2b8c58c Teach GRState::getSValAsScalarOrLoc() about C++ references.
llvm-svn: 129329
2011-04-12 00:28:12 +00:00
Ted Kremenek 8ef59e5c03 C++ static analysis: also invalidate fields of objects that are the callees in C++ method calls.
llvm-svn: 129308
2011-04-11 22:22:05 +00:00
Fariborz Jahanian fae2e8df37 Fixup more objc rwriter bug having to do with
rewriting of blocks which have objective-c
stuff which need be rewritten as well. // rdar://9254348

llvm-svn: 129300
2011-04-11 21:17:02 +00:00
Anders Carlsson 0c63350b0b If there's an invoke destination, we should use invoke instead of call when calling the __cxa_bad_typeid function. Fixes PR7400.
llvm-svn: 129273
2011-04-11 14:13:40 +00:00
John McCall 2d2e870745 More __unknown_anytype work.
llvm-svn: 129269
2011-04-11 07:02:50 +00:00
Anders Carlsson c1c9971cab When we know that a dynamic_cast always returns null, we can make
CodeGenFunction::EmitDynamicCast always return null or throw a bad_cast 
exception.

llvm-svn: 129264
2011-04-11 01:45:29 +00:00
Eli Friedman 554eba9c08 PR9669: implement correct checking for [dcl.init.string]p2.
llvm-svn: 129260
2011-04-11 00:23:45 +00:00
Anders Carlsson 50ddb5cc0a Remove the CodeGenCXX/dyncast.cpp test; it isn't really super useful to match on huge chunks of LLVM output.
llvm-svn: 129258
2011-04-10 23:15:15 +00:00
John McCall 3aef3d8713 Simplify calling CheckPlaceholderExpr, converge on it in a few places,
and move a vector-splat check to follow l-value conversion.

llvm-svn: 129254
2011-04-10 19:13:55 +00:00
Anders Carlsson c53d9e8350 Strip off parens and no-op casts when deciding if an expr can be devirtualized. Fixes the second half of PR9660.
llvm-svn: 129253
2011-04-10 18:20:53 +00:00
Anders Carlsson e5ec21c977 Change CollectPrimaryBases to collect the bases in the right order. Fixes one half of PR9660.
llvm-svn: 129252
2011-04-10 18:00:32 +00:00
Chandler Carruth 016ef400c4 Enhance the diagnostic for literal float -> int conversions to suggest
rewriting the literal when the value is integral. It is not uncommon to
see code written as:

  const int kBigNumber = 42e5;

Without any real awareness that this is no longer an ICE. The note helps
automate and ease the process of fixing code that violates the warning.

llvm-svn: 129243
2011-04-10 08:36:24 +00:00
Eli Friedman 493c34a86c PR9580: Handle vectors correctly in ScalarExprEmitter::EmitRem.
While I'm here, FileCheck-ize the ext-vector test, so we actually check
what it is generating.

llvm-svn: 129241
2011-04-10 04:44:11 +00:00
Francois Pichet 53fe2bb29e MSVC accepts that default parameters be redefined for member functions
of template class. The new value is ignored.

This fixes 1 error when parsing MSVC 2010 header files with clang.

llvm-svn: 129240
2011-04-10 03:03:52 +00:00
John McCall 39439739cf Fix a bunch of major problems with __unknown_anytype and properly test
for them.  The only major missing feature is references.

llvm-svn: 129234
2011-04-09 22:50:59 +00:00
Eli Friedman db42a3e876 Make sure we or together the overflow flags of the multiply and add, so the
check is triggered appropriately.  Reported on cfe-dev.

llvm-svn: 129231
2011-04-09 19:54:33 +00:00