Commit Graph

7305 Commits

Author SHA1 Message Date
Ted Kremenek
cbdce2e53a Added iterators to nonloc::CompoundSVal.
Added pretty-printing for nonloc::CompoundSVal.

llvm-svn: 58442
2008-10-30 18:01:28 +00:00
Ted Kremenek
0e19c03382 80 col violation.
llvm-svn: 58441
2008-10-30 17:53:23 +00:00
Ted Kremenek
f68bf63611 Use a worklist in GRExprEngine::VisitInitListExpr to process subexpressions.
llvm-svn: 58440
2008-10-30 17:47:32 +00:00
Ted Kremenek
a2ace41aa3 Update #includes since SVals.h no longer includes BasicValueFactory.h.
llvm-svn: 58439
2008-10-30 17:46:51 +00:00
Ted Kremenek
1031bf318c Add iterator/reverse_iterator to InitListExpr for iteration over the subexpressions of an initializer list. This is basically the same as child_iterator except reverse iteration is possible (which will be used by GRExprEngine::VisitInitListExpr).
llvm-svn: 58438
2008-10-30 17:45:53 +00:00
Ted Kremenek
ec9a252a9b CompoundVal now uses an ImmutableList<SVal> to store its set of SVals. This change was motivated by the need to allow state-splitting in GRExprEngine::VisitInitListExpr. As a side-benefit, we no longer need to perform any copies of SVals when creating a CompoundSVal, and the profiling of CompoundSVal is now constant time.
llvm-svn: 58437
2008-10-30 17:44:46 +00:00
Ted Kremenek
1e0d95e17e "missing ivar release" is a performance bug.
llvm-svn: 58436
2008-10-30 17:29:54 +00:00
Ted Kremenek
d26da8cf82 Patch by Nikita Zhuk: test case for fix for false positive reported in PR2978.
llvm-svn: 58432
2008-10-30 15:19:43 +00:00
Ted Kremenek
689ec0eb32 Patch by Nikita Zhuk:
Fix PR 2978 false positive for missing release in -dealloc of an ivar retained via a property and then released by assigning nil to that property:

  http://llvm.org/bugs/show_bug.cgi?id=2978

llvm-svn: 58431
2008-10-30 15:13:43 +00:00
Steve Naroff
44df6a205b Make sure RewriteObjCMethodDecl() does a block pointer rewrite.
llvm-svn: 58430
2008-10-30 14:45:29 +00:00
Douglas Gregor
ffe249f5e5 Fix arithmetic type check
llvm-svn: 58429
2008-10-30 13:47:07 +00:00
Steve Naroff
295570a126 Add a couple fixes for rewriting ivars/methods that use/contain blocks.
Now this:

@interface Test
{
  void (^ivar)(void);
}
- (void)name;
@end

@implementation Test
- (void)name {
  ivar = ^{ printf("hello\n"); }; // ((struct Test_IMPL *)self)->ivar = (void (*)(void))&__name_block_impl_0((void *)__name_block_func_0);
  ivar(); // ((void (*)(struct __block_impl *))((struct __block_impl *)((struct Test_IMPL *)self)->ivar)->FuncPtr)((struct __block_impl *)((struct Test_IMPL *)self)->ivar); 
}

llvm-svn: 58428
2008-10-30 12:09:33 +00:00
Steve Naroff
350b665610 Convert SynthesizeBlockCall() from test->AST based implementation.
llvm-svn: 58427
2008-10-30 10:07:53 +00:00
Zhongxing Xu
610634fe39 Merge the array and struct case. They are essentially the same.
llvm-svn: 58422
2008-10-30 05:35:59 +00:00
Zhongxing Xu
a15cfd4db9 Rename:
- SetSVal(GRState*, Loc, SVal) => BindLoc
 - SetSVal(GRState*, Expr*, SVal) => BindExpr 

llvm-svn: 58421
2008-10-30 05:33:54 +00:00
Zhongxing Xu
9655394b6e Adjust code format.
llvm-svn: 58420
2008-10-30 05:03:28 +00:00
Zhongxing Xu
b281cdda87 Implement VisitInitListExpr(). InitListExpr will have a nonloc::CompoundVal value.
llvm-svn: 58419
2008-10-30 05:02:23 +00:00
Zhongxing Xu
ef5f25a05f Add CompoundVal and CompoundValData for representing the value of InitListExpr.
llvm-svn: 58418
2008-10-30 04:58:00 +00:00
Zhongxing Xu
51ac923ca3 Fix 80-col.
llvm-svn: 58417
2008-10-30 04:53:23 +00:00
Daniel Dunbar
def9076430 Fix specification references link.
llvm-svn: 58412
2008-10-30 00:53:12 +00:00
Ted Kremenek
204ae1f0d9 Mark yy_fatal_error as a panic function.
llvm-svn: 58410
2008-10-30 00:00:57 +00:00
Douglas Gregor
23a1f195bd Improve documentation for Sema::CheckReferenceInit
llvm-svn: 58404
2008-10-29 23:31:03 +00:00
Daniel Dunbar
c475d4224b NeXT: Emit protocol objects lazily.
- That is, the metadata for a protocol is only emitted if that
   protocol is actually used in the translation unit. This is
   important because Objective-C headers frequently contain a large
   number of protocol definitions, only a few of which will be used in
   any given file.

llvm-svn: 58400
2008-10-29 22:36:39 +00:00
Steve Naroff
e25142302e Convert SynthBlockInitExpr() from text->AST based implementation.
llvm-svn: 58396
2008-10-29 21:23:59 +00:00
Sebastian Redl
5c0098271b Remove workaround for reference. No longer necessary.
llvm-svn: 58395
2008-10-29 19:45:21 +00:00
Sebastian Redl
5f74e09f47 Fix missing %s in run string causing hang during tests.
llvm-svn: 58394
2008-10-29 19:29:09 +00:00
Ted Kremenek
82c1cc3d52 Fix crash reported in PR2923 where a function declared using typeof(another_function) would have FunctionDecl::getNumParams() return the number of parameters in the original function type and not the number of parameters in the actual FunctionDecl.
llvm-svn: 58392
2008-10-29 18:41:34 +00:00
Steve Naroff
d8907b7bea Handle block literals at file scope, remove some dead code, etc.
llvm-svn: 58390
2008-10-29 18:15:37 +00:00
Douglas Gregor
2f339f0612 Make the non-reference check in Expr work always
llvm-svn: 58388
2008-10-29 18:00:54 +00:00
Douglas Gregor
cad304ba37 Simplify and correct the check for function redefinitions. This does two things:
- Allows definitions of overloaded functions :)
  - Eliminates extraneous error messages when we have a definition of a 
    function that isn't an overload but doesn't have exactly the same type
    as the original.
  

