Commit Graph

26404 Commits

Author SHA1 Message Date
Douglas Gregor 415ce06ebb Fix silly typo
llvm-svn: 117373
2010-10-26 17:32:59 +00:00
Douglas Gregor 2a1d72d078 Teach typo correction not to return the same keyword that matches a
typo. This can happen with context-sensitive keywords like "super",
when typo correction didn't know that "super" wasn't permitted in this
context.

llvm-svn: 117372
2010-10-26 17:18:00 +00:00
John McCall 925b16629d Optimize field space usage in CompoundStmt, LabelStmt, Expr, and CastExpr.
There's probably still significant padding waste on x86-64 UNIXen, but
the difference in 32-bit compiles should be significant.

There are a lot of Expr nodes left that could lose a word this way.

llvm-svn: 117359
2010-10-26 08:39:16 +00:00
John McCall c3007a2145 No really, we don't have a retain/release system for statements/expressions
anymore.

llvm-svn: 117357
2010-10-26 07:05:15 +00:00
John McCall edba521a03 Cookie crumbs.
llvm-svn: 117356
2010-10-26 06:41:10 +00:00
John McCall 75851b1a7f Actually, that doesn't really work, and anyway we should choose
conversion to id over conversion to void*.

llvm-svn: 117355
2010-10-26 06:40:27 +00:00
John McCall f28e83a73a Consider conversions of Objective-C pointers to 'id' to be basically of
the same rank as conversions of normal pointers to 'void*'.

Also, resurrect a test case.

Fixes rdar://problem/8592139

llvm-svn: 117354
2010-10-26 06:23:29 +00:00
Douglas Gregor 8302541401 Delay complete-type checking for arguments to no-prototype functions
until after we've checked/promoted the argument. Hopefully fixes the
Emacs regression due to my recent change that expanded type-checking
in the presence of K&R function definitions.

llvm-svn: 117353
2010-10-26 05:45:40 +00:00
John McCall 5fe84129e2 A couple of tweaks to the visibility rules:
- tags with C linkage should ignore visibility=hidden
  - functions and variables with explicit visibility attributes should
    ignore the linkage of their types
Either of these should be sufficient to fix PR8457.

Also, FileCheck-ize a test case.

llvm-svn: 117351
2010-10-26 04:59:26 +00:00
John McCall 710d2a831c Pending further discussion, re-enable warnings for Objective C
covariant/contravariant overrides and implementations, but do so under
control of a new flag (-Wno-objc-covariant-overrides, which yes does cover
contravariance too).

*At least* the covariance cases will probably be enabled by default shortly,
but that's not totally uncontroversial.

llvm-svn: 117346
2010-10-26 00:53:53 +00:00
Douglas Gregor f86c939bff When de-serializing a type that is supposed to be canonical, call
getCanonicalType() to make sure that the type we got back is actually
canonical. This is the case for most types, which always build a
canonical type when given canonical components. However, some types that
involve expressions in their canonicalization (e.g., array types with
dependent sizes) don't always build canonical types from canonical
components, because there is no such thing as a "canonical"
expression. Therefore, we do this extra mapping to ensure that the
canonical types we store are actually canonical.

llvm-svn: 117344
2010-10-26 00:51:02 +00:00
Ted Kremenek 6348dac7a0 Fix lazy symbolication bug in RegionStore involving fields of global variables. When invalidated, the entire
globals memory space gets assigned a symbolic value, but that value was not being used for lazy symbolication
of fields of globals.  This could result in cases where bogus null dereferences were being reported.

Fixes PR 8440.

llvm-svn: 117336
2010-10-26 00:06:17 +00:00
Ted Kremenek f59449e790 Move 'includeGlobals' as a field into ClusterAnalysis.
llvm-svn: 117335
2010-10-26 00:06:15 +00:00
Ted Kremenek 731310e13e Tweak null dereference checker to give better diagnostics for null dereferences resulting from array accesses.
llvm-svn: 117334
2010-10-26 00:06:13 +00:00
Dan Gohman dc2c4db598 Add infrastructure for emitting TBAA metadata with the "constant" flag.
llvm-svn: 117328
2010-10-25 23:51:23 +00:00
Fariborz Jahanian 56143ae715 Patch for mis-compile of statement expressions with
non-trivial copy constructors. // rdar: //8540501.
A test will be added to llvm nightly tests.

