Jordy Rose [Tue, 16 Aug 2011 21:24:21 +0000 (21:24 +0000)]
[analyzer] Overhaul of checker registration in preparation for basic plugin support. Removes support for checker groups (we can add them back in later if we decide they are still useful), and -analyzer-checker-help output is a little worse for the time being (no packages).
Ted Kremenek [Tue, 16 Aug 2011 10:57:37 +0000 (10:57 +0000)]
[analyzer] Enhance ConditionVisitor to handle arbitrary ValueDecls in binary expressions, and also handle inverting the order of comparison when the named decl appears on the RHS.
[libclang] Require explicit cursor visitation for all TypeLocs (compilation will
fail if a TypeLoc kind is not handled) and handle DecltypeTypeLoc and InjectedClassNameTypeLoc.
Ted Kremenek [Mon, 15 Aug 2011 22:10:47 +0000 (22:10 +0000)]
Take 2 (take 3?) at removing derelict clang.xcodeproj. All Xcode users should be using CMake, as the clang.xcodeproj is never up-to-date and cannot actually build Clang.
Bob Wilson [Mon, 15 Aug 2011 19:13:06 +0000 (19:13 +0000)]
Make -findirect-virtual-calls and -fterminated-vtables aliases of -fapple-kext.
Outside the driver, they were already treated that way, but the driver was not
giving them the same special treatment as -fapple-kext, e.g., falling back to
llvm-gcc for i386/Darwin kexts. Radar 9868422.
Douglas Gregor [Mon, 15 Aug 2011 13:59:46 +0000 (13:59 +0000)]
Teach reference initialization from the result of a user-defined
conversion to initialize the standard conversion *after* the
user-defined conversion properly. Fixes PR10644.
Francois Pichet [Sun, 14 Aug 2011 03:52:19 +0000 (03:52 +0000)]
Implement function template specialization at class scope extension in Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization.
Example:
template <class T>
class A {
public:
template <class U> void f(U p) { }
template <> void f(int p) { } // <== class scope specialization
};
This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code.
BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error.
Bob Wilson [Sat, 13 Aug 2011 23:48:55 +0000 (23:48 +0000)]
Reject -mkernel for i386/Darwin C++ code; fall back to llvm-gcc instead.
Since -mkernel implies -fapple-kext, this just extends the current behavior
for -fapple-kext to apply for -mkernel as well. Radar 9933387.
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.