llvm-svn: 58382
2008-10-29 15:10:40 +00:00
Douglas Gregor
ef30a5ff98 Implement overloading rules for reference binding
llvm-svn: 58381
2008-10-29 14:50:44 +00:00
Steve Naroff
52c65fa169 Make sure internally synthesized block pointer types are converted before pretty printing.
llvm-svn: 58380
2008-10-29 14:49:46 +00:00
Douglas Gregor
9774aa13c7 Temporary disable the const-object-declaration-without-initializer check, because it depends on linkage-specifier semantics we don't yet have
llvm-svn: 58377
2008-10-29 13:50:18 +00:00
Daniel Dunbar
b3a36cf86a Workaround an LLVM bug where inlining functions with debug info breaks
code generation.
 - For now, disable running the always inliner pass (at -O0) if we are
   also generating debug information.

llvm-svn: 58376
2008-10-29 08:50:02 +00:00
Daniel Dunbar
e74f2c2633 Improve llvm-gcc compatibility, -Os implies -O2 (sortof).
llvm-svn: 58374
2008-10-29 07:56:11 +00:00
Zhongxing Xu
9c15820ea6 Add notes for SCA.
llvm-svn: 58373
2008-10-29 07:05:10 +00:00
Ted Kremenek
f521e4a90b Update checker build.
llvm-svn: 58369
2008-10-29 06:19:03 +00:00
Daniel Dunbar
719781633a Update FindSpecRefs to recognize named section references.
- Unfortunately, I don't have an easy way to map from named sections
   to numbers nicely so they don't get page numbers or integrate in
   the list well.

llvm-svn: 58368
2008-10-29 05:58:09 +00:00
Eli Friedman
5adca5f02c Fix for PR2966: va_start/va_end use the *address* of the
va_list, not the value.  Patch fixes an assert on 
x86-64 and a wrong-code bug on x86.  I'm not completely sure, 
but I think it's a regression from r58306.

Does anyone run regression tests regularly on x86-64? The crash should 
have been picked up there.

llvm-svn: 58366
2008-10-29 04:39:20 +00:00
Ted Kremenek
3f04949b2a Patch by Nikita Zhuk:
The attached patch adds additional checks to -warn-objc-missing-dealloc. It checks that all ivars which are used in implementation of synthesized properties are either

a) released in dealloc if the property has retain" or "copy" attribute OR
b) not released in dealloc if the property has "assign" attribute

llvm-svn: 58363
2008-10-29 04:30:28 +00:00
Ted Kremenek
3700b762ff IOServiceGetMatchingServices is a release function.
llvm-svn: 58362
2008-10-29 04:07:07 +00:00
Daniel Dunbar
a3730a23a2 Choose CompileOptions (optimization passes) to match llvm-gcc more
closely.

llvm-svn: 58361
2008-10-29 03:42:18 +00:00
Daniel Dunbar
dc4030454d Fix mmintrin.h to use proper definition of functions taking no
arguments.
 - More important than it looks, this inhibits trivial inlining
   otherwise.

llvm-svn: 58360
2008-10-29 03:37:55 +00:00
Zhongxing Xu
628ae879ea Rename: AddDecl => BindDecl
BindDecl better describes what the function does:
  - Bind the VarDecl to its memory region
  - Bind the memory region to some initial value.

llvm-svn: 58359
2008-10-29 02:34:02 +00:00
Douglas Gregor
786ab2119f Tweak Sema::CheckReferenceInit so that it (optionally) computes an
ImplicitConversionSequence and, when doing so, following the specific
rules of [over.best.ics]. 

The computation of the implicit conversion sequences implements C++
[over.ics.ref], but we do not (yet) have ranking for implicit
conversion sequences that use reference binding.

llvm-svn: 58357
2008-10-29 02:00:59 +00:00
Zhongxing Xu
cfa9d8e9a0 MemSpaceRegions could be uninitialized. We only require R is a real region.
llvm-svn: 58356
2008-10-29 01:13:28 +00:00
Douglas Gregor
8e1cf608dc Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle:

  - Try/Perform-ImplicitConversion now handles implicit conversions
    that don't involve references.
  - Try/Perform-CopyInitialization uses
    CheckSingleAssignmentConstraints for C. PerformCopyInitialization
    is now used for all argument passing and returning values from a
    function.
  - Diagnose errors with declaring references and const values without
    an initializer. (Uses a new Action callback, ActOnUninitializedDecl).
  
We do not yet have implicit conversion sequences for reference
binding, which means that we don't have any overloading support for
reference parameters yet.

llvm-svn: 58353
2008-10-29 00:13:59 +00:00
Chris Lattner
1500970962 .s files don't require the preprocessor, patch by Roman Divacky!
llvm-svn: 58349
2008-10-28 20:33:42 +00:00
Steve Naroff
f4b992a8ec More changes necessary to integrate the objc and blocks rewriters.
With this commit, stuff like this is very close to working...

    [foo barf:^(int){ printf("whatever\n"); }];

Here is what is currently translates to...

    ((id (*)(id, SEL, void (^)(int)))(void *)objc_msgSend)((id)foo, sel_registerName("barf:"), (void (*)(int))__main_block_func_0);

I just need make sure the funky cast on objc_msgSend() is converted from "void (^)(int)" to "void (*)(int)". Since the cast doesn't appear in the source code, it needs to be converted in RewriteObjC::SynthMessageExpr().

llvm-svn: 58348
2008-10-28 20:29:00 +00:00
Ted Kremenek
2800afa640 Minor UI enhancement:
(1) when all of the bug category boxes are checked, automatically check "All Bugs"

(2) when any of the bug category boxes are unchecked, automatically uncheck "All Bugs"

llvm-svn: 58346
2008-10-28 20:09:57 +00:00
Ted Kremenek
99205241f4 Patch by Nikita Zhuk:
The attached patch adds a checkbox to the scan-build summary report, which toggles all other checkboxes' states.

llvm-svn: 58344
2008-10-28 19:56:52 +00:00
Daniel Dunbar
d745976d36 Access pass manager consistently.
- No functionality change.

llvm-svn: 58342
2008-10-28 19:23:05 +00:00
Daniel Dunbar
5fd9ac230b 80-col fixes.
llvm-svn: 58341
2008-10-28 19:12:58 +00:00
Douglas Gregor
f19b2319c9 Rename ExplicitCCastExpr to CStyleCastExpr
llvm-svn: 58331
2008-10-28 15:36:24 +00:00
Douglas Gregor
d984d30731 Replace a dyn_cast with a cast when we know the exact type
llvm-svn: 58330
2008-10-28 15:29:51 +00:00
Zhongxing Xu
c3c104ec9c Add newline.
llvm-svn: 58322
2008-10-28 09:32:08 +00:00
Zhongxing Xu
c94dce9f95 Update random notes.
llvm-svn: 58321
2008-10-28 09:09:48 +00:00
Zhongxing Xu
382c1a7c7d Add isGlobalsRegion() predicate to MemRegionManager.
llvm-svn: 58313
2008-10-28 05:15:23 +00:00
Chris Lattner
546200529b clarify comment, rename argument to avoid a subtle conflict
with an ivar that wasn't a bug but was confusing.