llvm-svn: 117324
2010-10-25 23:27:26 +00:00
Dan Gohman d831356635 Trim an unnecessary #include.
llvm-svn: 117321
2010-10-25 21:59:29 +00:00
Dan Gohman 7dfd13c167 Factor out the code for creating the Root and Char nodes, so that
they can be used outside of the main getTBAAInfo function.

llvm-svn: 117320
2010-10-25 21:48:30 +00:00
Eric Christopher 55f21aae85 Add and describe a quick script to migrate gcc builtins that clang doesn't
know about to the default APIs for x86 vector operations.

llvm-svn: 117313
2010-10-25 21:17:59 +00:00
Douglas Gregor 59f16ed082 Look through the address-of operator to find the function being
called. Fixes another aspect of PR8314.

llvm-svn: 117308
2010-10-25 20:48:33 +00:00
Douglas Gregor 8e09a72f13 When we're calling a function that we know based on its K&R-style
function definition, we should still use a prototype to type-check and
convert the function arguments, if such a prototype exists. Fixes
PR8314.

llvm-svn: 117305
2010-10-25 20:39:23 +00:00
Ted Kremenek c07d8353e1 Add check for UnknownVals for mutexes in ObjCAtSyncChecker. Fixes crash reported in PR 8458.
llvm-svn: 117300
2010-10-25 20:20:56 +00:00
David Chisnall b62d15c24e Only warn for mismatched types in Objective-C methods when they are incompatible, not when they are simply different. Now we test whether the difference in types breaks the principle of substitutability, rather than whether they are different.
A common idiom in Objective-C is to provide a definition of a method in a subclass that returns a more-specified version of an object than the superclass.  This does not violate the principle of substitutability, because you can always use the object returned by the subclass anywhere that you could use the type returned by the superclass.  It was, however, generating warnings with clang, leading people to believe that semantically correct code was incorrect and requiring less accurate type specification and explicit down-casts (neither of which is a good thing to encourage).

This change ensures that any method definition has parameter and return types that make it accept anything that something conforming to the declaration may pass and return something that the caller will expect, but allows stricter definitions.  

llvm-svn: 117271
2010-10-25 17:23:52 +00:00
Chandler Carruth 0171815ae1 Improve the tracking of source locations for parentheses in constructor calls.
This adds them where missing, and traces them through PCH. We fix at least one
bug in the extents found by the Index library, and make a lot of refactoring
tools which care about the exact formulation of a constructor call easier to
write. Also some minor cleanups to more consistently follow the friend pattern
instead of the setter pattern when rebuilding a serialized AST.

Patch originally by Samuel Benzaquen.

llvm-svn: 117254
2010-10-25 08:47:36 +00:00
Marcin Swiderski 01769904d3 Added generation of destructors for member constant size arrays.
There's only one destructor call generated for each not empty array (at least for now this should be enough).

llvm-svn: 117252
2010-10-25 07:05:54 +00:00
Marcin Swiderski 52e4bc1fed Added generation of destructors for constant size arrays.
There's only one destructor call generated for each not empty array (at least for now this should be enough).

llvm-svn: 117251
2010-10-25 07:00:40 +00:00
Peter Collingbourne a99fdcf93e Implement GNU C extension: two types are compatible if they appear
as a function argument, one of the types is a transparent union type
and the other type is compatible with a union member

llvm-svn: 117243
2010-10-24 18:30:18 +00:00
Argyrios Kyrtzidis e16a5300ba Keep track in chained PCH of implicit members that were added after the definition was completed.
llvm-svn: 117240
2010-10-24 17:26:54 +00:00
Argyrios Kyrtzidis d170d844c4 Start fleshing out ASTMutationListener; notify when a tag definition is completed.
In that case a chained PCH will record the updates to the DefinitionData pointer of forward references.
If a forward reference mutated into a definition re-write it into the chained PCH, this is too big of a change.

llvm-svn: 117239
2010-10-24 17:26:50 +00:00
Argyrios Kyrtzidis 3ba70b89cf Introduce a DeclsToRewrite field in ASTWrite, used for collecting the decls that will be replaced in the chained PCH.
llvm-svn: 117238
2010-10-24 17:26:46 +00:00
Argyrios Kyrtzidis 97bfda9b9b Some method renaming, no functionality change.
llvm-svn: 117237
2010-10-24 17:26:43 +00:00
Argyrios Kyrtzidis eb39d9a9ec Refactoring.
- Pass around RecordDataImpl instead of the concrete RecordData so that any SmallVector can be used.
- Move ASTDeclWriter::WriteCXXDefinitionData to ASTWriter::AddCXXDefinitionData.

