Commit Graph

18989 Commits

Author SHA1 Message Date
Sebastian Redl
4e52123d06 Fix -H. It was pretty broken.
llvm-svn: 129514
2011-04-14 14:07:45 +00:00
Sebastian Redl
eb931c6b0e The ASTReader created by -chain-include used the generated PCH buffers in the wrong order. The effect was that all but the first chain-include files was ignored for subsequent compilations.
llvm-svn: 129513
2011-04-14 14:07:41 +00:00
Ted Kremenek
9eb0b7d2f1 Return the correct lastly populated block from CFGBuilder::VisitUnaryExprOrTypeTraitExpr().
llvm-svn: 129499
2011-04-14 01:50:50 +00:00
Ken Dyck
3563aa6520 Replace a couple of divide-by-8s with divide-by-charwidths. No change in
functionality intended.

llvm-svn: 129496
2011-04-14 01:00:39 +00:00
Eli Friedman
6620ddeaa4 Re-fix r129481 and r129465 properly. Nulls fixits shouldn't be dropped in
DiagnosticBuilder::AddFixItHint: they will be dropped along with any
other (possibly valid) fixits later.

llvm-svn: 129495
2011-04-14 00:51:41 +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
Ken Dyck
c5ca87675e Replace a couple of divisions-by-'8' with divisions-by-charwidth. No change
in functionality intended.

llvm-svn: 129491
2011-04-14 00:43:09 +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
752454092c Add a flag to StringLiteral to keep track of whether the string is a pascal string or not.
llvm-svn: 129488
2011-04-14 00:40:03 +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
Axel Naumann
43dec14079 From Vassil Vassilev: Give external source's last resort lookup a chance, even if an identifier could resolve to a builtin.
llvm-svn: 129438
2011-04-13 13:19:46 +00:00
Bill Wendling
2c1c33552d Remove comment that snuck in there.
llvm-svn: 129434
2011-04-13 10:05:14 +00:00
Bill Wendling
88ae43772a It looks like the FreeBSD buildbot needs this for the builtins-x86.c test.
llvm-svn: 129433
2011-04-13 10:02:54 +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
Argyrios Kyrtzidis
71c58f3d59 Collect the options applicable to the Rewriter methods into a RewriterOptions struct.
llvm-svn: 129430
2011-04-13 07:15:11 +00:00
Bill Wendling
b9c9e34cb3 Just use a native "load" instead of translating the builtin later. Clang can
take it!

I wasn't able to get __builtin_ia32_loaddqu to transform into an unaligned
load...I'll have to look into it further.

llvm-svn: 129427
2011-04-13 05:58:17 +00:00
Francois Pichet
efc283c076 Still not used to put the * next to the variable name.
llvm-svn: 129426
2011-04-13 02:44:57 +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
Anders Carlsson
bbe277c4a9 Use EmitCallOrInvoke in EmitBadTypeidCall and EmitBadCastCall.
llvm-svn: 129424
2011-04-13 02:35:36 +00:00
Bill Wendling
3137d3cb49 Convert the unaligned load builtins to the first-class versions.
llvm-svn: 129420
2011-04-13 00:36:37 +00:00
Daniel Dunbar
dc8355e81a Driver/no-integrated-as: Fix forwarding of -g flag to assembler, when .s input
undergoes preprocessing.

llvm-svn: 129414
2011-04-12 23:59:20 +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
905a602e0c Fix another IdempotentOperationsChecker corner case when determining if an active block on the worklist
impacts the results of the check.

llvm-svn: 129394
2011-04-12 21:47:02 +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
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
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
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
Chris Lattner
20b90d061a fix the path to ld.so for darwin/ppc, resolving PR9677. Patch
by Jeremy Huddleston!

llvm-svn: 129299
2011-04-11 21:15:37 +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
8a01a751c9 Remove CK_DynamicToNull.
llvm-svn: 129265
2011-04-11 02:03:26 +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
Anders Carlsson
267c0c930e Add CXXDynamicCastExpr::isAlwaysNull() which will be replacing the cast kind I added.
llvm-svn: 129263
2011-04-11 01:43:55 +00:00
Anders Carlsson
882d790f72 Clean up CodeGenFunction::EmitDynamicCast. No functionality change.
llvm-svn: 129262
2011-04-11 00:46:40 +00:00
Anders Carlsson
98981b10c8 Replace a couple of Builder.CreateICmpEQ with Builder.CreateIsNull. No functionality change.
llvm-svn: 129261
2011-04-11 00:30:07 +00:00