llvm-svn: 58311
2008-10-28 01:02:17 +00:00
Daniel Dunbar
460f8ee507 Call llvm_shutdown() on (normal) termination. This makes --time-passes usable.
llvm-svn: 58308
2008-10-28 00:38:08 +00:00
Daniel Dunbar
5b06d9f202 Don't run the verifier as part of IRgen, this is now down (per module)
in the driver (this means we no longer run the verifier per function, however).

llvm-svn: 58307
2008-10-28 00:36:04 +00:00
Douglas Gregor
6b75484ba6 Improve our handling of (C++) references within Clang. Specifically:
- Do not allow expressions to ever have reference type
  - Extend Expr::isLvalue to handle more cases where having written a
    reference into the source implies that the expression is an lvalue
    (e.g., function calls, C++ casts).
  - Make GRExprEngine::VisitCall treat the call arguments as lvalues when
    they are being bound to a reference parameter.

llvm-svn: 58306
2008-10-28 00:22:11 +00:00
Ted Kremenek
100f87d655 Initialize Suffix and Prefix to 0, even with a bad entry. Removes an uninitialized value warning from gcc.
llvm-svn: 58305
2008-10-28 00:18:42 +00:00
Daniel Dunbar
03a3844c66 Add attribute always_inline support.
llvm-svn: 58304
2008-10-28 00:17:57 +00:00
Daniel Dunbar
42c68f26cf Mark mmintrin functions static inline, this ensures they don't end up
being emitted unless needed and doesn't inhibit inlining.
  - Can be fixed once we implement C99 inline semantics.

llvm-svn: 58303
2008-10-28 00:06:25 +00:00
Ted Kremenek
1a658a991e - Fix type-punning warning in SVals.cpp by using a real iterator class for symbol_iterator.
- Add symbol_iterator support for SymbolicRegions.

llvm-svn: 58300
2008-10-27 23:39:39 +00:00
Ted Kremenek
54d399ac5d Remove type-punning warning in GRExprEngine. No functionality change.
llvm-svn: 58292
2008-10-27 23:02:39 +00:00
Mike Stump
c60dcc25dd Skip random pathname characters better. I had a 5 in mine.
llvm-svn: 58291
2008-10-27 22:49:55 +00:00
Ted Kremenek
02f9fd4a6c Update checker build.
llvm-svn: 58289
2008-10-27 22:42:11 +00:00
Daniel Dunbar
0b288b8a59 Add test case to exercise IRgen "unsupported" path (mostly cleanup).
llvm-svn: 58286
2008-10-27 22:11:01 +00:00
Daniel Dunbar
1a0625e5cf With -verify, only exit early on failure.
- Nice if -verify test exercise the various cleanup functions.

llvm-svn: 58285
2008-10-27 22:10:13 +00:00
Daniel Dunbar
eb3e41417d Remove unneeded CheckASTConsumer function.
- No functionality change.

llvm-svn: 58282
2008-10-27 22:03:52 +00:00
Daniel Dunbar
6f4eafe14b Comment fix, ParseAST does not take ownership of the consumer.
llvm-svn: 58281
2008-10-27 22:01:05 +00:00
Ted Kremenek
03ce9eeee2 Add 'expected-warning' for braces around scalar initializer
llvm-svn: 58280
2008-10-27 22:00:16 +00:00
Ted Kremenek
c1739912c8 Added compound literal test case.
llvm-svn: 58279
2008-10-27 21:57:17 +00:00
Ted Kremenek
bf26368255 Added preliminary support for CompoundLiterals in the static analyzer:
- GRExprEngine::VisitCompoundLiteral...
   (1) visits the initializer list (generating ExplodedNodes)
   (2) creates a CompoundMemRegion for the literal
   (3) creates a new state with the bound literal values using
       GRStateManager::BindCompoundLiteral

- GRStateManager::BindCompoundLiteral simply calls 
  StoreManager::BindCompoundLiteral to get a new store and returns a persistent
  GRState with that store.

- BasicStore::BindCompoundLiteral simply returns the same store, as it
  doesn't handle field sensitivity
  
- RegionStore::BindCompoundLiteral currently fires an assert (pending discussion
  of how to best implement mappings for CompoundLiteralRegion).

llvm-svn: 58277
2008-10-27 21:54:31 +00:00
Ted Kremenek
2837b9ef6c Update Xcode project.
llvm-svn: 58276
2008-10-27 21:41:20 +00:00
Ted Kremenek
eaf5e24cbb Pull determination of the super region for a VarRegion into a single getVarRegion() method. This provides a common clean API for clients.
llvm-svn: 58272
2008-10-27 21:01:26 +00:00
Ted Kremenek
bc48caf383 Added CompoundLiteralRegion to represent the (temporary) memory allocated for a compound literal.
llvm-svn: 58270
2008-10-27 20:57:58 +00:00
Steve Naroff
b88d775201 Fix testsuite regression for "crash.m".
llvm-svn: 58269
2008-10-27 20:54:44 +00:00
Daniel Dunbar
9b87dcb929 Don't double free module when IRgen fails.
llvm-svn: 58266
2008-10-27 20:40:41 +00:00
Daniel Dunbar
966c2e1454 Improve dependency file support.
- Add support for -MP (phony targets).
 
 - Use raw_ostream for output instead of std::string concatenation.
 
 - Break long lines in a GCC (4.2) compatible manner.

 - Output dependents in #included order (to match GCC).

llvm-svn: 58265
2008-10-27 20:01:06 +00:00
Douglas Gregor
e200adc503 Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
  - ImplicitCastExpr is (still) used for all explicit casts
  - ExplicitCastExpr is now the root of all *explicit* casts
  - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
  - CXXFunctionalCastExpr inherits from ExplicitCastExpr
  - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
    of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
  - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, 
    CXXReinterpretCastExpr, and CXXConstCastExpr to 

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.

llvm-svn: 58264
2008-10-27 19:41:14 +00:00
Steve Naroff
cb04e88580 Some fixups to the previous objc/blocks rewriter smerge.
llvm-svn: 58262
2008-10-27 18:50:14 +00:00
Ted Kremenek
5778acf5e8 - Move ExprIterator to Stmt.h so that it can be used by classes defined in Stmt.h
- Implement child_begin() and child_end() for AsmStmt.  Previously these had stub implementations that did not iterate over the input/output operands of an inline assembly statement.
- Use ExprIterator for performing iteration over input/output operands.

