Eli Friedman [Sat, 24 Jan 2009 23:09:00 +0000 (23:09 +0000)]
PR3062: statement expressions should be illegal at file scope. I don't
think this has any significant effects at the moment, but it could
matter if we start constant-folding statement expressions like gcc does.
Chris Lattner [Sat, 24 Jan 2009 21:53:27 +0000 (21:53 +0000)]
add initial support for the gcc "alignof(decl) is the alignment of the decl
not the type" semantics. This can definitely be improved, but is better than
what we had.
Ted Kremenek [Sat, 24 Jan 2009 00:55:43 +0000 (00:55 +0000)]
More hacking on static analyzer diagnostics. When emitting summary diagnostics the code paths for diagnostics involving paths or single locations are now unified. This patch also constifies many arguments/methods that are touched by this logic, leading to a nice overall code cleanup.
Ted Kremenek [Fri, 23 Jan 2009 20:52:26 +0000 (20:52 +0000)]
Added clang option '--analyzer-display-progress' to indicate that the analyzer should output 'ANALYZE:' messages to display its progress on a source file.
Ted Kremenek [Fri, 23 Jan 2009 20:28:53 +0000 (20:28 +0000)]
Added virtual method DiagnosticClient::IncludeInDiagnosticCounts(). This is used by Diagnostics to determine if a diagnostic sent to a given DiagnosticClient should be included in the count of diagnostics. The default implementation of this method returns 'true'.
Implemented DiagCollector::IncludeInDiagnosticCounts() to return 'false' so that the batching of diagnostics for use with BugReporter doesn't mess up the count of real diagnostics.
Daniel Dunbar [Fri, 23 Jan 2009 20:08:16 +0000 (20:08 +0000)]
ccc: Finish definition of long argument translations.
- However, these last ones do not actually work; the issue is that
they translate to batches of options and need to be reparsed. For
now we just give an unsupported error on them.
Daniel Dunbar [Fri, 23 Jan 2009 18:51:09 +0000 (18:51 +0000)]
Handle pointer arithmetic on function pointers.
- <rdar://problem/6518844> Clang-generated bitcode crashes LLVM while compiling function pointer addition expression
Chris Lattner [Fri, 23 Jan 2009 18:35:48 +0000 (18:35 +0000)]
This is a follow-up to r62675:
Refactor how the preprocessor changes a token from being an tok::identifier to a
keyword (e.g. tok::kw_for). Instead of doing this in HandleIdentifier, hoist this
common case out into the caller, so that every keyword doesn't have to go through
HandleIdentifier. This drops time in HandleIdentifier from 1.25ms to .62ms, and
speeds up clang -Eonly with PTH by about 1%.
Douglas Gregor [Fri, 23 Jan 2009 16:23:13 +0000 (16:23 +0000)]
Handle any undeclared parameters in a K&R-style function with a
special action, inside function prototype scope. This avoids confusion
when we try to inject these parameters into the scope of the function
body before the function itself has been added to the surrounding
scope. Fixes <rdar://problem/6097326>.
Daniel Dunbar [Fri, 23 Jan 2009 00:54:03 +0000 (00:54 +0000)]
ccc: Add support for several more aliases (--ansi, --assemble,
--assert, --classpath).
- Requires providing some option parameters to over-ride rendering in
order to match gcc. There may be a cleaner way to do this (probably
by introducing a new option type for long JoinedOrSeparate forms).
Daniel Dunbar [Fri, 23 Jan 2009 00:39:52 +0000 (00:39 +0000)]
ccc: Darwin/x86/link: Fix a few incompatibilities with gcc (missed
forwarding -s to linker, and was only taking last arg in some cases
when should have been taking all).
Daniel Dunbar [Fri, 23 Jan 2009 00:14:46 +0000 (00:14 +0000)]
ccc: Add support for "alias" options.
- Unlike groups (which gather distinct but related options), aliases
are for options like '--all-warnings' which are effectively treated
like some other option ('-Wall') both in the driver logic and when
passing to tools.
Ted Kremenek [Thu, 22 Jan 2009 23:56:56 +0000 (23:56 +0000)]
For now, return UnknownVal() in RegionStore::getElementsSize() for AnonTypedRegions. It wasn't really doing the right thing and was crashing on rdar-6442306-1.m. This fix causes all path-sensitive test cases to pass with RegionStore.
Ted Kremenek [Thu, 22 Jan 2009 23:43:57 +0000 (23:43 +0000)]
Add RegionStore support for the implicit object region that 'self' references. This causes tests 'ObjCProperties.m' and 'refcnt_naming.m' to now pass with RegionStore.
Douglas Gregor [Thu, 22 Jan 2009 23:26:18 +0000 (23:26 +0000)]
Reimplement the handling of the "current object" in designator
initializers, so that we are within the appropriate subobject after
we've processed a multi-designator designation. We're matching GCC and
EDG's behavior on all examples I've found thus far.
*Huge* thanks to Eli Friedman for pointing out my fundamental
misunderstanding of "current object" in the C99 spec.
Ted Kremenek [Thu, 22 Jan 2009 20:27:48 +0000 (20:27 +0000)]
Fix RegionStore::getLValueElement() to handle the case when the base region is not an ElementRegion (also do some cleanups of its core logic).
This gets array-struct.c to work with RegionStore.
Ted Kremenek [Thu, 22 Jan 2009 18:53:15 +0000 (18:53 +0000)]
The 'misc-ps.m' test case now passes with RegionStore. One case needed to be split out into 'misc-ps-basic-store.m' and 'misc-ps-region-store.m' because the behavior was different between the two store models (RegionStore flags an additional valid bug).
Ted Kremenek [Thu, 22 Jan 2009 18:51:33 +0000 (18:51 +0000)]
SymbolReaper::isLive(SymbolRef) now always returns true for SymbolRegionRvalues because these represent the symbolic values for parameters/globals upon entry to the function. These values are always ;live' because they represent constraints on the context of how the function was called. This will be useful for both summary generation but is also necessary to get RegionStore's lazy-binding of locations to symbols to work in practice with RemoveDeadBindings.
Ted Kremenek [Thu, 22 Jan 2009 18:23:34 +0000 (18:23 +0000)]
Static analyzer: Remove a bunch of outdated SymbolData objects and
their associated APIs. We no longer need separate SymbolData objects
for fields, variables, etc. Instead, we now associated symbols with
the "rvalue" of a MemRegion (i.e., the value stored at that region).
Now we only have two kinds of SymbolData objects: SymbolRegionRValue
and SymbolConjured.
This cleanup also makes the distinction between a SymbolicRegion and a
symbolic value that is a location much clearer. A SymbolicRegion
represents a chunk of symbolic memory, while a symbolic location is
just a "pointer" with different possible values. Without any specific
knowledge, a symbolic location resolves (i.e., via a dereference) to a
SymbolicRegion. In the future, when we do better alias reasoning, a
symbolic location can become an alias for another location, thus
merging the constraints on the referred SymbolicRegion with the other
region.
Sebastian Redl [Thu, 22 Jan 2009 17:31:11 +0000 (17:31 +0000)]
Add a switch that allows disabling the smart pointers.
Uncomment the define in Ownership.h to disable the smart pointers.
Disabled, the smart pointers no longer contain a pointer
to the action, and no longer have special destruction or
copying semantics. They are, compiler willing, raw
pointers or ActionResult equivalents.
Daniel Dunbar [Thu, 22 Jan 2009 01:55:46 +0000 (01:55 +0000)]
ccc/clang: Mimic llvm-gcc initialization of LLVM backend based on gcc
options (for example, to set relocation model or enable unwind table generation).
Douglas Gregor [Thu, 22 Jan 2009 00:58:24 +0000 (00:58 +0000)]
Initial implementation of semantic analysis and ASTs for C99
designated initializers. This implementation should cover all of the
constraints in C99 6.7.8, including long, complex designations and
computing the size of incomplete array types initialized with a
designated initializer. Please see the new test-case and holler if you
find cases where this doesn't work.
There are still some wrinkles with GNU's anonymous structs and
anonymous unions (it isn't clear how these should work; we'll just
follow GCC's lead) and with designated initializers for the members of a
union. I'll tackle those very soon.
CodeGen is still nonexistent, and there's some leftover code in the
parser's representation of designators that I'll also need to clean up.
Daniel Dunbar [Thu, 22 Jan 2009 00:09:25 +0000 (00:09 +0000)]
Allow creation of "dummy" compile units for debug information.
- Although gross, this is needed currently to ensure that we produce
well formed debug information (to match pace with the assertions
being added to DebugInfo in LLVM).