Allow attributes 'objc_ownership_retain' and 'objc_ownership_release' to be
applied to ObjCMethodDecls, not just parameters. This allows one to specific
side-effects on the receiver of a message expression. No checker support yet.
Hook up Sema support for attributes on Objective-C method declarations that
appear between the return type and the selector. This is a separate code path
from regular attribute processing, as we only want to (a) accept only a specific
set of attributes in this place and (b) want to distinguish to clients the
context in which an attribute was added to an ObjCMethodDecl.
Currently, the attribute 'objc_ownership_returns' is the only attribute that
uses this new feature. Shortly I will add a warning for 'objc_ownership_returns'
to be placed at the end of a method declaration.
Douglas Gregor [Thu, 30 Apr 2009 17:32:17 +0000 (17:32 +0000)]
Properly compute the alignment of typedefs that make use of the
"aligned" attribute. Previously, we were skipping over these
attributes when we jumped directly to the canonical type. Now,
ASTContext::getTypeInfo walks through typedefs and other
"non-canonical" types manually, looking for "aligned" attributes on
typedefs.
As part of this change, I moved the GNU-specific logic (such as
determining the alignment of void or of a function pointer) out of the
expression evaluator and into ASTContext::getTypeInfo.
Chris Lattner [Thu, 30 Apr 2009 02:55:13 +0000 (02:55 +0000)]
int128_t is apparently 128-bit aligned on all 64-bit targets, and
not supported on 32-bit targets, so we can define it to be 128-bit
aligned there too :)
Chris Lattner [Thu, 30 Apr 2009 02:43:43 +0000 (02:43 +0000)]
initial support for __[u]int128_t, which should be basically
compatible with VC++ and GCC. The codegen/mangling angle hasn't
been fully ironed out yet. Note that we accept int128_t even in
32-bit mode, unlike gcc.
retain/release checker: When determining whether an analyzed method can return
an owned object, consult its summary instead of inspecting the selector. This
picks up annotations, and is just more general.
Douglas Gregor [Wed, 29 Apr 2009 22:16:16 +0000 (22:16 +0000)]
Implement semantic analysis for transparent unions. This is largely
based on a patch from Anders Johnsen. CodeGen support is incomplete,
in that we do not properly coerce to the first field's type.
BugReporter/PathDiagnostics:
- Add an (optional) short description for BugReports for clients that want
to distinguish between long and short descriptions for bugs
- Make the bug report for VLA less obscene for Plist diagnostics by using
the short description
Mike Stump [Wed, 29 Apr 2009 21:40:37 +0000 (21:40 +0000)]
Fixup Sema and CodeGen for block literal attributes when the return
type and argument types are missing, and let return type deduction
happen before we give errors for returning from a noreturn block.
Radar 6441502
retain/release checker: Hoist code for bug reports above transfer function logic
(those diffs are just code moving) and move the logic for "return of owned
object" leak reporting to EvalReturnStmt.
Eli Friedman [Wed, 29 Apr 2009 17:56:47 +0000 (17:56 +0000)]
PR4103: improve source location information for members of the current
class. This isn't perfect, but it's a big improvement over not having
any location information.
Add corner case logic to BasicStoreManager and GRSimpleVals::EvalBinOp to enable
reasoning about OSCompareAndSwap32Barrier/OSCompareAndSwap64Barrier. Essentially
the address of reference to a region (pointer-to-pointer) can be casted to
(int32_t*), and we need to handle the logic to convert the involved locations
back and forth from nonloc::LocAsInteger, nonloc::ConcreteInt, to Loc and
loc::ConcreteInt respectively. This adds some potentially suspect logic to
BasicStoreManager that allows the analyzer to reason about abuses of the C type
system. This should probably be refined, be ported over to RegionStoreManager,
and extended with "path-sensitive type checking" to flag bugs in clearly
incoherent code.
Chris Lattner [Wed, 29 Apr 2009 05:12:23 +0000 (05:12 +0000)]
Fix PR4092 by improving error recovery in two ways:
1. In a struct field redefinition, don't mark the struct erroneous. The
field is erroneous, but the struct is otherwise well formed.
2. Don't emit diagnostics about functions that are known to be broken already.
Either fix is sufficient to silence the second diagnostic in the example,
but the combination is better :)
Chris Lattner [Wed, 29 Apr 2009 04:16:52 +0000 (04:16 +0000)]
-Wformat should depend on format-extra-args so that -Wformat implies
the extra argument warnings, and -Wformat -Wno-format-extra-args
turns on -Wformat but not the extra-args warnings.
Chris Lattner [Wed, 29 Apr 2009 04:15:07 +0000 (04:15 +0000)]
tweak warning options to be more like gcc:
1. All all variants of -Wformat*, make them imply -Wformat. GCC warns
if you use -Wformatfoo without -Wformat. We just make one imply the
other.
2. Make -Wformat-nonliteral default to off, like gcc. It is an incredible
nuisance.
3. Accept but currently ignore -Wformat-extra-args.
Daniel Dunbar [Wed, 29 Apr 2009 01:00:32 +0000 (01:00 +0000)]
Add incredibly bare bones docs/tools.
- Mirroring LLVM's docs/CommandGuide, a place to put .pod files which
are used to generate man/html/etc documentation for tools provided
as part of clang.
retain/release checker: Refactor the guts of getClassMethodSummary to not depend
on ObjCMessageExpr. This will enable us to use it elsewhere. This should not
change any functionality.
Chris Lattner [Tue, 28 Apr 2009 22:33:16 +0000 (22:33 +0000)]
In -fdiagnostics-print-source-range-info mode, print a space before the
lines that clang extracts from the source code so that machine parsing can
easily ignore them.
Douglas Gregor [Tue, 28 Apr 2009 21:18:29 +0000 (21:18 +0000)]
Implement a minor space optimization for the PCH identifier table,
which eliminates the storage for IdentifierInfo in the "uninteresting
identifier" cases. Sadly, this only brought back 7k of the 500k we
lost :(
Douglas Gregor [Tue, 28 Apr 2009 20:33:11 +0000 (20:33 +0000)]
Implement checking for macro definitions that occur on the command
line when using a PCH that were not provided when building the PCH
file. If those names were used as identifiers somewhere in the PCH
file, reject the PCH file.
Douglas Gregor [Tue, 28 Apr 2009 20:01:51 +0000 (20:01 +0000)]
Revert r70075 and r70078, which reorganized the PCH on-disk hash table
for identifiers to separate "interesting" from "uninteresting"
identifiers. However, to cope with compiler invocations where the
predefines buffers mismatch, we need to be able to search the complete
identifier table. Cocoa.h.pch is now about 500k larger that it used to
be :(
Daniel Dunbar [Tue, 28 Apr 2009 19:38:45 +0000 (19:38 +0000)]
With -ccc-pch-is-pch, always treat precompiled inputs as PCH,
regardless of extension.
- Otherwise we can't expect that just plugging in -ccc-pch-is-pch
will work.
Douglas Gregor [Tue, 28 Apr 2009 18:58:38 +0000 (18:58 +0000)]
Allow some differences between the predefines buffer used to build a
PCH file and the predefines buffer used when including the PCH
file. We (explicitly) detect conflicting macro definitions (rejecting
the PCH file) and about missing macro definitions (they'll be
automatically pulled from the PCH file anyway).
We're missing some checking to make sure that new macro definitions
won't have any impact on the PCH file itself (e.g., #define'ing an
identifier that the PCH file used).
ccc-analyzer: Don't automatically generate 'Parser Rejects' files anymore. The
frontend is far enough along that most discrepancies between Clang and GCC are
(at least for C and Objective-C) are intentional. We also now have codegen to
test the frontend.
Douglas Gregor [Tue, 28 Apr 2009 06:37:30 +0000 (06:37 +0000)]
Improve compatibility with GCC regarding inline semantics in GNU89
mode and in the presence of __gnu_inline__ attributes. This should fix
both PR3989 and PR4069.
As part of this, we now keep track of all of the attributes attached
to each declaration even after we've performed declaration
merging. This fixes PR3264.