llvm-svn: 58261
2008-10-27 18:40:21 +00:00
Steve Naroff
677ab3ab45 Integrate the blocks and objc rewriters.
llvm-svn: 58253
2008-10-27 17:20:55 +00:00
Sebastian Redl
344fc3db3f Fix some invalid casts that are detected by Sema now or soon.
llvm-svn: 58252
2008-10-27 16:34:21 +00:00
Zhongxing Xu
ad4c3ded0d Add store option to scan-build and ccc-analyzer.
llvm-svn: 58248
2008-10-27 14:26:32 +00:00
Zhongxing Xu
144d7554c4 Use ASTContext::getCanonicalType() to get TypedRegion's type.
llvm-svn: 58247
2008-10-27 13:35:03 +00:00
Zhongxing Xu
7b700575dd An ElementRegion is really a typed region. Its super region's type has to be ArrayType.
llvm-svn: 58245
2008-10-27 13:17:02 +00:00
Douglas Gregor
89ebcb9d8d When destroying a translation unit, deallocate its owned declarations in reverse order, because there may be dependencies among the declarations.
llvm-svn: 58244
2008-10-27 12:50:38 +00:00
Zhongxing Xu
36d4ade4be We cannot get precise lvalue for symbolic base array region.
llvm-svn: 58243
2008-10-27 12:23:17 +00:00
Steve Naroff
c6db58a6bd Replace common diagnostic with a convenience function.
This simplifies debug of this particular diagnostic (and removes some code clutter).

llvm-svn: 58242
2008-10-27 11:34:16 +00:00
Steve Naroff
1d4a9a31b6 Fix <rdar://problem/6315646> clang on xcode: error: invalid operands to binary expression ('id<NSTableViewDelegate>' and 'XCExtendedArrayController *').
There is still a bug here (as the FIXME in the test case indicates). Prior to this patch, the bug would generate an error. Now, we simply do nothing (which is less harmful until we can get it right). The complete bug fix will require changing ASTContext::mergeTypes(), which I'd like to defer for now.

llvm-svn: 58241
2008-10-27 10:33:19 +00:00
Zhongxing Xu
bb18b57f53 Get the canonical type for struct initialization. The original code would crash on TypedefType.
llvm-svn: 58236
2008-10-27 09:24:07 +00:00
Zhongxing Xu
b32af436df Add test for SCA region store.
llvm-svn: 58235
2008-10-27 09:21:27 +00:00
Zhongxing Xu
7a2ce566bc Add test for SCA region store.
llvm-svn: 58234
2008-10-27 09:19:25 +00:00
Zhongxing Xu
d7c44059d4 Only loc::MemRegionVal can be modified. This avoids crashing in RegionStore when a function pointer is used as an argument.
llvm-svn: 58233
2008-10-27 09:00:08 +00:00
Chris Lattner
66a740e66e Rename Characteristic_t to CharacteristicKind
llvm-svn: 58224
2008-10-27 01:19:25 +00:00
Chris Lattner
69f9bc24f4 Fix the definition of __builtin_va_list on PPC, which was set to the V4 ABI, not the
darwin or AIX abis.  This fixes PR2904.

llvm-svn: 58222
2008-10-27 01:11:29 +00:00
Chris Lattner
084bc32e0d make codegen reject initializes with designators, like this:
t.c:1:13: error: cannot codegen this designators yet
int a[10] = {2, 4, [8]=9, 10};
            ^~~~~~~~~~~~~~~~~

llvm-svn: 58220
2008-10-26 23:53:12 +00:00
Chris Lattner
07d754acf1 Remember whether an initlist had a designator in the AST.
llvm-svn: 58218
2008-10-26 23:43:26 +00:00
Chris Lattner
248388e313 pass designators into sema. This completes parser-level designator
support as far as I know.

llvm-svn: 58217
2008-10-26 23:35:51 +00:00
Chris Lattner
9a53fdc23e implement some more FIXMEs, by rejecting more bogus stuff in
objc mode.

llvm-svn: 58216
2008-10-26 23:29:41 +00:00
Chris Lattner
46dcba6d2d add some simple designator testcases. Reject things like this:
struct foo Y[10] = {
  [4] .arr [2] 4  // expected-error {{expected '=' or another designator}}
};

because the "missing equals" extension only is valid if there 
is exactly one array designator.

llvm-svn: 58215
2008-10-26 23:22:23 +00:00
Chris Lattner
8aafd35c79 improve comments, build array and array range designator nodes,
fix an obscure memory leak.

llvm-svn: 58213
2008-10-26 23:06:54 +00:00
Chris Lattner
7243245a58 improve comments, build a Designation for field designators and
improve diagnostic for a malformed field designator.

llvm-svn: 58212
2008-10-26 22:59:19 +00:00
Chris Lattner
e2b5e87f58 restructure ParseInitializerWithPotentialDesignator to make it
easier to understand and hack on, no functionality change.

llvm-svn: 58210
2008-10-26 22:49:49 +00:00
Chris Lattner
dde6543731 improve MayBeDesignationStart to do the entire determination
about whether a leading identifier is a designator.

llvm-svn: 58207
2008-10-26 22:41:58 +00:00
Chris Lattner
3fa9239f41 inline the decision logic that chooses between an assign expr and brace
initializer, avoiding an extra level of calls for silly things like
'int x = 4'.

llvm-svn: 58206
2008-10-26 22:38:55 +00:00
Chris Lattner
f3e58e2ebc This patch continues parser-level implementation of designators:
1. It introduces new parser level abstractions for designators
   that are used to communicate between parser and sema.
2. This fixes a FIXME where "identifier ':'" was considered to be
   a designator even if it wasn't the first in a designator list.
3. In the "identifier ':'" case, it actually builds the designator
   representation.

llvm-svn: 58205
2008-10-26 22:36:07 +00:00
Chris Lattner
0c02460038 minor cleanups
llvm-svn: 58203
2008-10-26 21:46:13 +00:00
Sebastian Redl
5cba81afb3 Allow \n for newlines in expected error messages.
llvm-svn: 58198
2008-10-26 19:05:16 +00:00
Argyrios Kyrtzidis
22a3735398 Don't give a default argument to ASTContext::getFunctionType for the TypeQuals parameter, it causes subtle bugs where TypeQuals, while necessary, are omitted from the call.
-Remove the default argument.
-Update all call sites of ASTContext::getFunctionType.

