Commit Graph

6941 Commits

Author SHA1 Message Date
Ted Kremenek 33b9a42f41 Add CIndex support for blocks.
llvm-svn: 100989
2010-04-11 21:47:37 +00:00
Anders Carlsson 343a26b56d Fix a bug where we were adding too many vcall offsets in some cases.
llvm-svn: 100985
2010-04-11 20:04:11 +00:00
Chris Lattner 6033be79b3 avoid double negatives
llvm-svn: 100976
2010-04-11 18:53:08 +00:00
Ted Kremenek 5868ec6e3d Fix CFG bug where bases of member expressions were not always evaluated in a lvalue context. Fixes <rdar://problem/7813989>.
llvm-svn: 100966
2010-04-11 17:02:10 +00:00
Benjamin Kramer 249f50ca04 Fix run line so this test actually tests something.
llvm-svn: 100962
2010-04-11 09:39:39 +00:00
Chris Lattner a36ec4243b fix PR6811 by not parsing 'super' as a magic expression in
LookupInObjCMethod.  Doing so allows all sorts of invalid code
to slip through to codegen.  This patch does not change the 
AST representation of super, though that would now be a natural
thing to do since it can only be in the receiver position and
in the base of a ObjCPropertyRefExpr.

There are still several ugly areas handling super in the parser,
but this is definitely a step in the right direction.

llvm-svn: 100959
2010-04-11 08:28:14 +00:00
Chris Lattner 00dcffded1 fix a problem causing us to lose the ''s around objc interface names
in a diagnostic.

llvm-svn: 100956
2010-04-11 07:04:01 +00:00
Daniel Dunbar 2131f9ba8c Simplify test, in the hopes of making linux happy.
llvm-svn: 100955
2010-04-11 01:10:44 +00:00
Anders Carlsson 7a148f7141 Fix another vbase layout bug.
llvm-svn: 100952
2010-04-10 21:35:33 +00:00
Anders Carlsson 88cf34f2b4 Fix a bug where we would add the same function twice in a vtable.
llvm-svn: 100949
2010-04-10 20:39:29 +00:00
Anders Carlsson 6a75ebb137 Rename -dump-record-layouts to -fdump-record-layouts now that the option behaves like aa flag.
llvm-svn: 100943
2010-04-10 19:09:13 +00:00
Anders Carlsson 291279e3a6 Simplify the virtual base layout code and fix a bug where we wouldn't store the offset for a virtual base.
llvm-svn: 100940
2010-04-10 18:42:27 +00:00
Chris Lattner bc3be65d2e fix PR6805: llvm.objectsize changed to take an i1 instead of an i32.
llvm-svn: 100938
2010-04-10 18:34:14 +00:00
Daniel Dunbar 06ef31c8b1 Driver: Only add extra -L paths on darwin if they exist. Unfortunately, this
means it isn't really possible to write the test case for this code, but this is
the kind of thing that really requires testing against the installed compiler
anyway.

llvm-svn: 100935
2010-04-10 18:18:57 +00:00
Daniel Dunbar 6e444c07b7 Tweak test for portability.
llvm-svn: 100931
2010-04-10 17:45:01 +00:00
Daniel Dunbar 16334e143f Driver: Ignore -fobjc-gc and -fobjc-gc-only for platforms which don't support them.
llvm-svn: 100930
2010-04-10 16:20:23 +00:00
Sebastian Redl c72350ea9f When a member pointer is dereferenced, the class it points into must be complete. Enforce this.
llvm-svn: 100925
2010-04-10 10:14:54 +00:00
John McCall 23eebd9c1e Diagnose more cases of initializing distinct members of an anonymous union
member.  Use a better diagnostic for this case.  Also fix a bug with nested
anonymous structs/unions for -Wreorder;  this last was PR6575.

llvm-svn: 100923
2010-04-10 09:28:51 +00:00
John McCall bb7b658ab5 Diagnose misordered initializers in constructor templates immediately instead of
when they're instantiated.  Merge the note into the -Wreorder warning;  it
doesn't really contribute much, and it was splitting a thought across diagnostics
anyway.  Don't crash in the parser when a constructor's initializers end in a
comma and there's no body;  the recovery here is still terrible, but anything's
better than a crash.

