Commit Graph

12658 Commits

Author SHA1 Message Date
Bill Wendling 50e41a4d86 Remove two unused options.
llvm-svn: 70457
2009-04-30 00:55:13 +00:00
Mike Stump e9efa80c00 Sema checking for incorrect placement of __block. Radar 6441502
llvm-svn: 70452
2009-04-30 00:19:40 +00:00
Bill Wendling 29405d836b Use the new code gen optimization enum instead of passing in the optimization
level. This is more expressive.

llvm-svn: 70451
2009-04-29 23:53:23 +00:00
Douglas Gregor d1a602c628 Make DISABLE_SMART_POINTERS work, again
llvm-svn: 70443
2009-04-29 23:37:31 +00:00
Fariborz Jahanian 334df667a3 Change to warning when property uses an ivar in super class
in an @synthesize diective, as it breaks few projects.

llvm-svn: 70441
2009-04-29 23:31:56 +00:00
Anders Carlsson 118b098cd9 Just because a declaration has the same name as its containing class doesn't mean that it's a constructor. Fixes rdar://problem/6815988.
llvm-svn: 70436
2009-04-29 23:19:39 +00:00
Douglas Gregor e5f93b1e58 Revert r70424. We don't need it
llvm-svn: 70432
2009-04-29 23:06:13 +00:00
Ted Kremenek 223a7d5445 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.

llvm-svn: 70429
2009-04-29 23:03:22 +00:00
Douglas Gregor 424ac21318 Add PCH version to the -v output
llvm-svn: 70424
2009-04-29 22:47:43 +00:00
Fariborz Jahanian 4b4ef86369 Undid setting of the flag for msg_Send for 32bit code gen.
It seems to effect code gen. Add a FIXME instead.

llvm-svn: 70423
2009-04-29 22:47:27 +00:00
Ted Kremenek d6bef2edab Format cleanup. No functionality change.
llvm-svn: 70420
2009-04-29 22:25:52 +00:00
Douglas Gregor 0cfbdab0cf 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.

llvm-svn: 70419
2009-04-29 22:16:16 +00:00
Mike Stump a74841e22c Remove extra line.
llvm-svn: 70418
2009-04-29 22:11:32 +00:00
Ted Kremenek 9f08b842e1 Fix null dereference.
llvm-svn: 70417
2009-04-29 22:05:03 +00:00
Ted Kremenek 47187c6ad2 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

llvm-svn: 70415
2009-04-29 21:58:13 +00:00
Fariborz Jahanian bff0167a0b use of an ivar specified on a property @synthesize
and found in super class triggers a diagnostics.

llvm-svn: 70414
2009-04-29 21:45:02 +00:00
Mike Stump 56ed2eab9e 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

llvm-svn: 70413
2009-04-29 21:40:37 +00:00
Ted Kremenek 53cce5c195 Reformat long line. No functionality change.
llvm-svn: 70412
2009-04-29 21:31:59 +00:00
Evan Cheng a97709b66f Match addPassesToEmitFile API change.
llvm-svn: 70409
2009-04-29 21:02:33 +00:00
Fariborz Jahanian e55f8660be Export lazy references of .objc_class_name of class names
referenced in a category implementation meta-data
(Next objc 32bit abi).

llvm-svn: 70407
2009-04-29 20:40:05 +00:00
Eli Friedman 8b171f6516 Minor simplification; also silences gcc warning.
llvm-svn: 70406
2009-04-29 20:29:43 +00:00
Fariborz Jahanian e27b929809 Type of msgSend message dispatch API is a vararg.
llvm-svn: 70404
2009-04-29 19:14:43 +00:00
Mike Stump 88788feddd Sema and CodeGen support for attributes on blocks. Radar 6441502
llvm-svn: 70403
2009-04-29 19:03:13 +00:00
Ted Kremenek 6bd78709f2 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.

llvm-svn: 70399
2009-04-29 18:50:19 +00:00
Daniel Dunbar 44e7122151 Make sure to pass the same options to the static analyzer as the
compiler.
 - Code generation options may still affect the language...

