Ted Kremenek
2fb89539f7
Clang really intends to reject attribute 'warn_unused_result' on Objective-C methods, but
...
instead it crashes on them. We might extend this attribute to work on methods, but for
now fix the crasher. Addresses <rdar://problem/7670939>.
llvm-svn: 96723
2010-02-21 05:15:32 +00:00
Ted Kremenek
1979007ca8
Don't emit a warning about a dllimport attribute being used in a typedef
...
when -fms-extensions is specified. Fixes <rdar://problem/7653870>.
llvm-svn: 96722
2010-02-21 05:12:56 +00:00
Ted Kremenek
a3cfc4d1e1
Don't warn about functions redeclared without the dllimport attribute when
...
-fms-extensions is enabled. Fixes <rdar://problem/7669559>.
llvm-svn: 96721
2010-02-21 05:12:53 +00:00
Fariborz Jahanian
34e3cef483
Start supporting declaration of ivars in @implementation
...
blocks. WIP.
llvm-svn: 96696
2010-02-19 20:58:54 +00:00
Fariborz Jahanian
c5d61df0a9
Issue extended diagnostic when property dot-syntax is used and
...
there is a setter but no getter (part of radar 7664555).
llvm-svn: 96687
2010-02-19 18:30:30 +00:00
Douglas Gregor
0286b46702
Only parse C++0x attribute specifiers in declarators when in C++0x
...
mode. This allows us to detect invalid VLAs in Objective-C++
mode. This should be the last of <rdar://problem/7660386>.
llvm-svn: 96679
2010-02-19 16:47:56 +00:00
Douglas Gregor
337caf9e3e
Implement C++ name lookup for instance variables of Objective-C classes
...
from an instance method. Previously, we were following the Objective-C
name lookup rules for ivars, which are of course completely different
from and incompatible with the Objective-C++ rules.
For the record, the Objective-C++ rules are the sane ones.
This is another part of <rdar://problem/7660386>.
llvm-svn: 96677
2010-02-19 16:08:35 +00:00
Douglas Gregor
cfd70242ca
Make Sema::ActOnClassMessage robust when name lookup for the receiver
...
name finds something other than a TypedefDecl or an
ObjCInterfaceDecl. This is a small part of <rdar://problem/7660386>.
llvm-svn: 96676
2010-02-19 15:18:45 +00:00
John McCall
b81884d347
More refactoring around constructor/destructor code generation.
...
Fix some bugs with function-try-blocks and simplify normal try-block
code generation.
This implementation excludes a deleting destructor's call to
operator delete() from the function-try-block, which I believe
is correct but which I can't find straightforward support for at
a moment's glance.
llvm-svn: 96670
2010-02-19 09:25:03 +00:00
Anders Carlsson
821095085b
Add another test from the ABI spec.
...
llvm-svn: 96659
2010-02-19 05:59:40 +00:00
Fariborz Jahanian
40efb08d87
Remove this test for now.
...
llvm-svn: 96651
2010-02-19 01:40:48 +00:00
John McCall
d4324148d7
Re-introduce the ctor/dtor alias optimization, this time hidden behind a
...
command-line option which defaults off.
llvm-svn: 96649
2010-02-19 01:32:20 +00:00
Douglas Gregor
5481d329a3
AST import for CStyleCastExpr. With this, we can import Cocoa.h into an empty context
...
llvm-svn: 96648
2010-02-19 01:32:14 +00:00
Douglas Gregor
d8552cdc96
AST import for sizeof and alignof expressions
...
llvm-svn: 96647
2010-02-19 01:24:23 +00:00
Douglas Gregor
52f820ead4
AST import for DeclRefExprs
...
llvm-svn: 96646
2010-02-19 01:17:02 +00:00
Fariborz Jahanian
ad238e2bde
XFAIL until I can fugure out how test check for a pattern when
...
clang is built optimized.
llvm-svn: 96645
2010-02-19 01:11:52 +00:00
Douglas Gregor
f0bc0d22d3
XFAIL some of the c-index-test tests on Windows, where they are failing inexplicably
...
llvm-svn: 96644
2010-02-19 01:10:48 +00:00
Douglas Gregor
c74247eddd
AST import of parenthesized expressions, unary operators, binary
...
operators, and compound assignment operators.
llvm-svn: 96643
2010-02-19 01:07:06 +00:00
Fariborz Jahanian
aef662206b
Patch removes IVars list from ObjCInterfaceDecl and
...
instead relies on their DeclContext for iteration, etc.
llvm-svn: 96638
2010-02-19 00:31:17 +00:00
Douglas Gregor
1e21cc7d19
Re-apply my diagnostics-capture patch for CIndex, with some tweaks to
...
try to address the msvc failures.
llvm-svn: 96624
2010-02-18 23:07:20 +00:00
Ted Kremenek
66f2d6ba7b
Allow GNU attributes to appear in an Objective-C method declaration
...
before the selector name (but after the return type). Among other things,
this allows IBAction to be implemented with an attribute.
llvm-svn: 96623
2010-02-18 23:05:16 +00:00
Douglas Gregor
9773e3d077
Revert my CIndex diagnostic changes (r96603, 96606, 96607), which were
...
breaking the msvc9 builder for unknown reasons.
llvm-svn: 96618
2010-02-18 22:27:07 +00:00
John McCall
334ce7c1c4
Revert the ctor/dtor alias optimization for now; the buildbots can detect
...
some failure here that I can't.
llvm-svn: 96612
2010-02-18 21:31:48 +00:00
Fariborz Jahanian
ffcfecdc1f
Fixed a crash specific to blocks in c++ uncovered by an internal
...
test suite.
llvm-svn: 96608
2010-02-18 20:31:02 +00:00
Douglas Gregor
707cf72cb8
Resurrect the displayDiagnostics parameter to clang_createIndex(), and
...
display captured diagnostics when we can't return an invalid
CXTranslationUnit.
llvm-svn: 96606
2010-02-18 20:11:31 +00:00
John McCall
5c60a6f597
Make deleting and complete dtor variants defer to other dtor variants by
...
calling them as subroutines. This triggers whenever the alias optimization
doesn't, i.e. when the dtor has linkonce linkage or there are virtual bases
or it's the deleting dtor.
llvm-svn: 96605
2010-02-18 19:59:28 +00:00
Douglas Gregor
06dcf0375b
Introduce CIndex API functions for displaying a diagnostic, with some
...
knobs to control formatting. Eventually, I'd like to merge the
implementation of this code with the TextDiagnosticPrinter, so that
it's easy for CIndex clients to produce beautiful diagnostics like the
clang compiler does.
Use this new function to display diagnostics within c-index-test.
llvm-svn: 96603
2010-02-18 19:08:21 +00:00
Ted Kremenek
0e2930979d
Change cursor behavior for attributes to have them visited as part of recursing
...
to the children of a Decl.
llvm-svn: 96599
2010-02-18 18:47:01 +00:00
Daniel Dunbar
1c32596e56
tests: Tweak %clangxx definition to something which should be more portable.
...
llvm-svn: 96593
2010-02-18 18:10:26 +00:00
Douglas Gregor
33cdd81064
Rework how CIndex handles diagnostics. Rather than using a callback,
...
we attach diagnostics to translation units and code-completion
results, so they can be queried at any time.
To facilitate this, the new StoredDiagnostic class stores a diagnostic
in a serializable/deserializable form, and ASTUnit knows how to
capture diagnostics in this stored form. CIndex's CXDiagnostic is a
thin wrapper around StoredDiagnostic, providing a C interface to
stored or de-serialized diagnostics.
I've XFAIL'd one test case temporarily, because currently we end up
storing diagnostics in an ASTUnit that's never returned to the user
(because it contains errors). I'll introduce a temporary fix for this
soon; the real fix will be to allow us to return and query invalid ASTs.
llvm-svn: 96592
2010-02-18 18:08:43 +00:00
Anders Carlsson
e5faca7cda
Fix another bug and add another class.
...
llvm-svn: 96590
2010-02-18 17:32:33 +00:00
Anders Carlsson
aa7444cd7d
Add another class from cxx-vtable-ex.html
...
llvm-svn: 96588
2010-02-18 17:28:16 +00:00
Anders Carlsson
8847d9e40a
More work on vcall offsets.
...
llvm-svn: 96587
2010-02-18 17:26:40 +00:00
Anders Carlsson
664b7d026e
Add tests from the Itanium C++ ABI spec.
...
llvm-svn: 96586
2010-02-18 17:07:24 +00:00
Ted Kremenek
6ab9aa02e3
Add basic cursor traversal for attributes. We currently don't have source
...
ranges for Attr objects, so lookup by cursor location currently doesn't work.
llvm-svn: 96571
2010-02-18 05:46:33 +00:00
Charles Davis
9fcead75ee
Also don't warn about force_align_arg_pointer on function typedefs. (This will
...
break if you declare an actual function using that typedef. Come to think of it,
maybe I should make this part of the type.)
llvm-svn: 96570
2010-02-18 04:56:59 +00:00
Charles Davis
cb9572e7b3
Two fixes related to force_align_arg_pointer:
...
- Also recognize __force_align_arg_pointer__.
- Don't warn if it's used on a function pointer typedef.
llvm-svn: 96568
2010-02-18 04:39:19 +00:00
Douglas Gregor
623421d385
AST import for character literals
...
llvm-svn: 96557
2010-02-18 02:21:22 +00:00
Douglas Gregor
8661a72b48
AST import for forward declarations of Objective-C protocols
...
llvm-svn: 96555
2010-02-18 02:12:22 +00:00
Douglas Gregor
06537af873
Implement import of forward declarations of Objective-C classes
...
llvm-svn: 96554
2010-02-18 02:04:09 +00:00
Charles Davis
fea4845609
Allow redefinitions of extern inline functions in GNU89 mode, just as GCC
...
does. Fixes PR5253.
llvm-svn: 96553
2010-02-18 02:00:42 +00:00
Douglas Gregor
84c51c3581
AST import of Objective-C categories.
...
llvm-svn: 96551
2010-02-18 01:47:50 +00:00
Fariborz Jahanian
f50679151b
__typeof should be able to handle block pointer types when
...
rewriting. Fixes radar 7659483.
llvm-svn: 96549
2010-02-18 01:20:22 +00:00
Douglas Gregor
e5ad57a3ed
Don't diagnose overflow in case statements when the conversion is a
...
signed<->unsigned conversion with the same bit width. Fixes
<rdar://problem/7658121>.
llvm-svn: 96545
2010-02-18 00:56:01 +00:00
Ted Kremenek
1fcc56c57a
Recognize attributes ns_returns_not_retained and cf_returns_not_retained
...
in the static analyzer.
llvm-svn: 96539
2010-02-18 00:06:12 +00:00
Douglas Gregor
12ea0f4ef9
For -Wswitch-enum warnings, be sure to look through typedefs of enum
...
types. Fixes <rdar://problem/7643909>.
llvm-svn: 96531
2010-02-17 23:29:11 +00:00
Douglas Gregor
c0b8c81a07
When diagnosing enumerator values outside of the range of 'int', be
...
sure that we get the "too large" vs. "too small" part of the
diagnostic correct.
llvm-svn: 96524
2010-02-17 22:40:11 +00:00
Fariborz Jahanian
46dbcb2f86
Hopefully make buildbot happy.
...
llvm-svn: 96513
2010-02-17 21:01:05 +00:00
Daniel Dunbar
0ac9445098
PR5803: clang++: Treat untyped 'C' inputs as C++.
...
- Patch by Andrzej K. Haczewski, with a tweak by me to emit a 'deprecated'
diagnostic when we do this. We'll see what zee users say.
llvm-svn: 96511
2010-02-17 20:32:58 +00:00
Daniel Dunbar
78c974fcba
tests: Add '%clangxx' substitution, for 'clang++'
...
llvm-svn: 96510
2010-02-17 20:31:01 +00:00
Fariborz Jahanian
999ddbcf8e
Patch to remove arbitrary imporation of 'self' into
...
a block without it being used. This causes over release
of objects in certain runtime-senitive apps.
(fixes radar 7581175).
llvm-svn: 96501
2010-02-17 19:54:08 +00:00
Daniel Dunbar
d95638df44
Fix test to not force triple, and also to not need stdint.h.
...
llvm-svn: 96499
2010-02-17 19:26:59 +00:00
Douglas Gregor
a11c45866e
Implement AST merging for Objective-C properties.
...
llvm-svn: 96483
2010-02-17 18:02:10 +00:00
Fariborz Jahanian
20912d644a
Allow for declaration and use of ivars in a stand-alone
...
implementation (toward radar 7547942).
llvm-svn: 96479
2010-02-17 17:00:07 +00:00
Douglas Gregor
98d156a87e
AST import for Objective-C protocols
...
llvm-svn: 96478
2010-02-17 16:12:00 +00:00
Tanya Lattner
339c89bce2
Do not add functions marked with the unused attribute to the list of unused functions to warn about. Update test case.
...
llvm-svn: 96452
2010-02-17 04:48:01 +00:00
John McCall
67cea74745
Emit complete constructors and destructors as aliases to base constructors
...
and destructors when the two entities are semantically identical, i.e. when
the class has no virtual base classes. We only do this for linkage types
for which aliases are supported, i.e. internal and external, i.e. not linkonce.
llvm-svn: 96451
2010-02-17 03:52:49 +00:00
Tanya Lattner
8aefcbed49
Fix unused function warning to handle used attributes and redeclarations. Update test case.
...
llvm-svn: 96444
2010-02-17 02:17:21 +00:00
Douglas Gregor
43f54796ab
Implement AST importing and checking for Objective-C method declarations.
...
llvm-svn: 96442
2010-02-17 02:12:47 +00:00
Charles Davis
61170a19e3
Revert r95939, as suggested by Alexandre Julliard from the Wine project (and
...
our own Chris Lattner).
llvm-svn: 96431
2010-02-17 00:44:47 +00:00
Douglas Gregor
7244b0bb86
Implement AST importing of Objective-C instance variables.
...
Check superclasses when merging two Objective-C @interfaces.
llvm-svn: 96420
2010-02-17 00:34:30 +00:00
Fariborz Jahanian
cf01cbef16
More rewriter test converted to compile with clang.
...
llvm-svn: 96406
2010-02-16 22:27:50 +00:00
Fariborz Jahanian
be1896e944
With addition of -Wno-address-of-temporary (thank you Doug) we can now
...
have rewriter test cases which pass the .cpp file through clang
and also test c++ aspect of clang.
llvm-svn: 96405
2010-02-16 22:13:48 +00:00
Devang Patel
7585580ccc
Distinguish two lexical blocks at the same level.
...
llvm-svn: 96397
2010-02-16 21:41:20 +00:00
Douglas Gregor
b154fdc974
Introduce a new kind of failed result for isLvalue/isModifiableLvalue
...
which describes temporary objects of class type in C++. Use this to
provide a more-specific, remappable diagnostic when takin the address
of such a temporary.
llvm-svn: 96396
2010-02-16 21:39:57 +00:00
Daniel Dunbar
fd09df7839
IRgen: Switch 'retval' to use CreateIRTemp.
...
llvm-svn: 96376
2010-02-16 19:45:20 +00:00
Daniel Dunbar
29a32dab4a
Disable warn_unused_function for now, its breaking various project builds due to
...
false positives.
llvm-svn: 96375
2010-02-16 19:44:56 +00:00
Daniel Dunbar
27bacafb71
IRgen: Switch EmitCompoundLiteralLValue to use CreateMemTemp.
...
llvm-svn: 96373
2010-02-16 19:43:39 +00:00
Douglas Gregor
71ad477ab3
Do not try to instantiate invalid declarations. It's a recipe for
...
disaster. Fixes PR6161.
llvm-svn: 96371
2010-02-16 19:28:15 +00:00
Douglas Gregor
fe17d2550b
Improve parsing and instantiation of destructor names, so that we can
...
now cope with the destruction of types named as dependent templates,
e.g.,
y->template Y<T>::~Y()
Nominally, we implement C++0x [basic.lookup.qual]p6. However, we don't
follow the letter of the standard here because that would fail to
parse
template<typename T, typename U>
X0<T, U>::~X0() { }
properly. The problem is captured in core issue 339, which gives some
(but not enough!) guidance. I expect to revisit this code when the
resolution of 339 is clear, and/or we start capturing better source
information for DeclarationNames.
Fixes PR6152.
llvm-svn: 96367
2010-02-16 19:09:40 +00:00
Charles Davis
163855f46d
dllimport and dllexport are declspec attributes, too. They're also
...
Win32-specific.
Also, fix a test to use FileCheck instead of grepping LLVM IR.
llvm-svn: 96364
2010-02-16 18:27:26 +00:00
Fariborz Jahanian
b6a68c0465
Minor rewriter cleanup and a test for a block rewriting bug.
...
llvm-svn: 96361
2010-02-16 17:26:03 +00:00
Ted Kremenek
3eac2454dc
Add test case showing that a recursive block that captures a block pointer that
...
isn't marked '__block' is bad.
llvm-svn: 96357
2010-02-16 16:55:10 +00:00
Anders Carlsson
bc91b44a23
Add an extreme vbase offsets test. I'm kinda amazed that this works myself ;)
...
llvm-svn: 96356
2010-02-16 16:50:08 +00:00
Anders Carlsson
13f0f66223
Handle layout of vtables for virtual bases.
...
llvm-svn: 96355
2010-02-16 16:49:35 +00:00
Anders Carlsson
14157939ab
Fix a bug where we would not emit secondary vtables for bases of a primary base.
...
llvm-svn: 96351
2010-02-16 16:02:57 +00:00
Ted Kremenek
228639746a
Add simpler checker to check if variables captured by a block are uninitialized.
...
llvm-svn: 96341
2010-02-16 08:33:59 +00:00
John McCall
d8d0d43fa3
Support local namespace aliases and permit them to be instantiated.
...
llvm-svn: 96335
2010-02-16 06:53:13 +00:00
Anders Carlsson
77904f1d5b
Emit vbase offsets.
...
llvm-svn: 96329
2010-02-16 04:59:55 +00:00
Sanjiv Gupta
ecd2600c52
Re-applying 96173. Looks like finally I got the test case right.
...
llvm-svn: 96321
2010-02-16 03:37:11 +00:00
Ted Kremenek
588fc83c74
Add test case to show that Clang now checks the format string
...
arguments of asprintf (<rdar://problem/6657191>).
llvm-svn: 96319
2010-02-16 02:14:24 +00:00
Ted Kremenek
ccf701d375
Fix test case.
...
llvm-svn: 96311
2010-02-16 01:47:05 +00:00
Ted Kremenek
c8b188d541
Refactor the logic for printf argument type-checking into analyze_printf::ArgTypeResult.
...
Implement printf argument type checking for '%s'.
Fixes <rdar://problem/3065808>.
llvm-svn: 96310
2010-02-16 01:46:59 +00:00
Douglas Gregor
4563532043
Skeleton for importing Objective-C classes
...
llvm-svn: 96306
2010-02-16 01:20:57 +00:00
Douglas Gregor
b4964f7705
Cope with anonymous tags defined within declarators by structurally
...
comparing their types under the assumption that they are equivalent,
rather than importing the types and then checking for compatibility. A
few minor tweaks here:
- Teach structural matching to handle compatibility between
function types with prototypes and those without prototypes.
- Teach structural matching that an incomplete record decl is the
same as any other record decl with the same name.
- Keep track of pairs of declarations that we have already checked
(but failed to find as structurally matching), so we don't emit
diagnostics repeatedly.
- When importing a typedef of an anonymous tag, be sure to link the
imported tag type to its typedef.
With these changes, we survive a repeated import of <stdlib.h> and
<stdio.h>. Alas, the ASTNodeImporter is getting a little grotty.
llvm-svn: 96298
2010-02-15 23:54:17 +00:00
Benjamin Kramer
634fc10fe1
Add Sema support for __builtin_fpclassify by extending the existing check for __builtin_isinf and friends. Part of PR6083.
...
llvm-svn: 96291
2010-02-15 22:42:31 +00:00
Fariborz Jahanian
8efe0ec899
Issue a bettter diagnostics for incorrect property setter name.
...
(radar 7647953).
llvm-svn: 96284
2010-02-15 22:20:11 +00:00
Chandler Carruth
3e0c140c50
Fix instantiation of template functions with local classes that contain virtual
...
methods.
llvm-svn: 96283
2010-02-15 22:12:26 +00:00
Douglas Gregor
3996e249ed
Reimplement the structural-equality checks used to determine whether
...
two types in different AST contexts are equivalent. Rather than
transforming the type from one context into the other context, we
perform a deep structural comparison of the types. This change
addresses a serious problem with recursive data types like
struct ListNode {
int value;
struct ListNode *Next;
} xList;
llvm-svn: 96278
2010-02-15 22:01:00 +00:00
Fariborz Jahanian
30a42923d3
Class continuation now has its own property ast for
...
those declared in it. This is to allow duplicate
property diagnostics for properties declared in class extensions
multiple times (radar 7629420) and for future use.
llvm-svn: 96276
2010-02-15 21:55:26 +00:00
Fariborz Jahanian
06708cee8d
Test to compile the rewritten file for my last patch.
...
(radar 7649577 related).
llvm-svn: 96274
2010-02-15 21:37:11 +00:00
Devang Patel
e8814ce0a6
Use getLocStart(), instead of getLocEnd(), to record starting location of objc method. :)
...
llvm-svn: 96245
2010-02-15 18:08:38 +00:00
Sanjiv Gupta
9d23f93d52
reverting back 96242 as it still causes a test failure.
...
llvm-svn: 96244
2010-02-15 18:02:12 +00:00
Sanjiv Gupta
af56d377f1
Re-applying 96173 with corresponding changes in test.
...
llvm-svn: 96242
2010-02-15 17:19:13 +00:00
Chandler Carruth
284bb2ec72
Defer covariance checks for dependent types. Add test cases that also ensure
...
they are re-checked on instantiation.
llvm-svn: 96217
2010-02-15 11:53:20 +00:00
Anders Carlsson
033d48697f
Don't compute final overriders or build vtables for bases that don't need a vtable.
...
llvm-svn: 96171
2010-02-14 17:05:59 +00:00
Daniel Dunbar
6092d507f0
c-index-test: Unify and always print half-open extents.
...
llvm-svn: 96160
2010-02-14 08:32:51 +00:00
Daniel Dunbar
98c07e0e23
c-index-test: Unify syntax for printing extents. Yes, there were 4.
...
llvm-svn: 96158
2010-02-14 08:32:24 +00:00
Zhongxing Xu
be36ecbb60
Fix pr6293. If ptr is NULL, no operation is preformed.
...
llvm-svn: 96154
2010-02-14 06:49:48 +00:00
John McCall
38200b081a
Improve the diagnostic given when referring to a tag type without a tag (in C)
...
or that's been hidden by a non-type (in C++).
The ideal C++ diagnostic here would note the hiding declaration, but this
is a good start.
llvm-svn: 96141
2010-02-14 01:03:10 +00:00