llvm-svn: 100922
2010-04-10 07:37:23 +00:00
Daniel Dunbar 4364558956 Driver/Darwin/x86: When linking, incorporate -L paths based on the path where
Clang is installed. This is designed to match gcc, and is important when
installed in a non-standard location.
 - This is gross, but no worse than ever. It will die when we finally move to
   the compiler-rt based toolchain, any day now.

llvm-svn: 100915
2010-04-10 01:24:22 +00:00
John McCall 09277542f2 Provide manglings for bool and character literal expressions. These are
just integer-literal expressions with special case implementations in the AST.

Fixes rdar://problem/7825453.

llvm-svn: 100905
2010-04-09 21:48:08 +00:00
Douglas Gregor 530805711f When upgrading an Objective-C class from a forward declaration to a
full-fledged @interface, be sure that the declaration has the right
lexical context. <rdar://problem/7827709>

llvm-svn: 100903
2010-04-09 21:30:38 +00:00
Douglas Gregor 06aa50417d Only complain about explicit instantiations following explicit
specializations when the explicit instantiation was... explicitly
written, i.e., not the product of an explicit instantiation of an
enclosing class. Fixes this spurious warning when Clang builds LLVM:

/Volumes/Data/dgregor/Projects/llvm/lib/CodeGen/MachineDominators.cpp:22:1:
warning: explicit instantiation of 'addRoot' that occurs after an
explicit specialization will be ignored (C++0x extension) [-pedantic]

llvm-svn: 100900
2010-04-09 21:02:29 +00:00
Ted Kremenek 800b66be9d Remove fixit for string literal comparison. Telling the user to use 'strcmp' is bad, and
we don't have enough information to tell them how to use 'strncmp'.  Instead, change the
diagnostic to indicate they should use 'strncmp'.

llvm-svn: 100890
2010-04-09 20:26:53 +00:00
John McCall 3155f573f5 Turn access control on by default in -cc1.
Remove -faccess-control from -cc1; add -fno-access-control.
Make the driver pass -fno-access-control by default.
Update a bunch of tests to be correct under access control.

llvm-svn: 100880
2010-04-09 19:03:51 +00:00
Douglas Gregor b10646d4ce Improve diagnostics like "initializing <type> from an expression of
type..." with "initializing <type> with an expression of type...",
which reads better. Thanks to John for the improved wording.

llvm-svn: 100873
2010-04-09 17:53:29 +00:00
Douglas Gregor fb8b27d530 Remove all "used" static functions *after* we have performed all of
the implicit template instantiations we need to perform. Otherwise, we
end up erroneously diagnosing static functions as used if they were
only used within an implicit template instantiation. Fixes a bunch of
spurious failures when building Clang with Clang.

llvm-svn: 100872
2010-04-09 17:41:13 +00:00
John McCall b29f78fb9e Instantiate default argument expressions even if their associated parameter
type isn't dependent.  Fixes rdar://problem/7838962.

llvm-svn: 100871
2010-04-09 17:38:44 +00:00
Chris Lattner 8a651c7116 Don't warn about unused static functions if they are marked with
attr constructor or destructor.  Patch by Jean-Daniel Dupas!

llvm-svn: 100870
2010-04-09 17:25:05 +00:00
Daniel Dunbar 524b4606f7 Forcibly disable test/PCH/pr4489.c, it is flaky on one of the buildbots.
llvm-svn: 100864
2010-04-09 15:30:57 +00:00
Douglas Gregor c68e140657 Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as