llvm-svn: 70393
2009-04-29 18:32:25 +00:00
Chris Lattner 156ed6c015 accept and ignore two new warning options. PR410[45]
llvm-svn: 70392
2009-04-29 18:15:38 +00:00
Eli Friedman ba94471e6e 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.

llvm-svn: 70390
2009-04-29 17:56:47 +00:00
Sebastian Redl 2b9cacbffa Have the parser communicate the exception specification to the action.
llvm-svn: 70389
2009-04-29 17:30:04 +00:00
Ted Kremenek 99fe1695c7 Add version of getMethodSummary() that can be used to query the summary for the
method currently being analyzed.

llvm-svn: 70388
2009-04-29 17:17:48 +00:00
Ted Kremenek 387243067a Rename getMethodSummary() -> getInstanceMethodSummary().
llvm-svn: 70387
2009-04-29 17:09:14 +00:00
Steve Naroff d98037132f Integrate 3 months of ObjC rewriter fixes (from the Apple/objective-rewrite branch).
llvm-svn: 70385
2009-04-29 16:37:50 +00:00
Eli Friedman debdc1d732 PR4103: Silence bogus unused expression warning.
llvm-svn: 70384
2009-04-29 16:35:53 +00:00
Ted Kremenek bcf597d2e5 Add test case for transfer function logic for OSCompareAndSwap32Barrier.
llvm-svn: 70383
2009-04-29 16:03:59 +00:00
Ted Kremenek 3941d22a98 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.

llvm-svn: 70382
2009-04-29 16:03:27 +00:00
Ted Kremenek e034868a36 MemRegion pretty-printing: Convert DeclName to a string to print out the actual
name of the tracked function.

llvm-svn: 70381
2009-04-29 15:37:24 +00:00
Zhongxing Xu f985648e83 SymbolicRegions may also be live roots.
llvm-svn: 70380
2009-04-29 09:24:35 +00:00
Zhongxing Xu 12233fd97e Added comments to test case.
llvm-svn: 70374
2009-04-29 05:59:48 +00:00
Chris Lattner 11a827471e fix PR4021, array and functions decay in the receiver position of an objc message send.
llvm-svn: 70373
2009-04-29 05:48:32 +00:00
Chris Lattner 0f94c5a741 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 :)

llvm-svn: 70371
2009-04-29 05:12:23 +00:00
Ted Kremenek 0b50fb1de1 retain/release checker: Refactor getMethodSummary() to not depend on ObjCMessageExpr.
llvm-svn: 70369
2009-04-29 05:04:30 +00:00
Chris Lattner cc5d1c2e4e implement -Wformat-security properly, which is enabled by default.
This enables one specific class of non-literal format warnings.

llvm-svn: 70368
2009-04-29 04:59:47 +00:00
Chris Lattner e009a881ea code simplification, no functionality change.
llvm-svn: 70367
2009-04-29 04:49:34 +00:00
Chris Lattner e525dc3c66 add a bunch of individual warnings to -Wformat (which is
on by default).

llvm-svn: 70365
2009-04-29 04:41:16 +00:00
Chris Lattner fd4a4d1f8a Wire up -Wformat=2 and -Wformat-extra-args
llvm-svn: 70364
2009-04-29 04:31:58 +00:00
Chris Lattner 83a3235a3e -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.

llvm-svn: 70363
2009-04-29 04:16:52 +00:00
Chris Lattner 941153afcd 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.

llvm-svn: 70362
2009-04-29 04:15:07 +00:00
Chris Lattner e3fa5aa91c minor code cleanup
llvm-svn: 70361
2009-04-29 04:12:34 +00:00
Zhongxing Xu 892a5f78eb Update test case.
llvm-svn: 70359
2009-04-29 02:37:26 +00:00
Zhongxing Xu 3ee3044bd7 As discussed with Ted offline, re-apply r70293.
llvm-svn: 70358
2009-04-29 02:30:09 +00:00
Zhongxing Xu c14f097f58 XFAIL the test case.
llvm-svn: 70356
2009-04-29 01:50:12 +00:00
Daniel Dunbar c1b1658751 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.

