]> granicus.if.org Git - clang/log
clang
15 years agoPR4103: improve source location information for members of the current
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70390 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoHave the parser communicate the exception specification to the action.
Sebastian Redl [Wed, 29 Apr 2009 17:30:04 +0000 (17:30 +0000)]
Have the parser communicate the exception specification to the action.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70389 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd version of getMethodSummary() that can be used to query the summary for the
Ted Kremenek [Wed, 29 Apr 2009 17:17:48 +0000 (17:17 +0000)]
Add version of getMethodSummary() that can be used to query the summary for the
method currently being analyzed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70388 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRename getMethodSummary() -> getInstanceMethodSummary().
Ted Kremenek [Wed, 29 Apr 2009 17:09:14 +0000 (17:09 +0000)]
Rename getMethodSummary() -> getInstanceMethodSummary().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70387 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIntegrate 3 months of ObjC rewriter fixes (from the Apple/objective-rewrite branch).
Steve Naroff [Wed, 29 Apr 2009 16:37:50 +0000 (16:37 +0000)]
Integrate 3 months of ObjC rewriter fixes (from the Apple/objective-rewrite branch).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70385 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPR4103: Silence bogus unused expression warning.
Eli Friedman [Wed, 29 Apr 2009 16:35:53 +0000 (16:35 +0000)]
PR4103: Silence bogus unused expression warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70384 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd test case for transfer function logic for OSCompareAndSwap32Barrier.
Ted Kremenek [Wed, 29 Apr 2009 16:03:59 +0000 (16:03 +0000)]
Add test case for transfer function logic for OSCompareAndSwap32Barrier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70383 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd corner case logic to BasicStoreManager and GRSimpleVals::EvalBinOp to enable
Ted Kremenek [Wed, 29 Apr 2009 16:03:27 +0000 (16:03 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70382 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMemRegion pretty-printing: Convert DeclName to a string to print out the actual
Ted Kremenek [Wed, 29 Apr 2009 15:37:24 +0000 (15:37 +0000)]
MemRegion pretty-printing: Convert DeclName to a string to print out the actual
name of the tracked function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70381 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSymbolicRegions may also be live roots.
Zhongxing Xu [Wed, 29 Apr 2009 09:24:35 +0000 (09:24 +0000)]
SymbolicRegions may also be live roots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70380 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdded comments to test case.
Zhongxing Xu [Wed, 29 Apr 2009 05:59:48 +0000 (05:59 +0000)]
Added comments to test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70374 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix PR4021, array and functions decay in the receiver position of an objc message...
Chris Lattner [Wed, 29 Apr 2009 05:48:32 +0000 (05:48 +0000)]
fix PR4021, array and functions decay in the receiver position of an objc message send.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70373 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix PR4092 by improving error recovery in two ways:
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 :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70371 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoretain/release checker: Refactor getMethodSummary() to not depend on ObjCMessageExpr.
Ted Kremenek [Wed, 29 Apr 2009 05:04:30 +0000 (05:04 +0000)]
retain/release checker: Refactor getMethodSummary() to not depend on ObjCMessageExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70369 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimplement -Wformat-security properly, which is enabled by default.
Chris Lattner [Wed, 29 Apr 2009 04:59:47 +0000 (04:59 +0000)]
implement -Wformat-security properly, which is enabled by default.
This enables one specific class of non-literal format warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70368 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agocode simplification, no functionality change.
Chris Lattner [Wed, 29 Apr 2009 04:49:34 +0000 (04:49 +0000)]
code simplification, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70367 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd a bunch of individual warnings to -Wformat (which is
Chris Lattner [Wed, 29 Apr 2009 04:41:16 +0000 (04:41 +0000)]
add a bunch of individual warnings to -Wformat (which is
on by default).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70365 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWire up -Wformat=2 and -Wformat-extra-args
Chris Lattner [Wed, 29 Apr 2009 04:31:58 +0000 (04:31 +0000)]
Wire up -Wformat=2 and -Wformat-extra-args

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70364 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago-Wformat should depend on format-extra-args so that -Wformat implies
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70363 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agotweak warning options to be more like gcc:
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70362 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agominor code cleanup
Chris Lattner [Wed, 29 Apr 2009 04:12:34 +0000 (04:12 +0000)]
minor code cleanup

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70361 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUpdate test case.
Zhongxing Xu [Wed, 29 Apr 2009 02:37:26 +0000 (02:37 +0000)]
Update test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70359 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAs discussed with Ted offline, re-apply r70293.
Zhongxing Xu [Wed, 29 Apr 2009 02:30:09 +0000 (02:30 +0000)]
As discussed with Ted offline, re-apply r70293.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70358 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoXFAIL the test case.
Zhongxing Xu [Wed, 29 Apr 2009 01:50:12 +0000 (01:50 +0000)]
XFAIL the test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70356 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd incredibly bare bones docs/tools.
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70355 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement sema checking for noreturn.
Mike Stump [Wed, 29 Apr 2009 00:43:21 +0000 (00:43 +0000)]
Implement sema checking for noreturn.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70353 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoretain/release checker: Refactor the guts of getClassMethodSummary to not depend
Ted Kremenek [Wed, 29 Apr 2009 00:42:39 +0000 (00:42 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70352 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd regression test case provided by <rdar://problem/6833332>.
Ted Kremenek [Wed, 29 Apr 2009 00:41:31 +0000 (00:41 +0000)]
Add regression test case provided by <rdar://problem/6833332>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70350 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoEnable PCH by default
Douglas Gregor [Tue, 28 Apr 2009 22:44:02 +0000 (22:44 +0000)]
Enable PCH by default

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70339 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoForce driver's PTH test to use PTH
Douglas Gregor [Tue, 28 Apr 2009 22:43:20 +0000 (22:43 +0000)]
Force driver's PTH test to use PTH

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70338 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIn -fdiagnostics-print-source-range-info mode, print a space before the
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70337 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement ownership attribute 'objc_ownership_make_collectable'. This allows one
Ted Kremenek [Tue, 28 Apr 2009 22:32:26 +0000 (22:32 +0000)]
Implement ownership attribute 'objc_ownership_make_collectable'. This allows one
to add 'CFMakeCollectable' semantics to a method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70336 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd support for -Wendif-labels, PR4101
Chris Lattner [Tue, 28 Apr 2009 22:19:16 +0000 (22:19 +0000)]
add support for -Wendif-labels, PR4101

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70335 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake all PCH-incompatibility warnings into errors, and abort
Douglas Gregor [Tue, 28 Apr 2009 22:01:16 +0000 (22:01 +0000)]
Make all PCH-incompatibility warnings into errors, and abort
compilation if the user requested a PCH file but no such PCH file
exists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70332 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake the PCH reader use the diagnostics system for its complaints.
Douglas Gregor [Tue, 28 Apr 2009 21:53:25 +0000 (21:53 +0000)]
Make the PCH reader use the diagnostics system for its complaints.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70330 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement -Wfour-char-constants, which is an extension, not an extwarn,
Chris Lattner [Tue, 28 Apr 2009 21:51:46 +0000 (21:51 +0000)]
Implement -Wfour-char-constants, which is an extension, not an extwarn,
and apparently not part of -Wall

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70329 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImprove retain/release test cases for ownership attributes.
Ted Kremenek [Tue, 28 Apr 2009 21:43:40 +0000 (21:43 +0000)]
Improve retain/release test cases for ownership attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70327 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoOptimize IdentifierInfo storage within the precompiled header. We've
Douglas Gregor [Tue, 28 Apr 2009 21:32:13 +0000 (21:32 +0000)]
Optimize IdentifierInfo storage within the precompiled header. We've
now gotten back about 180k of the 500k we lost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70326 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement a minor space optimization for the PCH identifier table,
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 :(

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70325 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix a typo noticed by Gabor
Douglas Gregor [Tue, 28 Apr 2009 21:06:13 +0000 (21:06 +0000)]
Fix a typo noticed by Gabor

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70323 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoReplace a lame fprintf with a slightly-less lame diagnostic
Douglas Gregor [Tue, 28 Apr 2009 20:36:16 +0000 (20:36 +0000)]
Replace a lame fprintf with a slightly-less lame diagnostic

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70322 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement checking for macro definitions that occur on the command
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70321 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRevert r70075 and r70078, which reorganized the PCH on-disk hash table
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 :(

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70320 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWith -ccc-pch-is-pch, always treat precompiled inputs as PCH,
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70318 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPR4097: add logic to Evaluate to handle pointer equality comparisons.
Eli Friedman [Tue, 28 Apr 2009 19:17:36 +0000 (19:17 +0000)]
PR4097: add logic to Evaluate to handle pointer equality comparisons.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70317 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAllow some differences between the predefines buffer used to build a
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70316 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimplement -Wmultichar
Chris Lattner [Tue, 28 Apr 2009 18:52:02 +0000 (18:52 +0000)]
implement -Wmultichar

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70315 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd some text to the user manual describing the current state of C
Eli Friedman [Tue, 28 Apr 2009 18:48:34 +0000 (18:48 +0000)]
Add some text to the user manual describing the current state of C
support in clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70314 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRevert 70293.
Ted Kremenek [Tue, 28 Apr 2009 18:48:13 +0000 (18:48 +0000)]
Revert 70293.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70313 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomerge number.c into constants.c and start running it in -verify mode.
Chris Lattner [Tue, 28 Apr 2009 18:43:12 +0000 (18:43 +0000)]
merge number.c into constants.c and start running it in -verify mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70310 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix a minor edge case in C89 mode related to the definition of a
Eli Friedman [Tue, 28 Apr 2009 17:59:09 +0000 (17:59 +0000)]
Fix a minor edge case in C89 mode related to the definition of a
"function designator".

(This causes a minor glitch in the
diagnostics for C++ member pointers, but we weren't printing the
right diagnostic there anyway.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70307 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix additional issues pointed out in PR4088.
Eli Friedman [Tue, 28 Apr 2009 17:48:05 +0000 (17:48 +0000)]
Fix additional issues pointed out in PR4088.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70305 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoccc-analyzer: Don't automatically generate 'Parser Rejects' files anymore. The
Ted Kremenek [Tue, 28 Apr 2009 17:37:44 +0000 (17:37 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70303 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUpdate analyzer build.
Ted Kremenek [Tue, 28 Apr 2009 14:32:50 +0000 (14:32 +0000)]
Update analyzer build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70295 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd test case.
Zhongxing Xu [Tue, 28 Apr 2009 13:52:13 +0000 (13:52 +0000)]
Add test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70294 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoNow we can remove the 'blast-through' code.
Zhongxing Xu [Tue, 28 Apr 2009 13:49:42 +0000 (13:49 +0000)]
Now we can remove the 'blast-through' code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70293 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImprove compatibility with GCC regarding inline semantics in GNU89
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70292 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoExtensive diagnostics: Do not add a location context for do...while statements.
Ted Kremenek [Tue, 28 Apr 2009 04:28:12 +0000 (04:28 +0000)]
Extensive diagnostics: Do not add a location context for do...while statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70286 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoBugReporter (extensive diagnostics): Clean up do...while control-flow edges, and
Ted Kremenek [Tue, 28 Apr 2009 04:23:15 +0000 (04:23 +0000)]
BugReporter (extensive diagnostics): Clean up do...while control-flow edges, and
add "Looping back to the head of the loop" diagnostic for loops.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70285 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCFG: Add "loop back" block for do...while statements.
Ted Kremenek [Tue, 28 Apr 2009 04:22:00 +0000 (04:22 +0000)]
CFG: Add "loop back" block for do...while statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70284 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoEmit keyword extension warning in all modes, not just C99 mode.
Eli Friedman [Tue, 28 Apr 2009 03:59:15 +0000 (03:59 +0000)]
Emit keyword extension warning in all modes, not just C99 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70283 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove unused LangOptions NoExtensions and Boolean.
Eli Friedman [Tue, 28 Apr 2009 03:28:55 +0000 (03:28 +0000)]
Remove unused LangOptions NoExtensions and Boolean.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70282 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSimplify the scheme used for keywords, and change the classification
Eli Friedman [Tue, 28 Apr 2009 03:13:54 +0000 (03:13 +0000)]
Simplify the scheme used for keywords, and change the classification
scheme to be more useful.

The new scheme introduces a set of categories that should be more
readable, and also reflects what we want to consider as an extension
more accurately.  Specifically, it makes the "what is a keyword"
determination accurately reflect whether the keyword is a GNU or
Microsoft extension.

I also introduced separate flags for keyword aliases; this is useful
because the classification of the aliases is mostly unrelated to the
classification of the original keyword.

This patch treats anything that's in the implementation
namespace (prefixed with "__", or "_X" where "X" is any upper-case
letter) as a keyword without marking it as an extension.  This is
consistent with the standards in that an implementation is allowed to define
arbitrary extensions in the implementation namespace without violating
the standard. This gets rid of all the nasty "extension used" warnings
for stuff like __attribute__ in -pedantic mode.  We still warn for
extensions outside of the the implementation namespace, like typeof.
If someone wants to implement -Wextensions or something like that, we
could add additional information to the keyword table.

This also removes processing for the unused "Boolean" language option;
such an extension isn't supported on any other C implementation, so I
don't see any point to adding it.

The changes to test/CodeGen/inline.c are required because previously, we
weren't actually disabling the "inline" keyword in -std=c89 mode.

I'll remove Boolean and NoExtensions from LangOptions in a follow-up
commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70281 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCFG: 'WhileStmts' needs an extra block to indicate the "loop back" path.
Ted Kremenek [Tue, 28 Apr 2009 03:09:44 +0000 (03:09 +0000)]
CFG: 'WhileStmts' needs an extra block to indicate the "loop back" path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70280 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWe avoid the count of diagnostics when not generating carent
Mike Stump [Tue, 28 Apr 2009 01:19:10 +0000 (01:19 +0000)]
We avoid the count of diagnostics when not generating carent
diagnostics to improve gcc compatibility; useful for dejagnu testing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70278 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't allow blocks to be declared as returning an array. Radar 6441502
Mike Stump [Tue, 28 Apr 2009 01:10:27 +0000 (01:10 +0000)]
Don't allow blocks to be declared as returning an array.  Radar 6441502

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70277 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCFG:
Ted Kremenek [Tue, 28 Apr 2009 00:51:56 +0000 (00:51 +0000)]
CFG:
- Add 'LoopTarget' pointer field to CFGBlock. This records if the block is used
  as the 'loop back' path back to the head of a loop.
- For ForStmt, encode the loop back target as the increment code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70274 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoGet rid of some useless uses of NoExtensions. The philosophy here is
Eli Friedman [Tue, 28 Apr 2009 00:51:18 +0000 (00:51 +0000)]
Get rid of some useless uses of NoExtensions.  The philosophy here is
that if we're going to print an extension warning anyway,
there's no point to changing behavior based on NoExtensions: it will
only make error recovery worse.

Note that this doesn't cause any behavior change because NoExtensions
isn't used by the current front-end.  I'm still considering what to do about
the remaining use of NoExtensions in IdentifierTable.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70273 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoA couple more small changes which are probably required for Cygwin
Eli Friedman [Mon, 27 Apr 2009 23:43:36 +0000 (23:43 +0000)]
A couple more small changes which are probably required for Cygwin
builds to work (PR4088).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70269 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAttempt to fix reported build error on Cygwin, PR4088.
Eli Friedman [Mon, 27 Apr 2009 23:36:17 +0000 (23:36 +0000)]
Attempt to fix reported build error on Cygwin, PR4088.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70268 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWhile generating debug info ignore unnamed fields.
Devang Patel [Mon, 27 Apr 2009 22:40:36 +0000 (22:40 +0000)]
While generating debug info ignore unnamed fields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70266 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd a header containing the Clang version; make the driver use this
Douglas Gregor [Mon, 27 Apr 2009 22:23:34 +0000 (22:23 +0000)]
Add a header containing the Clang version; make the driver use this
Clang version value rather than hard-coding "1.0".

Add PCH and Clang version information into the PCH file. Reject PCH
files with the wrong version information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70264 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix test/PCH/method_pool.m
Chris Lattner [Mon, 27 Apr 2009 22:17:41 +0000 (22:17 +0000)]
fix test/PCH/method_pool.m

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70263 91177308-0d34-0410-b5e6-96231b3b80d8

15 years ago-E, -Eonly and -parse-noop now work with PCH!
Chris Lattner [Mon, 27 Apr 2009 22:02:30 +0000 (22:02 +0000)]
-E, -Eonly and -parse-noop now work with PCH!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70259 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTeach PCH that ASTContext is optional. Move -parse-noop and -Eonly (so far)
Chris Lattner [Mon, 27 Apr 2009 21:45:14 +0000 (21:45 +0000)]
Teach PCH that ASTContext is optional.  Move -parse-noop and -Eonly (so far)
processing to after PCH is loaded.  -Eonly and -parse-noop are close to working
with PCH now but are not quite there yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70257 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTrack down return statements in the handlers of a function-try-block of constructors...
Sebastian Redl [Mon, 27 Apr 2009 21:33:24 +0000 (21:33 +0000)]
Track down return statements in the handlers of a function-try-block of constructors. Meh ...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70256 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoBe more careful in our teardown of the PCHReader after deciding to
Douglas Gregor [Mon, 27 Apr 2009 21:28:04 +0000 (21:28 +0000)]
Be more careful in our teardown of the PCHReader after deciding to
ignore a PCH file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70251 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agounnest some code, decoupling fixit rewriting from ast stuff.
Chris Lattner [Mon, 27 Apr 2009 21:25:27 +0000 (21:25 +0000)]
unnest some code, decoupling fixit rewriting from ast stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70250 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd -empty-input-only option, for timing.
Daniel Dunbar [Mon, 27 Apr 2009 21:19:07 +0000 (21:19 +0000)]
Add -empty-input-only option, for timing.
 - Forces input file to be empty to time startup/shutdown costs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70249 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDon't allow catch declarations to name an abstract class
Sebastian Redl [Mon, 27 Apr 2009 21:03:30 +0000 (21:03 +0000)]
Don't allow catch declarations to name an abstract class

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70248 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImprove validation of C++ exception handling: diagnose throwing incomplete types...
Sebastian Redl [Mon, 27 Apr 2009 20:27:31 +0000 (20:27 +0000)]
Improve validation of C++ exception handling: diagnose throwing incomplete types and jumps into protected try-catch scopes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70242 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd Sema::ExtVectorDecls and Sema::ObjCCategoryImpls to the PCH file. Since these...
Douglas Gregor [Mon, 27 Apr 2009 20:06:05 +0000 (20:06 +0000)]
Add Sema::ExtVectorDecls and Sema::ObjCCategoryImpls to the PCH file. Since these vectors are very, very rarely used and, when used in headers, and even when used are relatively small, we load them eagerly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70240 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd two new checker-specific attributes: 'objc_ownership_release' and
Ted Kremenek [Mon, 27 Apr 2009 19:36:56 +0000 (19:36 +0000)]
Add two new checker-specific attributes: 'objc_ownership_release' and
'objc_ownership_cfrelease'. These are the 'release' equivalents of
'objc_ownership_retain' and 'objc_ownership_cfretain' respectively.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70235 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTrack objects in GC mode returned by 'alloc', 'new', etc. methods. These are
Ted Kremenek [Mon, 27 Apr 2009 19:14:45 +0000 (19:14 +0000)]
Track objects in GC mode returned by 'alloc', 'new', etc. methods. These are
treated as "not owned" objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70232 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomake these be unsigned now that they are eagerly created.
Chris Lattner [Mon, 27 Apr 2009 19:03:22 +0000 (19:03 +0000)]
make these be unsigned now that they are eagerly created.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70229 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoshrink SOURCE_LOCATION_OFFSETS to use 4-byte entries instead of 8-byte
Chris Lattner [Mon, 27 Apr 2009 19:01:47 +0000 (19:01 +0000)]
shrink SOURCE_LOCATION_OFFSETS to use 4-byte entries instead of 8-byte
entries, shaving 100K off the PCH file for cocoa.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70228 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix a problem with the RUN line of one of the PCH tests
Douglas Gregor [Mon, 27 Apr 2009 18:49:47 +0000 (18:49 +0000)]
Fix a problem with the RUN line of one of the PCH tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70227 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRefactor HandleObjCOwnershipRetainAttr and HandleObjCOwnershipCFRetainAttr into
Ted Kremenek [Mon, 27 Apr 2009 18:41:18 +0000 (18:41 +0000)]
Refactor HandleObjCOwnershipRetainAttr and HandleObjCOwnershipCFRetainAttr into
HandleObjCOwnershipParmAttr. No functionality change (hopefully).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70224 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement caching of stat() calls for precompiled headers, which is
Douglas Gregor [Mon, 27 Apr 2009 18:38:38 +0000 (18:38 +0000)]
Implement caching of stat() calls for precompiled headers, which is
essentially the same thing we do with pretokenized headers. stat()
caching improves performance of the Cocoa-prefixed "Hello, World" by
45%.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70223 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agox86-32 ABI: Fix crash on return of structure with flexible array
Daniel Dunbar [Mon, 27 Apr 2009 18:31:32 +0000 (18:31 +0000)]
x86-32 ABI: Fix crash on return of structure with flexible array
member.

Also, spell bitfield more consistently as bit-field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70220 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd new checker-specific attribute 'objc_ownership_cfretain'. This is the same
Ted Kremenek [Mon, 27 Apr 2009 18:27:22 +0000 (18:27 +0000)]
Add new checker-specific attribute 'objc_ownership_cfretain'. This is the same
as 'objc_ownership_cfretain' except that the method acts like a CFRetain instead
of a [... retain] (important in GC modes). Checker support is wired up, but
currently only for Objective-C message expressions (not function calls).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70218 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFill in the C++ status table for exceptions
Sebastian Redl [Mon, 27 Apr 2009 18:25:15 +0000 (18:25 +0000)]
Fill in the C++ status table for exceptions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70217 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoencode the type and decl offsets with 32-bits for entry instead
Chris Lattner [Mon, 27 Apr 2009 18:24:17 +0000 (18:24 +0000)]
encode the type and decl offsets with 32-bits for entry instead
of 64 bits.  This cuts 400KB off the PCH file for cocoa (7.1 ->
6.7MB):

Before:

Record Histogram:
  Count    # Bits   % Abv  Record Kind
      1     14296          SOURCE_LOCATION_PRELOADS
      1   1699598  100.00  SOURCE_LOCATION_OFFSETS
      1   1870766  100.00  METHOD_POOL
      1    212988  100.00  SELECTOR_OFFSETS
      1        88          STATISTICS
      1       106          SPECIAL_TYPES
      1  18033788  100.00  IDENTIFIER_TABLE
      1   1806428  100.00  IDENTIFIER_OFFSET
      1       170  100.00  TARGET_TRIPLE
      1       268          LANGUAGE_OPTIONS
      1   5168252  100.00  DECL_OFFSET
      1    952700  100.00  TYPE_OFFSET

After:

Record Histogram:
  Count    # Bits   % Abv  Record Kind
      1     14296          SOURCE_LOCATION_PRELOADS
      1   1699598  100.00  SOURCE_LOCATION_OFFSETS
      1   1870766  100.00  METHOD_POOL
      1    212988  100.00  SELECTOR_OFFSETS
      1        88          STATISTICS
      1       106          SPECIAL_TYPES
      1  18033788  100.00  IDENTIFIER_TABLE
      1   1806428  100.00  IDENTIFIER_OFFSET
      1       170  100.00  TARGET_TRIPLE
      1       268          LANGUAGE_OPTIONS
      1   2584156  100.00  DECL_OFFSET
      1    476380  100.00  TYPE_OFFSET

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70216 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd an abbreviation for common PARM_VAR_DECL. All but 9 of the
Chris Lattner [Mon, 27 Apr 2009 07:35:58 +0000 (07:35 +0000)]
add an abbreviation for common PARM_VAR_DECL.  All but 9 of the
parm var decls in leopard cocoa.h end up using this abbreviation,
which shrinks the bitcode file by about 50K: 7217736->7167120.

Before:
  Block ID #12 (DECLS_BLOCK):
      Num Instances: 1
         Total Size: 2.23595e+07b/2.79494e+06B/698736W
          % of file: 38.7233
      Num SubBlocks: 0
        Num Abbrevs: 0
        Num Records: 139387
      % Abbrev Recs: 0

After:
  Block ID #12 (DECLS_BLOCK):
      Num Instances: 1
         Total Size: 2.02405e+07b/2.53006e+06B/632516W
          % of file: 35.301
      Num SubBlocks: 0
        Num Abbrevs: 1
        Num Records: 139387
      % Abbrev Recs: 19.2902

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70199 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix a couple more places that should be using the DeclCursor instead
Chris Lattner [Mon, 27 Apr 2009 07:35:40 +0000 (07:35 +0000)]
fix a couple more places that should be using the DeclCursor instead
of the normal stream cursor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70198 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoLoad most of the source manager's information lazily from the PCH
Douglas Gregor [Mon, 27 Apr 2009 06:38:32 +0000 (06:38 +0000)]
Load most of the source manager's information lazily from the PCH
file. In particular, only eagerly load source location entries for
files and for the predefines buffer. Other buffers and
macro-instantiation source location entries are loaded lazily.

With the Cocoa-prefixed "Hello, World", we only load 815/26555 source
location entities. This halves the amount of user time we spend in
this "Hello, World" program with -fsyntax-only (down to .007s).

This optimization is part 1 of 2 for the source manager. This
eliminates most of the user time in loading a PCH file. We still spend
too much time initialize File structures (especially in the calls to
stat), so we need to either make the loading of source location
entries for files lazy or import the stat cache from the PTH
implementation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70196 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosplit expr/stmt writing out to PCHWriterStmt.cpp
Chris Lattner [Mon, 27 Apr 2009 06:20:01 +0000 (06:20 +0000)]
split expr/stmt writing out to PCHWriterStmt.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70194 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosplit decl writing out to its own PCHWriterDecl.cpp file.
Chris Lattner [Mon, 27 Apr 2009 06:16:06 +0000 (06:16 +0000)]
split decl writing out to its own PCHWriterDecl.cpp file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70193 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agounclone SavedStreamPosition
Chris Lattner [Mon, 27 Apr 2009 06:03:19 +0000 (06:03 +0000)]
unclone SavedStreamPosition

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70192 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomove attribute reading to PCHReaderDecl.cpp, remove some
Chris Lattner [Mon, 27 Apr 2009 06:01:06 +0000 (06:01 +0000)]
move attribute reading to PCHReaderDecl.cpp, remove some
extraneous braces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70191 91177308-0d34-0410-b5e6-96231b3b80d8