t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
      expected 'char *' [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:

t.c:2:9: warning: initializing 'char *' from an expression of type
      'char const [2]' discards qualifiers [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

Fixes <rdar://problem/7447179>.

llvm-svn: 100832
2010-04-09 00:35:39 +00:00
Ted Kremenek e1a38ab422 Use '%clang_cc1' instead of '%clang' to make the warning output more consistent across
platforms (for this test).

llvm-svn: 100827
2010-04-08 23:17:16 +00:00
Douglas Gregor f19ac0ede9 Downgrade the "declaration does not declare anything" error to a
warning. It's not harmful to have such pointless declarations, and GCC
does not diagnose this issue consistently.

llvm-svn: 100814
2010-04-08 21:33:23 +00:00
Fariborz Jahanian d9235dbc02 Implement method type encoding in the presense
of c-style arguments. Completes radar 7445205.

llvm-svn: 100813
2010-04-08 21:29:11 +00:00
Ted Kremenek 5c7f596b4c Match GCC's behavior and do not include '-Wunused-parameter' in '-Wunused'.
llvm-svn: 100810
2010-04-08 21:10:56 +00:00
Jeffrey Yasskin 54eba427ed Explain that a template needs arguments to make it into a type, for
variable declarations.

llvm-svn: 100809
2010-04-08 21:04:54 +00:00
John McCall 17762b8a5d Set access properly on instantiated friend class template declarations.
Fixes PR6752.

llvm-svn: 100806
2010-04-08 20:25:50 +00:00
Ted Kremenek ea4a5abf61 Add static analyzer check for calls to 'pthread_once()' where the control-flow has
automatic storage.  This matches the corresponding check for 'dispatch_once()'.

llvm-svn: 100803
2010-04-08 19:53:31 +00:00
Ted Kremenek a0859f1e7d Update test case.
llvm-svn: 100801
2010-04-08 18:51:47 +00:00
Douglas Gregor 01e09d9d91 Introduce an egregious hack to work around a bug in libstdc++ 4.2.x's
<tr1/hashtable> header, where a friend class template
std::tr1::__detail::_Map_base is declared with the wrong template
parameters. GCC doesn't catch the problem, so Clang does a little
back-flip to avoid diagnosing just this one instance of the problem.

llvm-svn: 100790
2010-04-08 18:16:15 +00:00
Ted Kremenek a1de6fc575 Include all warnings under '-Wunused' in '-Wmost' and '-Wall'.
llvm-svn: 100786
2010-04-08 17:54:28 +00:00
Jeffrey Yasskin c76498d409 Make CXXScopeSpec invalid when incomplete, and propagate that into any
Declarator that depends on it.  This fixes several redundant errors and bad
recoveries.

llvm-svn: 100779
2010-04-08 16:38:48 +00:00
Douglas Gregor eadd3cace9 Eliminate excessive PCH deserialization caused by the search for
__cxxabiv1::__fundamental_type_info in every translation
unit. Previously, we would perform name lookup for
__cxxabiv1::__fundamental_type_info at the end of IRGen for a each
translation unit, to determine whether it was present. If so, we we
produce type information for all of the fundamental types. However,
this name lookup causes PCH deserialization of a significant part of the
translation unit, which has a woeful impact on performance.

With this change, we now look at each record type after we've
generated its vtable to see if it is
__cxxabiv1::__fundamental_type_info. If so, we generate type info for
all of the fundamental types. This works because
__cxxabiv1::__fundamental_type_info should always have a key function
(typically the virtual destructor), that will be defined once in the
support library. The fundamental type information will end up there.

Fixes <rdar://problem/7840011>.

llvm-svn: 100772
2010-04-08 15:52:03 +00:00
John McCall b9c7848ba7 Implement dependent friend function template specializations.
llvm-svn: 100753
2010-04-08 09:05:18 +00:00
Fariborz Jahanian 60462098d4 Patch to implement gcc's cstyle arguments in objc
methods. wip.

llvm-svn: 100734
2010-04-08 00:30:06 +00:00
Jeffrey Yasskin 823015d627 When a template (without arguments) is passed as a template type
parameter, explicitly ask the user to give it arguments.  We used to
complain that it wasn't a type and expect the user to figure it out.

llvm-svn: 100729
2010-04-08 00:03:06 +00:00
Jeffrey Yasskin 4e150f8d35 Fix some redundant errors by changing CXXScopeSpec::isSet calls into
isNotEmpty calls.

llvm-svn: 100722
2010-04-07 23:29:58 +00:00
Chris Lattner 4b73cfabac rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100708
2010-04-07 22:58:06 +00:00
Ted Kremenek 43a9c9626f Don't emit an 'unused expression' warning for '||' and '&&' expressions that contain assignments
or similar side-effects.

llvm-svn: 100676
2010-04-07 18:49:21 +00:00
Chris Lattner 198cb4df6e Instead of counting totally diagnostics, split the count into a count
of errors and warnings.  This allows us to emit something like this:

2 warnings and 1 error generated.

instead of:

3 diagnostics generated.

This also stops counting 'notes' because they are just follow-on information
about the previous diag, not a diagnostic in themselves.

llvm-svn: 100675
2010-04-07 18:47:42 +00:00