Граф коммитов

11093 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian 65b0aa5d39 clang ObjC rewriter: generated code used in "for (x in y)" loop uses
incorrect cast, causing compile error (fixes radar 7342867).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92986 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-08 01:29:44 +00:00
John McCall a1d7d627a4 Reorganize PrintOverloadCandidates. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-08 00:58:21 +00:00
Eli Friedman 6c6bda3b0b Fix for PR5967: Make const-marking for LLVM globals correct for cases requiring
run-time initialization, and emit run-time initializers aggresively to avoid
ordering issues with deferred globals.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92976 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-08 00:50:11 +00:00
Douglas Gregor 827feec561 Improve the fix-its for -Wparentheses to ensure that the fix-it
suggestions follow recovery. Additionally, add a note to these
diagnostics which suggests a fix-it for changing the behavior to what
the user probably meant. Examples:

t.cpp:2:9: warning: & has lower precedence than ==; == will be evaluated first
      [-Wparentheses]
  if (i & j == k) {
        ^~~~~~~~
          (     )
t.cpp:2:9: note: place parentheses around the & expression to evaluate it first
  if (i & j == k) {
        ^
      (    )

t.cpp:14:9: warning: using the result of an assignment as a condition
without
      parentheses [-Wparentheses]
  if (i = f()) {
      ~~^~~~~
      (      )
t.cpp:14:9: note: use '==' to turn this assignment into an equality
comparison
  if (i = f()) {
        ^
        ==




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92975 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-08 00:20:23 +00:00
David Chisnall 41d63ed274 Export a public symbol for classes with the GNU runtime.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-08 00:14:31 +00:00
Douglas Gregor 828a197317 Add an "implicit" bit to CXXThisExpr, so that we can track
implicitness without losing track of the (logical or actual) location
where "this" would occur in the source.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 23:12:05 +00:00
Fariborz Jahanian f292fcf6bd Fixes a bug where we were rewriting two definitions of
_objc_method (part of radar 7490408).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 22:51:18 +00:00
Fariborz Jahanian d83658d454 Fixes a bug in my last patch (related to radar 7490331).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92952 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 22:15:31 +00:00
John McCall b67270724f When parsing an identifier as an expression in C++, only try to annotate it
as a type or scope token if the next token requires it.

This eliminates a lot of redundant lookups in C++, but there's room for
improvement;  a better solution would do a single lookup whose kind and
results would be passed through the parser.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 19:29:58 +00:00
Fariborz Jahanian c98cbb4a4a Avoid error when convering a pointer to integer in
rewriting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 18:31:42 +00:00
Fariborz Jahanian 84ed600154 Fix rewriting of ivars. Fixes radar 7490331.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 18:18:32 +00:00
Kovarththanan Rajaratnam 7d0eed6ed7 Convert from char pointer to char array
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92923 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 18:11:14 +00:00
Ted Kremenek 6a12a14a52 Fix typo: rename Rewriter::getRewritenText() -> Rewriter::getRewrittenText().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92922 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 18:00:35 +00:00
Kovarththanan Rajaratnam a66a31940a Tigthen scope of local char array
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 16:01:54 +00:00
Nuno Lopes a9efbf0094 fix PR5869: mangle static symbols like gcc does to make it easier to diff symbol tables
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92911 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 09:36:51 +00:00
John McCall 1eb3e1003d Improve the lead diagnostic for C++ object subscript expressions with
no viable overloads.  Use a different message when the class provides
no operator[] overloads at all; use it for operator(), too.

Partially addresses PR 5900.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92894 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 02:04:15 +00:00
Ted Kremenek 782f2f52b7 Change ObjCContainerDecl to contain the entire range for the '@end'
piece of the declaration.  The '@' and the 'end' are separate tokens,
and require two SourceLocations to accurately track.

This change was motivated because ObjCContainerDecl::getSourceRange()
would previously not return the entire range of the declaration (the
'end' would be left off).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92891 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 01:20:12 +00:00
Chris Lattner 2c48345cf9 _mm_xor_ps does a xor not a nxor. The other 'xor' builtins look fine,
but this one is wrong.  Thanks to Tanya for noticing this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92881 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 00:36:41 +00:00
Douglas Gregor 539c5c3406 Fix the search for visible declarations within a Scope to ensure that
we look into a Scope that corresponds to a compound statement whose
scope was combined with the scope of the function that owns it. This
improves typo correction in many common cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92879 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 00:31:29 +00:00
Douglas Gregor 0d535c89c5 When we typo-correct a base class initializer, point to the base class
specifier that we corrected to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92878 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 00:26:25 +00:00
Douglas Gregor 67dd1d4df1 Whenever we emit a typo-correction diagnostic, also emit a note
pointing to the declaration that we found that has that name (if it is
unique).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92877 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 00:17:44 +00:00
Douglas Gregor a6f2638735 When suggesting a typo correction for an @implementation without a
corresponding @interface, provide a note showing which interface we're
referring to. This note has the fix-it hint on it.

Also, don't automatically apply fix-it hints for notes. They're meant
to express fix-its that would change semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 23:44:25 +00:00
Douglas Gregor 319d57f216 Move the allocation of designators in DesignatedInitExpr to the
ASTContext. Fixes <rdar://problem/7495428>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92867 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 23:17:19 +00:00
John McCall 0acc311bf7 Don't assert when dealing with unsigned casts of lvalues. Fixes PR5961.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 22:57:21 +00:00
John McCall 60fad45739 Derive tighter ranges for & and >> in the conversion-checking code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92862 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 22:07:33 +00:00
Douglas Gregor dffb8010a1 Fix linkage for RTTI names by re-using the logic for computing the
linkage of vtables. Before this, we were emitting RTTI names for
template instantiations with strong external linkage rather than with
weak ODR linkage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 22:00:56 +00:00
Fariborz Jahanian b73e281956 Fix a bug when property is redeclared in multiple
continuation classes and its original declaration
is imported from a protocol. This fixes radar 7509234.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92856 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 21:38:30 +00:00
Douglas Gregor 4b0f21c0f8 Fix marking of virtual members for nested classes whose first non-pure virtual function has a body inlined in the class
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 20:27:16 +00:00
David Chisnall 90665bd87f Fix for PR5691
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92846 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 18:02:59 +00:00
Douglas Gregor adda846839 Make sure that the key-function computation produces the correct
result for a nested class whose first non-pure virtual member function
has an inline body. Previously, we were checking for the key function
before we had seen the (delayed) inline body. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92839 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 17:00:51 +00:00
John McCall b1622a1fd7 Improve the diagnostics used to report implicitly-generated class members
as parts of overload sets.  Also, refer to constructors as 'constructors'
rather than functions.

Adjust a lot of tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 09:43:14 +00:00
Daniel Dunbar d87bcfafc3 Fix (invalid) may-be-uninitialized warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 07:13:04 +00:00
John McCall f2370c9b4a Significantly rework the calculation of effective integer-expression ranges
for -Wsign-compare and -Wconversion, and use that coordinated logic to drive
both diagnostics.  The new logic works more transparently with implicit
conversions, conditional operators, etc., as well as bringing -Wconversion's
ability to deal with pseudo-closed operations (e.g. arithmetic on shorts) to
-Wsign-compare.

Fixes PRs 5887, 5937, 5938, and 5939.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 05:24:50 +00:00
Douglas Gregor 1a78afbde2 Revert my available_externally vtables experiment. It's breaking the LLVM-with-Clang build with linker errors that I have yet to investigate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92822 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 04:50:56 +00:00
Douglas Gregor 159ef1ed9f Make our marking of virtual members functions in a class be
deterministic and work properly with templates. Once a class that
needs a vtable has been defined, we now do one if two things:

  - If the class has no key function, we place the class on a list of
    classes whose virtual functions will need to be "marked" at the
    end of the translation unit. The delay until the end of the
    translation unit is needed because we might see template
    specializations of these virtual functions.
  - If the class has a key function, we do nothing; when the key
    function is defined, the class will be placed on the
    aforementioned list.

At the end of the translation unit, we "mark" all of the virtual
functions of the classes on the list as used, possibly causing
template instantiation and other classes to be added to the
list. This gets LLVM's lib/Support/CommandLine.cpp compiling again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92821 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 04:44:19 +00:00
Mike Stump faef8a402c Reorder to avoid invalidating idx which is an accessor into VCall.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 03:09:19 +00:00
Mike Stump 1e5fd7f8e9 Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92816 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 02:05:39 +00:00
Ted Kremenek 1dac3418f4 Per offline discussion with Doug, don't perform typo correction when we have encountered a fatal error. On some files that are woefully wrong (missing headers) this can cause a 3x slowdown in some cases when parsing the file. It makes sense not to perform typo correction in this case because after a fatal error diagnostics will either be suppressed or not really make any sense.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92809 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 00:23:04 +00:00
Fariborz Jahanian 02deae8f9b Do not diagnose method disguised as property setter
for a 'readonly' property. Fixes radar 7427072.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92808 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 00:18:12 +00:00
John McCall cd7a445c6b Add Expr::EvaluateAsBooleanCondition(), which does unprincipled folding to
try to evaluate an expression as a constant boolean condition.  This has
the same intended semantics as used in folding conditional operators.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92805 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 23:42:56 +00:00
Fariborz Jahanian 791b10d035 Fixed a bug where initializer is a macro in rewrite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92801 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 23:06:29 +00:00
Douglas Gregor 6356a62485 Silence bogus GCC warning
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92787 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 21:55:26 +00:00
Douglas Gregor 074a2cf3c5 Make use of available_externally linkage for vtables when the
non-inline key function of a class template instantiation, when no key
function is present, the class template instantiation itself was
instantiated with an explicit instantiation declaration (aka extern
template). I'm fairly certain that the C++0x specification gives us
this lattitude, although GCC doesn't take advantage of it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92779 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 21:40:05 +00:00
Fariborz Jahanian 2086d544d3 API support for __block variables which are also __weak.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 19:21:35 +00:00
Douglas Gregor bd6d6197fc Improve key-function computation for templates. In particular:
- All classes can have a key function; templates don't change that.
  non-template classes when computing the key function.
  - We always mark all of the virtual member functions of class
  template instantiations. 
  - The vtable for an instantiation of a class template has weak
  linkage. 

We could probably use available_externally linkage for vtables of
classes instantiated by explicit instantiation declarations (extern
templates), but GCC doesn't do this and I'm not 100% that the ABI
permits it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 19:06:31 +00:00
Mike Stump ef372018c2 Add code to skip the emission of available externally functions at -O0. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92749 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 18:48:04 +00:00
Fariborz Jahanian e1f84f8e4c Minor clean up.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92746 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 18:15:57 +00:00
Steve Naroff cd826370bb Remove bogus "C" from preamble block decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92744 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 18:09:31 +00:00
Fariborz Jahanian ab10b2ebad More rewriting of __block APIs. wip.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 18:04:40 +00:00
Steve Naroff d57d7c0904 Fix <rdar://problem/7490212> clang rewriter: return of the mixed line endings, which is
related to <rdar://problem/6596843> clang ObjC rewriter: Line endings still mixed in rewrite output

This fix was dropped when I integrated the 'objective-rewrite' branch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 17:33:23 +00:00