llvm-svn: 58187
2008-10-26 16:43:14 +00:00
Zhongxing Xu
60de6c6c63 Remove loc::StringLiteralVal. Now we allocate regions for string literals in the Store.
llvm-svn: 58182
2008-10-26 02:27:21 +00:00
Zhongxing Xu
bf47dc85fe Simplify ArrayToPointer conversion. Actually the only thing we need to do is to get the first element region. It is not necessary to care about the kind of the base array region.
llvm-svn: 58181
2008-10-26 02:23:57 +00:00
Oscar Fuentes
07d9f9a6ec CMake: Builds and installs clang binary and libs (no docs yet). It
must be under the `tools' subdirectory of the LLVM *source* tree.

llvm-svn: 58180
2008-10-26 00:56:18 +00:00
Ted Kremenek
3773bbce54 Use string literal for format string specifier; this prevents ErrMsg from being interpretted as a format string specifier.
llvm-svn: 58150
2008-10-25 20:19:34 +00:00
Ted Kremenek
e69a1fa342 Do not crash when performing VisitLValue on union types.
This fixes PR 2948.

llvm-svn: 58148
2008-10-25 20:09:21 +00:00
Zhongxing Xu
195839dd53 Add a note file for SCA module. Is it the right place?
llvm-svn: 58140
2008-10-25 14:56:36 +00:00
Zhongxing Xu
0d2706f6b8 Add code for get the lvalue for string literals. Now we return a StringRegion
for StringLiteral lvalue evaluation, instead of directly returning a
loc::StringLiteralVal by the Environment.

llvm-svn: 58138
2008-10-25 14:18:57 +00:00
Zhongxing Xu
d1aac353e5 Add StringRegion to MemRegions.
llvm-svn: 58137
2008-10-25 14:13:41 +00:00
Zhongxing Xu
80422b07c5 Add StringLiteral test code.
llvm-svn: 58136
2008-10-25 14:11:23 +00:00
Zhongxing Xu
ad20b671fc Now we can handle arrays.
llvm-svn: 58135
2008-10-25 10:26:46 +00:00
Nuno Lopes
36a04c8268 2nd try to fix leakage of the module provider. note that moduleprovider takes ownership of the module
llvm-svn: 58128
2008-10-24 23:27:18 +00:00
Nuno Lopes
a39a4cec35 fix leaking of the module provider
llvm-svn: 58127
2008-10-24 22:51:00 +00:00
Ted Kremenek
bb913f2369 Updated checker build.
llvm-svn: 58125
2008-10-24 22:34:49 +00:00
Argyrios Kyrtzidis
962c20e6f3 Add a quote from the standard about the type of 'this'.
llvm-svn: 58124
2008-10-24 22:28:18 +00:00
Argyrios Kyrtzidis
98ca36f009 Unbreak the test by.. removing a space. (clang protested that -verify only works on single input files).
llvm-svn: 58123
2008-10-24 22:25:11 +00:00
Daniel Dunbar
fa0caca6d2 Add initial dependency file generation support. Patch by Kovarththanan
Rajaratnam, with some updates and formatting changes.

llvm-svn: 58122
2008-10-24 22:12:41 +00:00
Argyrios Kyrtzidis
22c40fa285 -Add support for cv-qualifiers after function declarators.
-Add withConst/withVolatile/withRestrict methods to QualType class, that return the QualType plus the respective qualifier.

llvm-svn: 58120
2008-10-24 21:46:40 +00:00
Daniel Dunbar
c157586598 Add ViewVC link from web page.
llvm-svn: 58119
2008-10-24 21:31:50 +00:00
Ted Kremenek
4bc52fdd75 Generalize searching for the keyword "leak" in a bug type.
llvm-svn: 58115
2008-10-24 21:23:51 +00:00
Ted Kremenek
920406b5ca Use "followsFundamentalRule" to determine if an instance method allocates memory.
llvm-svn: 58114
2008-10-24 21:22:44 +00:00
Ted Kremenek
01acb6284e followsFundamentalRule() returns true if "alloc" or "new" appear at the beginning of the string, not anywhere within it.
llvm-svn: 58112
2008-10-24 21:18:08 +00:00
Ted Kremenek
8d8a14a3fc Expand bubble size by 50%.
llvm-svn: 58111
2008-10-24 21:17:16 +00:00
Ted Kremenek
6e09d8f632 Implicit conversions from arrays can also be conversions to references (will add a test case shortly).
llvm-svn: 58110
2008-10-24 21:10:49 +00:00
Ted Kremenek
14e6350dcc This test no longer is marked XFAIL.
Enhance test to include a case where a tracked object escapes because it is stored to a local ivar through a method dispatch to 'self.'

llvm-svn: 58109
2008-10-24 20:33:56 +00:00
Ted Kremenek
03466c2273 Issue warnings about owned objects returned from a method that does not match the established Cocoa naming conventions.
llvm-svn: 58108
2008-10-24 20:32:50 +00:00
Ted Kremenek
f3be44f191 Added method "getSelfRegion" to Store. This method returns the region associated with the "this" or "self" object (C++ and Objective-C respectively).
llvm-svn: 58107
2008-10-24 20:32:16 +00:00
Ted Kremenek
8921d930d4 Added region ObjCObjectRegion that represents an instance of an Objective-C object.
llvm-svn: 58106
2008-10-24 20:30:08 +00:00
Douglas Gregor
3dfef1f2a3 Move viewInheritance to CXXRecordDecl, and make sure it builds in Release mode, too
llvm-svn: 58105
2008-10-24 19:53:54 +00:00
Douglas Gregor
a8aa7a08b8 PR2942: FunctionDecls by typedef crash the C++ front-end
llvm-svn: 58100
2008-10-24 18:09:54 +00:00
Sebastian Redl
67604aeedf Test commit
llvm-svn: 58099
2008-10-24 17:45:08 +00:00
Steve Naroff
614c490866 Add another file to VC++ project.
llvm-svn: 58098
2008-10-24 16:53:41 +00:00
Douglas Gregor
70dc759f14 Make QualTypeOrdering::operator() const
llvm-svn: 58097
2008-10-24 16:48:10 +00:00
Douglas Gregor
cea4e74340 Some cleanups for the ambiguous derived-to-base conversion checks
llvm-svn: 58096
2008-10-24 16:17:19 +00:00
Douglas Gregor
08d918a6c3 Semantic analysis for C++ reinterpret_cast and const_cast. Patch by Sebastian Redl.
llvm-svn: 58094
2008-10-24 15:36:09 +00:00
Ted Kremenek
196922b4a1 Fix scan-build's processing of clang's analysis arguments. Patch by Nikita Zhuk!
llvm-svn: 58093
2008-10-24 15:11:58 +00:00
Steve Naroff
d706e8d62c Yet another update to the VC++ proj.
llvm-svn: 58091
2008-10-24 12:40:20 +00:00
Zhongxing Xu
e834fc1249 The Decl of an array region can be VarDecl or FieldDecl. Handle this in RegionStoreManager::ArrayToPointer().
llvm-svn: 58086
2008-10-24 09:06:51 +00:00
Zhongxing Xu
d2f0c7b37b Add random array and struct test code for SCA.
llvm-svn: 58085
2008-10-24 08:51:58 +00:00
Daniel Dunbar
5043549666 Use #define trickery to de-XFAIL test/Coverage/codegen-gnu.m while
still getting coverage for non-IRgen cases.

llvm-svn: 58084
2008-10-24 08:42:52 +00:00
Zhongxing Xu
729518be3a Implement struct initialization. Make it into a recursive function. Also make
the array initialization code into a function.

llvm-svn: 58083
2008-10-24 08:42:28 +00:00
Daniel Dunbar
15fadeb9cf Use #define trickery to de-XFAIL test/Coverage/codegen-next.m while
still getting coverage for non-IRgen cases.

llvm-svn: 58082
2008-10-24 08:39:46 +00:00
Daniel Dunbar
dec8a89d37 Don't crash on invalid source locations in
CGDebugInfo::getOrCreateCompileUnit.

llvm-svn: 58081
2008-10-24 08:38:36 +00:00
Daniel Dunbar
d7be95d60a PR2919: __builtin_types_compatible_p strips CRV qualifiers.
llvm-svn: 58079
2008-10-24 08:07:57 +00:00
Chris Lattner
b2d68310cb add a missing file to project, alphabeticalize.
llvm-svn: 58078
2008-10-24 06:52:28 +00:00
Zhongxing Xu
a14262862f Add printing method to ElementRegion.
llvm-svn: 58077
2008-10-24 06:30:07 +00:00
Daniel Dunbar
d3963f7f25 Use LINK_COMPONENTS instead of hard coding LLVM libraries.
llvm-svn: 58076
2008-10-24 06:24:13 +00:00
Zhongxing Xu
1359e00f9c Add printing method to RegionStoreManager.
llvm-svn: 58074
2008-10-24 06:01:33 +00:00
Zhongxing Xu
509bd9e30a Add printing with llvm::raw_ostream methods to SVals.
llvm-svn: 58073
2008-10-24 06:00:12 +00:00
Douglas Gregor
39c16d445e First non-embarrassing cut at checking for ambiguous derived-to-base
conversions.

Added PerformImplicitConversion, which follows an implicit conversion sequence
computed by TryCopyInitialization and actually performs the implicit
conversions, including the extra check for ambiguity mentioned above.

llvm-svn: 58071
2008-10-24 04:54:22 +00:00
Zhongxing Xu
c7796d347d Fix 80-col violation.
llvm-svn: 58070
2008-10-24 04:33:15 +00:00
Zhongxing Xu
c156be31a6 Fix linking error.
llvm-svn: 58067
2008-10-24 02:03:36 +00:00
Zhongxing Xu
cebb741f68 Add a bunch of dummy methods to make RegionStoreManager non-virtual.
llvm-svn: 58061
2008-10-24 01:38:55 +00:00
Steve Naroff
57d00c056a Add file to VC++ project.
llvm-svn: 58059
2008-10-24 01:19:59 +00:00
Zhongxing Xu
a8d2cbe47f Added getLValueElement() to RegionStore. Only handle constant array for now.
llvm-svn: 58058
2008-10-24 01:09:32 +00:00
Ted Kremenek
6779f893b9 Make the analyzer store (memory model) a command line option.
llvm-svn: 58056
2008-10-24 01:04:59 +00:00
Daniel Dunbar
607f67b16c Map compilation units using FileEntry pointers instead of
FileIDs. This seems better conceptually and lets the SourceManager
handle details of mapping the location to a file ID.
 - In practice, fixes an assert because this code wasn't using
   getPhysicalLoc.

llvm-svn: 58055
2008-10-24 00:46:51 +00:00
Ted Kremenek
1507dbfbfc Use llvm::errs() instead of cerr.
llvm-svn: 58054
2008-10-23 23:55:40 +00:00
Ted Kremenek
40fcc594b8 Convert InheritanceHierarchyWriter to use llvm::raw_ostream instead of std::ostream.
llvm-svn: 58053
2008-10-23 23:51:23 +00:00
Ted Kremenek
45e2b90d3d Added driver option "-cxx-inheritance-view" for viewing the C++ hierarchy of a class in GraphViz.
llvm-svn: 58051
2008-10-23 23:36:29 +00:00
Ted Kremenek
f000308467 Added iterators for types.
llvm-svn: 58050
2008-10-23 23:35:43 +00:00
Daniel Dunbar
340b5ddcf9 Fix regression in comparison of qualified id; == operator was being
created with LHS and RHS whose types didn't match.

llvm-svn: 58049
2008-10-23 23:30:52 +00:00
Steve Naroff
e5d0011007 Add some files to VC++ project.
llvm-svn: 58047
2008-10-23 23:20:50 +00:00
Ted Kremenek
8c2b94b787 Updated Xcode project.
llvm-svn: 58046
2008-10-23 23:15:03 +00:00
Ted Kremenek
049ba7fbb1 For Radar reporting, null dereferences should be default classified as "Crash/Hang/Data loss" <rdar://problem/6315624>
llvm-svn: 58045
2008-10-23 21:36:52 +00:00
Douglas Gregor
9d6290baf1 Clean up and document the representation of C++ base classes
llvm-svn: 58040
2008-10-23 18:13:27 +00:00
Daniel Dunbar
6a962b162c Hook "fast" code generation to -O0.
llvm-svn: 58035
2008-10-23 05:59:43 +00:00
Daniel Dunbar
71880e738a Add -O[0-3s] support (following llvm-gcc).
- Passes match llvm-gcc but many of the switches aren't wired.

llvm-svn: 58034
2008-10-23 05:50:47 +00:00
Zhongxing Xu
9c4bc9dd33 Add an assertion to make our intention more clear.
llvm-svn: 58030
2008-10-23 04:19:25 +00:00
Douglas Gregor
01bef3c016 If NDEBUG is set, don't include any of the code for visualizing inheritance hierarchies
llvm-svn: 58029
2008-10-23 03:52:39 +00:00
Zhongxing Xu
b0a4875b42 Let StoreManager do different cast on arrays. BasicStore will just keep it intact.
llvm-svn: 58028
2008-10-23 03:10:39 +00:00
Ted Kremenek
dfaeaed0f6 Updated checker build.
llvm-svn: 58027
2008-10-23 02:50:14 +00:00
Ted Kremenek
c5092cc061 Temporarily mark this test XFAIL.
llvm-svn: 58024
2008-10-23 01:57:31 +00:00
Ted Kremenek
cc3d18877a Disable warning about potential leaks of returned values until we test it a little more (lots of noise).
llvm-svn: 58021
2008-10-23 01:56:15 +00:00
Zhongxing Xu
e7104dcab6 Added a method to ElementRegion.
llvm-svn: 58020
2008-10-23 01:35:34 +00:00
Douglas Gregor
5c407d9a9b Add support for conversions from a pointer-to-derived to a
pointer-to-base. Also, add overload ranking for pointer conversions
(for both pointer-to-void and derived-to-base pointer conversions).

Note that we do not yet diagnose derived-to-base pointer conversion
errors that stem from ambiguous or inacessible base classes. These
aren't handled during overload resolution; rather, when the conversion
is actually used we go ahead and diagnose the error.

llvm-svn: 58017
2008-10-23 00:40:37 +00:00
Ted Kremenek
b205ff64e7 Update Xcode project. We still get a link error, however, because of an LLVM library that isn't being linked in for CodeGen (will fix).
llvm-svn: 58015
2008-10-23 00:00:24 +00:00
Ted Kremenek
631ff239fc Warn about potentially leaked objects that are returned from methods whose names do not follow the Cocoa Memory Management guidelines.
llvm-svn: 58012
2008-10-22 23:56:21 +00:00
Steve Naroff
9eca18e4ed Fix <rdar://problem/6312683> clang block rewriter:
llvm-svn: 58011
2008-10-22 23:42:04 +00:00
Argyrios Kyrtzidis
1a527ea1e5 Restrict creation of OverloadedFunctionDecl only to C++ (it was getting used for invalid redeclarations on C).
llvm-svn: 58008
2008-10-22 23:08:24 +00:00
Steve Naroff
b0c653a649 Fix <rdar://problem/6311947> clang on xcode (regression): error: use of undeclared identifier 'expandedValue'.
Mea culpa: I introduced this regresson in the following 2 commits: r57529 (10/14), r57841 (10/20).

llvm-svn: 58007
2008-10-22 22:40:28 +00:00
Ted Kremenek
a08a05e541 Updated checker build.
llvm-svn: 58005
2008-10-22 21:53:52 +00:00
Douglas Gregor
d8c7476bf3 Remove the GraphWriter-based version of the C++ class inheritance visualization, since it isn't being used and can't handle virtual bases properly
llvm-svn: 58002
2008-10-22 21:25:12 +00:00
Douglas Gregor
dff6a8eeef Added GraphViz visualization of C++ inheritance hierarchies.
Factored the QualTypeOrdering predicate into its own header
(TypeOrdering.h), now that it is used in two places.

llvm-svn: 58001
2008-10-22 21:13:31 +00:00
Argyrios Kyrtzidis
2147e7d88b Now that DeclRefExpr accepts a NamedDecl, use a DeclRefExpr for when a CXXFieldDecl is referenced inside a method.
llvm-svn: 58000
2008-10-22 21:00:29 +00:00
Ted Kremenek
9a96bf22ec Enhance reference-count checker to correctly identify CG "release" functions. This fixes <rdar://problem/6303488>.
llvm-svn: 57997
2008-10-22 20:54:52 +00:00
Steve Naroff
1df62692f2 Fix <rdar://problem/6257675> error: member reference base type ('NSUserDefaults *') is not a structure or union.
Teach Sema::ActOnMemberReferenceExpr() to look through local category implementations associated with the class.

llvm-svn: 57995
2008-10-22 19:16:27 +00:00
Daniel Dunbar
c49d71ea61 Only create the target machine when emitting assembly.
llvm-svn: 57993
2008-10-22 18:29:51 +00:00
Douglas Gregor
29a9247ec2 Add representation of base classes in the AST, and verify that we
don't have duplicated direct base classes.

Seriliazation of base class specifiers is not yet implemented.

llvm-svn: 57991
2008-10-22 17:49:05 +00:00
Daniel Dunbar
254be031df [LLVM up] Get rid of std::ostream usage from Backend.cpp
llvm-svn: 57990
2008-10-22 17:40:45 +00:00
Chris Lattner
720d515ee9 Add support for assembler-with-cpp (preprocessed .S files), patch by
Roman Divacky!

llvm-svn: 57988
2008-10-22 17:29:21 +00:00
Ted Kremenek
7c3a364355 Update server URL for checker build.
llvm-svn: 57981
2008-10-22 15:33:19 +00:00
Douglas Gregor
4b62ec6353 QualType::isMoreQualifiedThan and isAtLeastAsQualifiedAs assert that we
aren't trying to compare with address-space qualifiers (for now).

Clean up handing of DeclRefExprs in Expr::isLvalue and refactor part
of the check into a static DeclCanBeLvalue.

llvm-svn: 57980
2008-10-22 15:04:37 +00:00
Zhongxing Xu
da84f683c8 Add test case for FuncDecl and function pointer variable.
llvm-svn: 57979
2008-10-22 14:39:20 +00:00
Douglas Gregor
e1eb9d8cc4 Implement ranking of standard conversion sequences by their qualification
conversions (e.g., comparing int* -> const int* against 
int* -> const volatile int*); see C++ 13.3.3.2p3 bullet 3.

Add Sema::UnwrapSimilarPointerTypes to simplify the control flow of
IsQualificationConversion and CompareQualificationConversion (and fix
the handling of the int* -> volatile int* conversion in the former).
 

llvm-svn: 57978
2008-10-22 14:17:15 +00:00
Zhongxing Xu
2fbc35443d Add a bunch of getLValue* methods to RegionStore.
llvm-svn: 57977
2008-10-22 13:44:38 +00:00
Zhongxing Xu
c5382eae80 Adjust parameter order to more natural one.
llvm-svn: 57964
2008-10-22 09:00:19 +00:00
Zhongxing Xu
c272152919 Exprs of function type is another special case for ImplicitCast.
llvm-svn: 57963
2008-10-22 08:02:16 +00:00
Douglas Gregor
bc55da5768 Move Sema::GetNonReferenceType to QualType::getNonReferenceType and make it inline
llvm-svn: 57951
2008-10-22 04:14:44 +00:00
Chris Lattner
b795443082 some minor cleanups to ParseObjCTypeName:
1. Remove a bogus assertion, clients other than sema can return a
   null pointer from actions that result in ParseTypeName returning null.
2. Remove dead RParenLoc variable.
3. Simplify control flow handling error conditions.
4. On a major failure, we should skip until ')' not until '}'.

llvm-svn: 57949
2008-10-22 03:52:06 +00:00
Daniel Dunbar
09b4e71e34 Update to use raw_ostream for PrintModulePass.
- Stop playing fast and loose with the std stream.

llvm-svn: 57948
2008-10-22 03:28:13 +00:00
Douglas Gregor
ea2d4211e5 Fix a thinko in the qualification-conversion check when the qualificaitons are disjoint, and add some overloading-based tests of qualification conversions
llvm-svn: 57942
2008-10-22 00:38:21 +00:00
Douglas Gregor
293a3c6778 Functions can be lvalues in C++, but not modifiable lvalues
llvm-svn: 57941
2008-10-22 00:03:08 +00:00
Daniel Dunbar
68a277cfac Commito, didn't mean to remove this header.
llvm-svn: 57938
2008-10-21 23:54:00 +00:00
Daniel Dunbar
c13935e8be [LLVM up] Add basic -S option to clang.
- Split backend related consumer out into Backend.cpp, replaces
   LLVMCodeGenWriter.
 - Structure follows llvm-gcc to some extent.
 - Still need to implement all the options which impact code
   generation and the optimization passes which llvm-gcc uses at
   various levels.

llvm-svn: 57936
2008-10-21 23:49:24 +00:00
Douglas Gregor
9a6579340f Initial step toward supporting qualification conversions (C++ 4.4).
Changes:
  - Sema::IsQualificationConversion determines whether we have a qualification
    conversion.
  - Sema::CheckSingleAssignment constraints now follows the C++ rules in C++,
    performing an implicit conversion from the right-hand side to the type of
    the left-hand side rather than checking based on the C notion of 
    "compatibility". We now rely on the implicit-conversion code to
    determine whether the conversion can happen or
    not. Sema::TryCopyInitialization has an ugly reference-related
    hack to cope with the initialization of references, for now.
  - When building DeclRefExprs, strip away the reference type, since
    there are no expressions whose type is a reference. We'll need to
    do this throughout Sema.
  - Expr::isLvalue now permits functions to be lvalues in C++ (but not
  in C).

llvm-svn: 57935
2008-10-21 23:43:52 +00:00
Ted Kremenek
518b17e8f3 Updated checker build.
llvm-svn: 57931
2008-10-21 21:56:56 +00:00
Daniel Dunbar
29fa8354fc Add coverage of part of getPrimaryDecl that was failing prior to
previous commit.

llvm-svn: 57930
2008-10-21 21:32:38 +00:00
Daniel Dunbar
445693afaf Fix use of dyn_cast.
llvm-svn: 57927
2008-10-21 21:22:32 +00:00
Daniel Dunbar
30c514e763 Add GetModule accessor to ModuleBuilder
llvm-svn: 57924
2008-10-21 19:55:09 +00:00
Ted Kremenek
677fba12a5 When conjuring symbols for compound assignments, use the promoted type to determine if the symbolic value as a "loc::" or "nonloc::" value.
llvm-svn: 57917
2008-10-21 19:49:01 +00:00
Steve Naroff
5cfa5af630 Fix <rdar://problem/6257645> clang static analyzer crashes when encountering blocks as objects
ASTContext::isObjCObjectPointerType() needs to consider blocks as objects.

Note: My previous commit was done in the test directory...as a result, this commit was necessary.
llvm-svn: 57914
2008-10-21 18:24:04 +00:00
Steve Naroff
e94444faf3 Fix <rdar://problem/6257645> clang static analyzer crashes when encountering blocks as objects
ASTContext::isObjCObjectPointerType() needs to consider blocks as objects.

llvm-svn: 57913
2008-10-21 18:21:45 +00:00
Douglas Gregor
209ad9dc70 Cosmetic patch from João Paulo Rechi Vita
llvm-svn: 57910
2008-10-21 16:14:35 +00:00
Douglas Gregor
5251f1b283 Preliminary support for function overloading
llvm-svn: 57909
2008-10-21 16:13:35 +00:00
Ted Kremenek
0747e7e025 Handle [NSAutoreleasePool addObject:] (an alternative way to add objects to the current autorelease pool).
Added initial code for tracking stack of autorelease pools.

llvm-svn: 57908
2008-10-21 15:53:15 +00:00
Ted Kremenek
3e6c028297 Update Xcode project.
llvm-svn: 57907
2008-10-21 15:34:53 +00:00
Steve Naroff
90255b4f54 Fix a crasher during error recovery in Parser::ParseObjCTypeName().
Found this while fixing another unrelated radar.

llvm-svn: 57904
2008-10-21 14:15:04 +00:00
Steve Naroff
e020fa1b85 Fix <rdar://problem/6297052> confused in some way by embedded /* */ comments.
llvm-svn: 57903
2008-10-21 13:37:27 +00:00
Steve Naroff
56aa731a63 Update VC++ project files.
llvm-svn: 57902
2008-10-21 13:04:43 +00:00
Gabor Greif
09a5cf89ca Tweak an expected-error to match the output. IMHO it is better to diagnose 'int (void)' because it has the same meaning in C and C++.
llvm-svn: 57901
2008-10-21 11:46:36 +00:00
Steve Naroff
9ebc050ca7 Fix typo.
llvm-svn: 57899
2008-10-21 10:50:19 +00:00
Steve Naroff
a0ed165a84 Fix <rdar://problem/6261178> clang-on-xcode: [sema] multiple method warning is over enthusiastic.
Fix <rdar://problem/6265257> warnings for ambiguous message send swamp other warnings.

Reworked Sema::MatchTwoMethodDeclarations() to optionally match based on method size and alignment (the default in GCC). Changed Sema::LookupInstanceMethodInGlobalPool() to use this feature.

Added -Wno-struct-selector-match to driver, however didn't hook it up yet. Added a FIXME that says this.

llvm-svn: 57898
2008-10-21 10:37:50 +00:00
Zhongxing Xu
dab76fd822 Localize the special processing of array variable inside
GRExprEngine::VisitCast() so that other parts of the analyzer can be ignorant.
When we cast "array of type T" to "pointer to T", we get the loc::MemRegionVal
corresponding to the array variable. This is sufficient for BasicStore, but not
for RegionStore. RegionStore should get the element region for the first array
element in the cast. So next comes to the revamping of transfer functions for
different store model.

llvm-svn: 57897
2008-10-21 06:54:23 +00:00
Zhongxing Xu
8f6855e642 Modify Store interface: GetSVal/SetSVal => Retrieve/Bind.
llvm-svn: 57896
2008-10-21 06:27:32 +00:00
Ted Kremenek
0aee1cd5a3 Add partial specialization of ImmutableList for GRStatePartialTrait.
llvm-svn: 57895
2008-10-21 06:00:04 +00:00
Zhongxing Xu
7ff32d0955 Rename:
RValues.h/cpp => SVals.h/cpp

llvm-svn: 57893
2008-10-21 05:41:03 +00:00
Zhongxing Xu
83aff7079f Process decls in RegionStore. Individual elements of fixed size arrays are
initialized to UndefinedVal.

llvm-svn: 57892
2008-10-21 05:29:26 +00:00
Zhongxing Xu
d8fe46b496 Add ElementRegion to represent memory chunks for array elements.
llvm-svn: 57891
2008-10-21 05:27:10 +00:00
Ted Kremenek
9667b7c9c0 Updated checker build
llvm-svn: 57890
2008-10-21 04:32:44 +00:00
Ted Kremenek
d346dfe881 Add fileid_iterator to SourceManager.
llvm-svn: 57878
2008-10-21 03:32:32 +00:00
Ted Kremenek
4e0f205145 Added method to access the raw flags of Token.
llvm-svn: 57877
2008-10-21 03:32:15 +00:00
Ted Kremenek
9f20b6a610 Change signature for CheckDivideZero.
llvm-svn: 57876
2008-10-21 03:31:53 +00:00
Ted Kremenek
8ab23ade80 Added the start of a prototype implementation of PCH based on token caching.
llvm-svn: 57863
2008-10-21 00:54:44 +00:00
Ted Kremenek
c32ec3a0c4 Further improve path-sensitivity with divide-by-zero checking by assuming that a denominator cannot be zero even when the result of an '/' or '%' expression is unknown.
llvm-svn: 57855
2008-10-20 23:40:25 +00:00
Ted Kremenek
e67437f3a9 Added test case inspired by <rdar://6268365>: recover path-sensitivity after compound assignment when the result of the assignment is not known.
llvm-svn: 57852
2008-10-20 23:14:31 +00:00
Ted Kremenek
7f8a87f4a9 Used conjured symbols to recover path-sensitivity when the result of a compound assignment is UnknownVal().
llvm-svn: 57851
2008-10-20 23:13:25 +00:00