llvm-svn: 70355
2009-04-29 01:00:32 +00:00
Mike Stump d00bc1a275 Implement sema checking for noreturn.
llvm-svn: 70353
2009-04-29 00:43:21 +00:00
Ted Kremenek 7686ffaf07 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.

llvm-svn: 70352
2009-04-29 00:42:39 +00:00
Ted Kremenek ebc6d91f4e Add regression test case provided by <rdar://problem/6833332>.
llvm-svn: 70350
2009-04-29 00:41:31 +00:00
Douglas Gregor 272842aa1c Enable PCH by default
llvm-svn: 70339
2009-04-28 22:44:02 +00:00
Douglas Gregor c1547eb338 Force driver's PTH test to use PTH
llvm-svn: 70338
2009-04-28 22:43:20 +00:00
Chris Lattner af6094eafc 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.

llvm-svn: 70337
2009-04-28 22:33:16 +00:00
Ted Kremenek 869292d5b6 Implement ownership attribute 'objc_ownership_make_collectable'. This allows one
to add 'CFMakeCollectable' semantics to a method.

llvm-svn: 70336
2009-04-28 22:32:26 +00:00
Chris Lattner 865efd72b3 add support for -Wendif-labels, PR4101
llvm-svn: 70335
2009-04-28 22:19:16 +00:00
Douglas Gregor ce1a9c5a6b Make all PCH-incompatibility warnings into errors, and abort
compilation if the user requested a PCH file but no such PCH file
exists.

llvm-svn: 70332
2009-04-28 22:01:16 +00:00
Douglas Gregor 6f00bf8ceb Make the PCH reader use the diagnostics system for its complaints.
llvm-svn: 70330
2009-04-28 21:53:25 +00:00
Chris Lattner 8577f62622 Implement -Wfour-char-constants, which is an extension, not an extwarn,
and apparently not part of -Wall

llvm-svn: 70329
2009-04-28 21:51:46 +00:00
Ted Kremenek 89c3861061 Improve retain/release test cases for ownership attributes.
llvm-svn: 70327
2009-04-28 21:43:40 +00:00
Douglas Gregor b925652433 Optimize IdentifierInfo storage within the precompiled header. We've
now gotten back about 180k of the 500k we lost.

llvm-svn: 70326
2009-04-28 21:32:13 +00:00
Douglas Gregor 1d583f2838 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 :(

llvm-svn: 70325
2009-04-28 21:18:29 +00:00
Douglas Gregor cd07dd168d Fix a typo noticed by Gabor
llvm-svn: 70323
2009-04-28 21:06:13 +00:00
Douglas Gregor 1a949368e4 Replace a lame fprintf with a slightly-less lame diagnostic
llvm-svn: 70322
2009-04-28 20:36:16 +00:00
Douglas Gregor e6648fb79e 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.

llvm-svn: 70321
2009-04-28 20:33:11 +00:00
Douglas Gregor ab4df58193 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 :(

llvm-svn: 70320
2009-04-28 20:01:51 +00:00
Daniel Dunbar fb83baaf76 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.

llvm-svn: 70318
2009-04-28 19:38:45 +00:00
Eli Friedman a38da57cd6 PR4097: add logic to Evaluate to handle pointer equality comparisons.
llvm-svn: 70317
2009-04-28 19:17:36 +00:00
Douglas Gregor c379c07240 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).

llvm-svn: 70316
2009-04-28 18:58:38 +00:00
Chris Lattner 74c95e20af implement -Wmultichar
llvm-svn: 70315
2009-04-28 18:52:02 +00:00
Eli Friedman 5406f5430b Add some text to the user manual describing the current state of C
support in clang.

llvm-svn: 70314
2009-04-28 18:48:34 +00:00
Ted Kremenek ea62bf4e58 Revert 70293.
llvm-svn: 70313
2009-04-28 18:48:13 +00:00
Chris Lattner 0cd56890ef merge number.c into constants.c and start running it in -verify mode.
llvm-svn: 70310
2009-04-28 18:43:12 +00:00
Eli Friedman 4058a842e6 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.)