llvm-svn: 117236
2010-10-24 17:26:40 +00:00
Argyrios Kyrtzidis 65ad5691fd Put the mechanism in place to track modifications in an AST entity that were committed after
its initial creation/deserialization and store the changes in a chained PCH.

The idea is that the AST entities call methods on the ASTMutationListener to give notifications
of changes; the PCHWriter implements the ASTMutationListener interface and stores the incremental changes
of the updated entity. WIP

llvm-svn: 117235
2010-10-24 17:26:36 +00:00
Argyrios Kyrtzidis ad5f95cc4b Simplify and "robust-ify" the way that CXXRecord references point to the definition data when loaded from PCH.
Temporary disable 'test/PCH/chain-cxx.cpp' until a better way to fix it is in place.

llvm-svn: 117234
2010-10-24 17:26:31 +00:00
Argyrios Kyrtzidis 8b200a5ef1 Minor refactoring; Pull reading/writing DefinitionData out into a function.
llvm-svn: 117233
2010-10-24 17:26:27 +00:00
Anders Carlsson c532c8b106 Fix tyop.
llvm-svn: 117225
2010-10-24 12:51:00 +00:00
Marcin Swiderski 772324971d - Fixed subexpressions evaluation order for binary operators to match order in code generated with the compiler,
- Fixed test cases for unreachable code warnings produced by Sema.

llvm-svn: 117220
2010-10-24 08:21:40 +00:00
Anders Carlsson cdbd70ac69 Move the "used but marked unused" warning behind a special warning flag for now.
llvm-svn: 117219
2010-10-24 04:28:00 +00:00
Douglas Gregor e63d087bcb C++ [basic.scope.hiding] allows an ordinary name to hide a non-tag
name *in the same scope*, but not across scopes. Implement the
highlighted condition.

llvm-svn: 117212
2010-10-23 16:06:17 +00:00
Chandler Carruth c3ce5840af Update remaining attribute macros to new style.
llvm-svn: 117204
2010-10-23 08:44:57 +00:00
Chandler Carruth b7967b91c9 Update to use 'LLVM_*' macro names for attributes.
llvm-svn: 117201
2010-10-23 08:21:37 +00:00
Anders Carlsson 73067a02db Warn if a variable marked with the "unused" attribute is used. Patch by Darin Adler!
llvm-svn: 117184
2010-10-22 23:37:08 +00:00
John McCall 811a0f5578 Parse attributes on enumerators and instantiate attributes on enum decls.
llvm-svn: 117182
2010-10-22 23:36:17 +00:00
Anders Carlsson 21836f726b Minor tweak so that fixit-errors.c is never compiled; it crashes and pops up a crash dialog on my system.
llvm-svn: 117181
2010-10-22 23:35:40 +00:00
Fariborz Jahanian 2b427c7fb0 Update compatibility page for objective-c.
llvm-svn: 117168
2010-10-22 22:35:51 +00:00
Douglas Gregor 263803a6cd Teach clang_getCursorReferenced() and friends about BlockDeclRefExprs.
llvm-svn: 117167
2010-10-22 22:24:08 +00:00
Douglas Gregor c0d2490ac4 In the presence of using declarations, we can find the same class
members in class subobjects of different types. So long as the
underlying declaration sets are the same, and the declaration sets
involve non-instance members, this is not an ambiguity.

llvm-svn: 117163
2010-10-22 22:08:47 +00:00
Ted Kremenek 5c97605c1d Fix a horrible bug in all dataflow analyses that use CFGRecStmtVisitor (including live variables analysis).
We shouldn't recurse into CompoundStmts since they are already inlined in the CFG.  This could result in
bogus dead stores warnings (among other things).

llvm-svn: 117162
2010-10-22 22:08:32 +00:00
Ted Kremenek 7043fba7fa Fix '-analyzer-display-progress' for Objective-C methods. Also remove obsolete code.
llvm-svn: 117161
2010-10-22 22:08:29 +00:00
Fariborz Jahanian 059fe5ba09 Test emoved.
llvm-svn: 117160
2010-10-22 22:05:40 +00:00