Bob Wilson [Sat, 13 Aug 2011 05:03:46 +0000 (05:03 +0000)]
Move handling of vget_lane/vset_lane before the code that checks the type.
Unlike most of the other Neon intrinsics, these are not overloaded and do not
have the extra argument that specifies the vector type. This has not been
fatal because the lane number operand is supposed to be an ICE and so that
value has harmlessly been used as the type identifier. Radar 9901281.
Ted Kremenek [Fri, 12 Aug 2011 23:37:29 +0000 (23:37 +0000)]
Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at.
Ted Kremenek [Fri, 12 Aug 2011 23:04:46 +0000 (23:04 +0000)]
[analyzer] change "tag" in ProgramPoint from "void*" to a ProgramPointTag*.
Having a notion of an actual ProgramPointTag will aid in introspection of the analyzer's behavior.
For example, the GraphViz output of the analyzer will pretty-print the tags in a useful manner.
Anna Zaks [Fri, 12 Aug 2011 21:56:43 +0000 (21:56 +0000)]
MacOSKeychainAPIChecker:
Report errors earlier: on checkDeadSymbols() and clear the state after the symbol we are tracking goes out of scope.
Also, perform lazy error checking. Instead of forcing the paths to be split depending one the return value of the allocator, make the return symbol depend on the allocated data symbol, which prolongs its life span to the time when the allocated data symbol becomes dead.
Jordy Rose [Fri, 12 Aug 2011 21:41:07 +0000 (21:41 +0000)]
[analyzer] Nitpicks on Olaf's patch, which I meant to e-mail but then didn't in
time. One is cleanup, the other is me being OCD about enum group nesting.
Anna Zaks [Fri, 12 Aug 2011 21:14:26 +0000 (21:14 +0000)]
MacOSKeychainAPIChecker: There is no need to use SymbolMetadata to represent the allocated data symbol, we can just use the symbol corresponding to the SymbolicRegion. This simplifies tracking of the symbol, for example, SymbolMetadata needs to go through extra hoops to stay alive.
Make AllocationState internal to the MacOSKeychainAPIChecker class.
Douglas Gregor [Fri, 12 Aug 2011 05:59:41 +0000 (05:59 +0000)]
Switch the Objective-C 'Class' type over to a predefined type in the
AST file format, lazily generating the actual declaration in
ASTContext as needed.
Douglas Gregor [Fri, 12 Aug 2011 05:46:01 +0000 (05:46 +0000)]
Move the creation of the predefined typedef for Objective-C's 'id'
type over into the AST context, then make that declaration a
predefined declaration in the AST format. This ensures that different
AST files will at least agree on the (global) declaration ID for 'id',
and eliminates one of the "special" types in the AST file format.
Douglas Gregor [Fri, 12 Aug 2011 01:39:19 +0000 (01:39 +0000)]
Collapse ASTWriter::WriteASTChain into ASTWriter::WriteASTCore,
eliminating a pile of redundant code (and probably some bugs in the
process). The variation between chained and non-chained PCH is fairly
small now anyway.
Nick Lewycky [Fri, 12 Aug 2011 01:14:22 +0000 (01:14 +0000)]
The diagtool registration system tries to use a global variable from a method
called on another global variable. Use ManagedStatic to ensure that the global
we register with actually exists when we need it.
Anna Zaks [Fri, 12 Aug 2011 00:34:56 +0000 (00:34 +0000)]
Optimizations for Dependent Symbol tracking (as per Ted's code review for r137309):
1) Change SymbolDependTy map to keep pointers as data. And other small tweaks like making the DenseMap smaller 64->16 elements; remove removeSymbolDependencies() as it will probably not be used.
Douglas Gregor [Fri, 12 Aug 2011 00:15:20 +0000 (00:15 +0000)]
In the serialized AST format, make the translation unit a "predefined"
declaration that never actually gets serialized. Instead, serialize
the various kinds of update records (lexical decls, visible decls, the
addition of an anonymous namespace) for the translation unit, even if
we're not chaining. This way, we won't have to deal with multiple
loaded translation unit declarations.
Richard Trieu [Thu, 11 Aug 2011 22:38:21 +0000 (22:38 +0000)]
The current warning in -Wnull-arithmetic for comparisons between NULL and non-pointers is not very helpful. This patch will update the wording to be more helpful to users.
Old warning:
warning: use of NULL in arithmetic operation [-Wnull-arithmetic]
return 10 <= NULL;
^ ~~~~
New warning:
warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
return 10 <= NULL;
~~ ^ ~~~~
Douglas Gregor [Thu, 11 Aug 2011 22:18:49 +0000 (22:18 +0000)]
When initializing a context from a particular AST file, check whether
either "special" type has already been initialized. Previously, we did
this check based on just the first special type (__builtin_va_list),
but now we have some NULL special type entries to content with.
Douglas Gregor [Thu, 11 Aug 2011 20:58:55 +0000 (20:58 +0000)]
Encapsulate the Objective-C id/Class/SEL "redefinition" types in
ASTContext with accessors/mutators. The only functional change is that
the AST writer won't bother writing the id/Class/SEL redefinition type
if it hasn't been explicitly set; previously, it ended up being
written as a synonym for the built-in id/Class/SEL.
Anna Zaks [Thu, 11 Aug 2011 16:43:28 +0000 (16:43 +0000)]
Analyzer Core: Adding support for user-defined symbol dependencies. (For example, the allocated resource symbol only needs to be freed if no error has been returned by the allocator, so a checker might want to make the lifespan of the error code symbol depend on the allocated resource symbol.) Note, by default, the map that holds the dependencies will get destroyed along with the SymbolManager at the end of function exploration.
John McCall [Thu, 11 Aug 2011 02:22:43 +0000 (02:22 +0000)]
Simplify EH control flow by observing that EH scopes form a simple
hierarchy of delegation, and that EH selector values are meaningful
function-wide (good thing, too, or inlining wouldn't work).
2,3d
1a
hierarchy of delegation and that EH selector values have the same
meaning everywhere in the function instead of being meaningful only
in the context of a specific selector.
This removes the need for routing edges through EH cleanups,
since a cleanup simply always branches to its enclosing scope.
Anna Zaks [Wed, 10 Aug 2011 23:14:54 +0000 (23:14 +0000)]
Analyzer Core: In checkDeadSymbols checker callback, provide the state in which the symbols are not yet deleted so that checkers could inspect them. Since we are now always creating a transition in ProcessStmt(), remove the logic for adding a transition when none was generated. TODO: the extra transitions will have to be removed; more cleanups; a checker that tests teh new fucntionality.
Douglas Gregor [Wed, 10 Aug 2011 21:59:45 +0000 (21:59 +0000)]
When performing the lookup in the current scope for a member access to
a member template, e.g.,
x.f<int>
if we have found a template in the type of x, but the lookup in the
current scope is ambiguous, just ignore the lookup in the current
scope. Fixes <rdar://problem/9915664>.
[arcmt] When checking whether properties needs to be strong or not, take into account
that assigning result of -retain means it should be strong. rdar://9931757.
objective-c: Using existing infrastructure for finding
overridden methods to diagnose their type mismatch.
This is a general solution for previous fixes
for // rdar://6191214 and // rdar://9352731
and removes lots of duplicate code.
Douglas Gregor [Wed, 10 Aug 2011 16:59:20 +0000 (16:59 +0000)]
Expand test of C++0x [class.copymove]p15 to make sure we're actually calling the copy constructor of a base/member from an explicitly-defaulted copy constructor, rather than the default constructor
Douglas Gregor [Wed, 10 Aug 2011 16:51:53 +0000 (16:51 +0000)]
When adding the base and member initializers for an implicitly-defined
special member function, make sure to classify an explicitly-defaulted
copy constructor as a "copy" operation. Fixes PR10622.
Douglas Gregor [Wed, 10 Aug 2011 15:22:55 +0000 (15:22 +0000)]
Rewrite default initialization of anonymous structs/unions within a
constructor. Previously, we did some bogus recursion into the fields
of anonymous structs (recursively), which ended up building invalid
ASTs that would cause CodeGen to crash due to invalid GEPs.
Now, we instead build the default initializations based on the
indirect field declarations at the top level, which properly generates
the sequence of GEPs needed to initialize the proper member. Fixes
PR10512 and <rdar://problem/9924046>.
John McCall [Wed, 10 Aug 2011 04:12:23 +0000 (04:12 +0000)]
Change an assert into a check. I'm pretty sure there was a point
in time when this assert was valid, but it's not valid now.
Also teach this code to correctly introduce function-to-pointer
decay.
Thread Safety: Added basic argument parsing for all new attributes.
This patch special cases the parser for thread safety attributes so that all
attribute arguments are put in the argument list (instead of a special
parameter) since arguments may not otherwise resolve correctly without two-token
lookahead.
This patch also adds checks to make sure that attribute arguments are
lockable objects.
Douglas Gregor [Tue, 9 Aug 2011 17:23:49 +0000 (17:23 +0000)]
Move the creation of the record type for the state of Objective-C fast
enumerations from the ASTContext into CodeGen, so that we don't need
to serialize it to AST files. This appears to be the last of the
low-hanging fruit for SpecialTypes.
Douglas Gregor [Tue, 9 Aug 2011 16:24:26 +0000 (16:24 +0000)]
Don't serialize the block descriptor or block extended descriptor
types to AST files; they're only used by debug info generation anyway,
and shouldn't ever exist in the AST anyway.
Douglas Gregor [Tue, 9 Aug 2011 15:54:21 +0000 (15:54 +0000)]
Move the construction of the RecordDecl representing the runtime
layout of a constant NSString from the ASTContext over to CodeGen,
since this is solely CodeGen's responsibility. Eliminates one of the
unnecessary "special" types that we serialize.
Douglas Gregor [Tue, 9 Aug 2011 15:13:55 +0000 (15:13 +0000)]
Migrate the serialization of ASTContext's AutoDeduceTy and
AutoRRefDeductTy from the "special types" block to predefined
types. The latter behaves better when loading multiple AST files.
Don't emit memcpy for copying fields of arrays of volatile elements.
Use the the path that generates a loop. This fixes
bogus error that clang puts out. // rdar://9894548
objective-c: diagnose protocol inconsistencies in following
situation. When a class explicitly or implicitly (through inheritance)
"conformsTo" two protocols which conflict (have methods which conflict).
This patch fixes the previous patch where warnings were coming out in
non-deterministic order. This is 2nd part of // rdar://6191214.
David Chisnall [Mon, 8 Aug 2011 17:32:19 +0000 (17:32 +0000)]
Silence the category-replacing-class-method warning for +load: category
implementations of +load do not replace the class definition in a meaningful
sense, they are run when the category loads, the +load method for class is run
when the class is loaded.