Sanjiv Gupta
ba1e267a4c
implement EmitVAArg. pretty much the same way other targets do.
...
llvm-svn: 96446
2010-02-17 02:25:52 +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
Anders Carlsson
03db9e9cd3
Correctly calculate base offsets for 'this' pointer adjustments involving virtual bases. This can't be tested yet due to lack of vcall offsets :)
...
llvm-svn: 96441
2010-02-17 02:05:23 +00:00
Ted Kremenek
f602f96e60
Convert clang_getCompletionChunkText() to return a CXString.
...
llvm-svn: 96439
2010-02-17 01:42:24 +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
Ted Kremenek
f441baf6dd
Remove trailing spaces.
...
llvm-svn: 96427
2010-02-17 00:41:40 +00:00
Ted Kremenek
29004673f7
Change clang_getCursorKindSpelling() to return a CXString
...
instead of a 'const char *'.
llvm-svn: 96425
2010-02-17 00:41:32 +00:00
Ted Kremenek
c560b6835e
Change clang_getFileName() to return a 'CXString' instead of 'const char *'.
...
llvm-svn: 96424
2010-02-17 00:41:20 +00:00
Ted Kremenek
5cca6ebae9
Move createCXString() functions out of CIndexer and into the clang::cxstring namespace.
...
We can much more succinctly refer to these functions this way.
Also change the default behavior of createCXString(StringRef&) to duplicate the
string. This is almost always what we want. The other case is where we pass
a constant c-string, which uses the other version of createCXString().
llvm-svn: 96423
2010-02-17 00:41:08 +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
John McCall
347132b32f
IRgen optimization: cache the value of 'this' and 'vtt' instead of
...
repeatedly reloading from an alloca. We still need to create the alloca
for debug info purposes (although we currently create it in all cases
because of some abstraction boundaries that're hard to break down).
llvm-svn: 96403
2010-02-16 22:04:33 +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
d004918ccb
IRgen: Add CreateIRTemp, which creates a temporary alloca but with type converted "not-for-memory". Dunno a better name.
...
llvm-svn: 96374
2010-02-16 19:44:13 +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
Chris Lattner
fff5ed4b55
when a diagnostic is an extension and has no other -W flag,
...
indicate that it was enabled with -pedantic so people know
why they're getting them:
$ printf "int x;" | clang -xc - -pedantic
<stdin>:1:7: warning: no newline at end of file [-pedantic]
int x;
^
llvm-svn: 96365
2010-02-16 18:29:31 +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
Chris Lattner
e983eae273
add two aliases for SSE functions we already have, fixing PR6316.
...
llvm-svn: 96363
2010-02-16 18:21:25 +00:00
Chris Lattner
db5c16bc9c
add freebsd/ppc[64] support, patch by Nathan Whitehorn, PR6318
...
llvm-svn: 96362
2010-02-16 18:14:57 +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
b716a543c9
Move some code around in preparation for virtual base vtables.
...
llvm-svn: 96354
2010-02-16 16:26:28 +00:00
Fariborz Jahanian
e1ff123214
Fix rewriter bug when function call inside block with block parameter
...
causes C++ compile error (radar 7651312).
llvm-svn: 96352
2010-02-16 16:21:26 +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
Benjamin Kramer
64aae50539
Rename argument so the name reflects what it's doing.
...
llvm-svn: 96342
2010-02-16 10:07:31 +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
Anders Carlsson
dc2dba306c
More work on the new layout code.
...
llvm-svn: 96328
2010-02-16 04:49:44 +00:00
John McCall
6ce747220a
When emitting complete destructors for classes with virtual bases, compute
...
the offset to the virtual bases statically inside of relying on the virtual
base offsets in the object's vtable(s). This is both more efficient and
sound against the destructor's manipulation of the vtables.
Also extract a few helper routines.
Oh and we seem to pass all tests with an optimized clang now.
llvm-svn: 96327
2010-02-16 04:15:37 +00:00
John McCall
1e3715acc3
White-list comma expressions with the literal 0 as their RHS against
...
unused-value warnings. This is a common macro idiom.
llvm-svn: 96326
2010-02-16 04:10:53 +00:00
John McCall
81e38507bd
Make the various type-decl Types (and their associated ASTContext routines)
...
accept const decls.
llvm-svn: 96325
2010-02-16 03:57:14 +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
Daniel Dunbar
ce79bc9c7a
c-index-test: Pass appropriate client data.
...
llvm-svn: 96317
2010-02-16 01:55:10 +00:00
Daniel Dunbar
1951192213
ASTUnit: Constant fold UseBumpAllocator to true, we don't care to support this as an argument.
...
llvm-svn: 96316
2010-02-16 01:55:04 +00:00
Daniel Dunbar
7f21a7f7ce
ASTUnit::LoadFromCompilerInvocation - Take ownership of the provided invocation.
...
llvm-svn: 96315
2010-02-16 01:54:54 +00:00
Daniel Dunbar
e922d9bdf0
CompilerInstance: Move LLVMContext member out of constructor.
...
llvm-svn: 96314
2010-02-16 01:54:47 +00:00
Daniel Dunbar
aced322c3c
Switch clang to use its own LLVMContext (not the global one).
...
llvm-svn: 96313
2010-02-16 01:54:33 +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
Ted Kremenek
1ee27e6d9a
Added 'AsWideChar' flag to LengthModifier.
...
llvm-svn: 96309
2010-02-16 01:46:47 +00:00
Douglas Gregor
4563532043
Skeleton for importing Objective-C classes
...
llvm-svn: 96306
2010-02-16 01:20:57 +00:00
Chris Lattner
1b78ea446f
mark __builtin_longjmp noreturn, PR6312
...
llvm-svn: 96302
2010-02-16 00:23:21 +00:00
Douglas Gregor
9503c46a2e
Don't import __va_list_tag or __builtin_va_list when merging
...
llvm-svn: 96299
2010-02-16 00:04:46 +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
Ted Kremenek
d51217e968
Convert GRExprEngine's handling of ObjCMessageExprs to use a worklist
...
to evaluate arguments.
llvm-svn: 96293
2010-02-15 23:02:46 +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
522e22d352
Tell ASTMerge to merge every declaration it sees, rather than cherry-picking those declarations that we know will work.
...
llvm-svn: 96280
2010-02-15 22:05:17 +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
Fariborz Jahanian
02d964babe
Fix a broken rewritin of @implementation keyword.
...
(fixes radar 7649577).
llvm-svn: 96270
2010-02-15 21:11:41 +00:00
John McCall
5f5cbf5d1d
Optimize the implementation of IdDeclInfo pooling in the IdentifierResolver.
...
llvm-svn: 96253
2010-02-15 19:38:00 +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
Duncan Sands
998f9d975b
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96224
2010-02-15 16:14:01 +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
Zhongxing Xu
ec345b7ecb
Simplify code. If we can reach here, the base must be virtual.
...
llvm-svn: 96211
2010-02-15 04:28:35 +00:00
John McCall
7538eec67b
When emitting an aggregate into a temporary, make sure we set the alignment
...
on the alloca.
The fact that codegen makes this class of bug so wonderfully easy to make is
embarrassing.
llvm-svn: 96204
2010-02-15 01:23:36 +00:00
Ted Kremenek
4ba99bee2a
clang::Attr objects should be treated as AST nodes as well by
...
the LLVMConventionsChecker.
llvm-svn: 96202
2010-02-14 22:58:16 +00:00
Ted Kremenek
4853131459
Add LLVM conventions check that scans for AST elements (types, stmts, decls)
...
that allocate heap memory.
llvm-svn: 96184
2010-02-14 19:09:13 +00:00
Ted Kremenek
988805c81e
Change LLVMConventionsChecker to accept an entire translation unit instead
...
of operating on each code decl. This exposes two flaws in AnalysisConsumer
that should eventually be fixed:
(1) It is not possible to associate multiple "actions" with a single
command line argument. This will require the notion of an
"analysis" group, and possibly tablegen support. (although eventually
we want to support dynamically loading analyses as well)
(2) AnalysisConsumer may not actually be scanning the declarations in namespaces.
We'll experiment first in LLVMConventionsChecker before changing the
behavior in AnalysisConsumer.
llvm-svn: 96183
2010-02-14 19:09:05 +00:00
Ted Kremenek
39df94b00d
Rework translation unit actions to actually take an entire translation unit
...
as imput.
llvm-svn: 96182
2010-02-14 19:08:51 +00:00
Ted Kremenek
c968e5e9b9
For the StringRef check, also visit the children of DeclStmts.
...
llvm-svn: 96181
2010-02-14 19:08:43 +00:00
Ted Kremenek
4806a833a7
Place type-checking static methods at type of file (where they will congregate).
...
No functionality change.
llvm-svn: 96180
2010-02-14 19:08:36 +00:00
Chris Lattner
d0413848cc
temporarily revert 96173, it is causing test failures.
...
llvm-svn: 96176
2010-02-14 18:38:38 +00:00
Sanjiv Gupta
1ef8cdd29b
renamed pic16 specifiic macros.
...
llvm-svn: 96173
2010-02-14 18:20:18 +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
Benjamin Kramer
88ab94e7a3
Pass StringRefs to InsertText/ReplaceText in RewriteObjC and remove a ton of unnecessary length arguments.
...
llvm-svn: 96164
2010-02-14 14:14:16 +00:00
Daniel Dunbar
02968e53cf
CIndex: Switch CXSourceRange to proper half-open intervals.
...
- Doug, please review.
llvm-svn: 96162
2010-02-14 10:02:57 +00:00
Daniel Dunbar
edeb9b87e6
CIndex: Avoid an unnecessary getLocForEndOfToken call, the region of interest
...
doesn't need to be a full token.
- Doug, please review.
llvm-svn: 96161
2010-02-14 10:02:42 +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
eb27e7d999
c-index-test: Simplify file scanning code.
...
llvm-svn: 96159
2010-02-14 08:32:32 +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
Daniel Dunbar
2049933196
CIndex: Simplify (remove provably dead code).
...
llvm-svn: 96157
2010-02-14 08:32:11 +00:00
Daniel Dunbar
2f4ba179f5
CIndex: Inline CompareRegionOfInterest(CXSourceRange) into sole caller.
...
llvm-svn: 96156
2010-02-14 08:32:05 +00:00
Daniel Dunbar
80daf53600
Rename translateSourceRange(CXSourceRange) translateCXSourceRange, instead of
...
having overloaded functions with inverse semantics.
llvm-svn: 96155
2010-02-14 08:31:57 +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
Ted Kremenek
184b3383bf
Add new static analyzer for checking LLVM coding conventions: -analyzer-check-llvm-conventions
...
Currently these checks are intended to be largely syntactical, but may get more
sophisticated over time.
As an initial foray into this brave new world, emit a static analyzer warning
when binding a temporary 'std::string' to an 'llvm::StringRef' where the
lifetime of the 'std::string' does not outlive the 'llvm::StringRef'.
llvm-svn: 96147
2010-02-14 02:45:18 +00:00
Ted Kremenek
eff72bb134
Two changes to AnalysisConsumer::HandleTopLevelSingleDecl():
...
(1) Since CXXMethodDecl subclasses FunctionDecl (and CXXDestructorDecl
and CXXConversion subclass CXXMethodDecl), refactor switch statement
to handle them all in one spot.
(2) Use 'DeclarationName::getAsString()' to handle all functions that
don't have simple identifiers (fixing a null dereference when scanning
for specific functions).
llvm-svn: 96146
2010-02-14 02:44:52 +00:00
Daniel Dunbar
c4b4d3953c
CIndex: Kill off CXSourceLocationPtr, and AtEnd arguments.
...
llvm-svn: 96145
2010-02-14 01:47:36 +00:00
Daniel Dunbar
474b207716
CIndex: Stop hiding magic end bit in CXSourceRange locations where clients can't
...
see it. Instead, translate the locations up-front when we create a
CXSourceRange.
- This is part of a move to make CXSourceRange a pure half-open range, which is
a more natural API for clients to deal with. More cleanups to follow.
llvm-svn: 96144
2010-02-14 01:47:29 +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
Anders Carlsson
073a0c88cc
Build fix.
...
llvm-svn: 96140
2010-02-14 00:44:19 +00:00
Anders Carlsson
6a7e6a4c3c
Baby steps towards teaching FinalOverriders about virtual bases.
...
llvm-svn: 96139
2010-02-14 00:37:35 +00:00
Anders Carlsson
1888b44988
Don't try to layout construction vtables for now.
...
llvm-svn: 96138
2010-02-14 00:22:59 +00:00
Anders Carlsson
258a1e35e8
Improve support for non-virtual 'this' pointer adjustments. With this, it should be possible to use the new vtable layout code for all class hierarchies that do not involve virtual bases.
...
llvm-svn: 96137
2010-02-14 00:16:19 +00:00