llvm-svn: 70307
2009-04-28 17:59:09 +00:00
Eli Friedman 9f1d66419d Fix additional issues pointed out in PR4088.
llvm-svn: 70305
2009-04-28 17:48:05 +00:00
Ted Kremenek ce6b865c21 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.

llvm-svn: 70303
2009-04-28 17:37:44 +00:00
Ted Kremenek ed70968484 Update analyzer build.
llvm-svn: 70295
2009-04-28 14:32:50 +00:00
Zhongxing Xu 3c3fee0fb8 Add test case.
llvm-svn: 70294
2009-04-28 13:52:13 +00:00
Zhongxing Xu 6e304e6323 Now we can remove the 'blast-through' code.
llvm-svn: 70293
2009-04-28 13:49:42 +00:00
Douglas Gregor 76fe50c654 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.

llvm-svn: 70292
2009-04-28 06:37:30 +00:00
Ted Kremenek 9bea0dc178 Extensive diagnostics: Do not add a location context for do...while statements.
llvm-svn: 70286
2009-04-28 04:28:12 +00:00
Ted Kremenek 61114bc558 BugReporter (extensive diagnostics): Clean up do...while control-flow edges, and
add "Looping back to the head of the loop" diagnostic for loops.

llvm-svn: 70285
2009-04-28 04:23:15 +00:00
Ted Kremenek cb37bb0f20 CFG: Add "loop back" block for do...while statements.
llvm-svn: 70284
2009-04-28 04:22:00 +00:00
Eli Friedman 6bba2adc95 Emit keyword extension warning in all modes, not just C99 mode.
llvm-svn: 70283
2009-04-28 03:59:15 +00:00
Eli Friedman 6131bfbf77 Remove unused LangOptions NoExtensions and Boolean.
llvm-svn: 70282
2009-04-28 03:28:55 +00:00
Eli Friedman 2b680b43e9 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.

llvm-svn: 70281
2009-04-28 03:13:54 +00:00
Ted Kremenek 49936f76ec CFG: 'WhileStmts' needs an extra block to indicate the "loop back" path.
llvm-svn: 70280
2009-04-28 03:09:44 +00:00
Mike Stump 6ea352a750 We avoid the count of diagnostics when not generating carent
diagnostics to improve gcc compatibility; useful for dejagnu testing.

llvm-svn: 70278
2009-04-28 01:19:10 +00:00
Mike Stump d456c48568 Don't allow blocks to be declared as returning an array. Radar 6441502
llvm-svn: 70277
2009-04-28 01:10:27 +00:00
Ted Kremenek 902393b4b7 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.

llvm-svn: 70274
2009-04-28 00:51:56 +00:00
Eli Friedman 5d72d41189 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.

llvm-svn: 70273
2009-04-28 00:51:18 +00:00
Eli Friedman f66a2e12a4 A couple more small changes which are probably required for Cygwin
builds to work (PR4088).

llvm-svn: 70269
2009-04-27 23:43:36 +00:00
Eli Friedman a90db0acd0 Attempt to fix reported build error on Cygwin, PR4088.
llvm-svn: 70268
2009-04-27 23:36:17 +00:00
Devang Patel df348f10b6 While generating debug info ignore unnamed fields.
llvm-svn: 70266
2009-04-27 22:40:36 +00:00
Douglas Gregor 7b71e63120 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.

llvm-svn: 70264
2009-04-27 22:23:34 +00:00
Chris Lattner 1d72888cfc fix test/PCH/method_pool.m
llvm-svn: 70263
2009-04-27 22:17:41 +00:00
Chris Lattner 8804f40321 -E, -Eonly and -parse-noop now work with PCH!
llvm-svn: 70259
2009-04-27 22:02:30 +00:00