Commit Graph

3945 Commits

Author SHA1 Message Date
Anders Carlsson 6d9f6f326d Handle layout of non-virtual base classes.
llvm-svn: 76348
2009-07-19 00:18:47 +00:00
Argyrios Kyrtzidis c7082933e6 Re-enable 'test/SemaTemplate/temp_class_spec_neg.cpp', after commenting out the cause of the crash.
llvm-svn: 76337
2009-07-18 21:18:10 +00:00
Daniel Dunbar f1dc291655 Disable this test for now, it has been crashing on linux for weeks.
llvm-svn: 76328
2009-07-18 19:55:20 +00:00
Sebastian Redl c88ab62c87 Fix RUN line to not litter the test directory.
llvm-svn: 76320
2009-07-18 15:13:36 +00:00
Sebastian Redl e644e19671 Enhance testing of overriding exception specs for inaccessible base exceptions.
llvm-svn: 76317
2009-07-18 14:32:15 +00:00
Ted Kremenek e9812bdac5 Fix crash in StoreManager::NewCastRegion() when handling casts from 'id' (or whatever) to a BlockPointerType.
llvm-svn: 76288
2009-07-18 06:27:51 +00:00
Ted Kremenek 6ab0a74a25 Add test case for bug fix in r76262.
llvm-svn: 76283
2009-07-18 05:02:33 +00:00
Chris Lattner be35620902 This takes a long time to crash, just disable it for now.
llvm-svn: 76263
2009-07-17 23:48:38 +00:00
Mike Stump 48871a2880 Make noreturn functions alter the CFG.
llvm-svn: 76133
2009-07-17 01:04:31 +00:00
Ted Kremenek e5a068fcb3 Update test case to use '__has_feature' macro.
llvm-svn: 76129
2009-07-17 00:19:33 +00:00
Daniel Dunbar a3f41f4bba Some more ?: for Obj-C tests.
llvm-svn: 76125
2009-07-16 23:34:22 +00:00
Fariborz Jahanian c3443a3bf3 ir-gen for --/++ operators of objc object pointers
in 32bit abi.

llvm-svn: 76109
2009-07-16 22:04:59 +00:00
Daniel Dunbar 0418a5f11e Add more testing of ?: for Obj-C object types.
llvm-svn: 76108
2009-07-16 21:55:48 +00:00
Daniel Dunbar 54091b82b5 [llvm up] Add support for '#' component of QA_OVERRIDE_GCC3_OPTIONS.
- This silences the output about how command line arguments are being changed.

llvm-svn: 76107
2009-07-16 21:32:51 +00:00
Fariborz Jahanian ca75db7c02 Diagnose ++/-- op on objc pointers in
nonfragile abi, instead of crashing.

llvm-svn: 76088
2009-07-16 17:59:14 +00:00
Chris Lattner 3afa3e1d91 codegen string literals using private linkage now like llvm-gcc, eliminating
some target hooks.

llvm-svn: 75895
2009-07-16 05:03:48 +00:00
Ted Kremenek c7b1dade86 Move RegionStoreManager over to using new
ValueManager::makeArrayIndex()/convertArrayIndex() methods.  This
handles yet another crash case when reasoning about array indices of
different bitwidth and signedness.

llvm-svn: 75884
2009-07-16 01:33:37 +00:00
Fariborz Jahanian 41136eec6b Generate error on declaration containing 'static' and '__attribute__((weak))'
Patch by Ryan Flynn

llvm-svn: 75879
2009-07-16 01:12:24 +00:00
Devang Patel 894caff444 Enable. Now the LLVM dwarfwriter does not print extra '1' prefix in symbol names (rev. 75875)
llvm-svn: 75876
2009-07-16 01:02:47 +00:00
Steve Naroff a057ba905b Avoid crashing for the enclosed test case.
This is fallout from the recent ObjCObjectPointerType rework. I'll work on fixing this tomorrow.

llvm-svn: 75870
2009-07-16 00:25:06 +00:00
Ted Kremenek d4adebbbd6 Handle some more fallout with the conversion of using PointerType for
Objective-C pointers to using ObjCObjectPointerType.

Now the checking for 'attribute ((nonnull))' in Sema doesn't emit an error when
trying to apply that attribute to a parameter that is an Objective-C pointer
(this is a regression).

To prevent this regression from occuring in the future, the 'nonnull.c' test was
moved to test/SemaObjC and renamed 'nonnull.m'. I also enhanced the tests to
show that function calls involved a NULL Objective-C pointer constant does not
trigger a warning. This is consistent with GCC, but should likely be fixed.

llvm-svn: 75856
2009-07-15 23:23:54 +00:00
Ted Kremenek f3e1e4d9a1 Fix <rdar://problem/7062158> by having BasicStoreManager model values for 'static' global variables.
llvm-svn: 75844
2009-07-15 22:09:25 +00:00
Steve Naroff 7183eefdfa Remove cast from test case (cast was incorrectly added as part of http://llvm.org/viewvc/llvm-project?view=rev&revision=75314).
Add new warnings that are being produced.

llvm-svn: 75816
2009-07-15 19:44:23 +00:00
Argyrios Kyrtzidis ed53caebda Add comments to indicate why RUN lines are below the source code.
llvm-svn: 75813
2009-07-15 18:59:40 +00:00
Steve Naroff 1329fa0ed9 Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective).
This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-).

This patch also adds Type::isObjCBuiltinType().

This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small.

llvm-svn: 75808
2009-07-15 18:40:39 +00:00
Ted Kremenek e6fea68c46 More test cases revealed that the logic in StoreManager::InvalidateRegion() needs more finesse when handling the invalidation of pointers. Pointers that were invalidated as integers could later cause problems for clients using them as pointers. It is easier for us to model a symbolic value as a pointer rather than modeling a non-symbolic value as a pointer.
This patch causes:
- StoreManager::InvalidateRegion() to not used the casted type of a region if
  it would cause a pointer type to be invalidated as a non-pointer type.
- Pushes RegionStore::RetrieveElement() further by handling retrievals from
  symbolic arrays that have been invalidated.  This uses the new SymbolDerived
  construct that was recently introduced.
  
The result is that the failing test in misc-ps-region-store-x86_64.m now passes.
Both misc-ps-region-store-x86_64.m and misc-ps-region-store-i386.m contain a
test case that motivated this change.

llvm-svn: 75730
2009-07-15 02:31:43 +00:00
Ted Kremenek 9a797db199 Split out 'test2' into an i386 and x86_64 file, illustrating how the
test behavior differs between architectures.  When this is no longer
the case, these tests will be merged.

llvm-svn: 75708
2009-07-14 23:17:22 +00:00
Ted Kremenek eea582f04f This test currently only passes for 32-bit archs.
llvm-svn: 75698
2009-07-14 22:58:18 +00:00
Devang Patel 9be7b20401 Revert 75648 for now. It is causing test failures.
llvm-svn: 75684
2009-07-14 21:31:22 +00:00
Ted Kremenek 0c37d19fea Enhance RegionStoreManager to handle 'Retrieve's from SymbolicRegions. We do this by silently wrapping the region with an ElementRegion. This fixes the failures in misc-ps-region-store.m.
llvm-svn: 75679
2009-07-14 20:48:22 +00:00
Argyrios Kyrtzidis 9cbe886cff Move the RUN lines on the same file but below the code, as suggested by Sebastian.
llvm-svn: 75608
2009-07-14 05:34:59 +00:00
Argyrios Kyrtzidis 12563b8111 Handle redeclarations properly at the index-test tool.
llvm-svn: 75605
2009-07-14 03:20:31 +00:00
Argyrios Kyrtzidis d49e8dd759 Add a C++ indexing test case, where we show the references of overloaded '+' plus signs.
Ok, this is a bit out of place since C++ support is way way off, but it was just too cool to not show it off :-)

llvm-svn: 75601
2009-07-14 03:19:46 +00:00
Argyrios Kyrtzidis 11a846ab53 Fixes for a couple of things:
- Declaration context of ParmVarDecls (that we got from the Declarator) was not their containing function.
- C++ out-of-line method definitions didn't get an access specifier.

Both were exposed by a crash when emitting a C++ method to a PCH file (assert at Decl::CheckAccessDeclContext()).

llvm-svn: 75597
2009-07-14 03:18:53 +00:00
Argyrios Kyrtzidis 2f0eff102c Handle struct fields through the index-test tool.
llvm-svn: 75596
2009-07-14 03:18:40 +00:00
Argyrios Kyrtzidis 558449bf79 Move the test input source code to a separate file.
That way we can freely add new RUN lines without having to correct the line part in all the -point-at options.

llvm-svn: 75595
2009-07-14 03:18:25 +00:00
Devang Patel d6c256696b Use LLVM mangler to get mangled name for debug info entry.
llvm-svn: 75589
2009-07-14 02:47:58 +00:00
Daniel Dunbar f5c79709bc Update debug info generation for ObjCObjectPointer changes.
- Previously this would crash on recursive types, and it was also incorrectly
   stripping off a level of indirection.
 - I'm not 100% convinced this is all correct, but it should be a monotonic
   improvment.

llvm-svn: 75582
2009-07-14 01:20:56 +00:00
Devang Patel caadf8c9dc I just revertd llvm patch.
XFAIL this for now until I prepare clang specific patch.

llvm-svn: 75575
2009-07-14 00:56:16 +00:00
Ted Kremenek c057f417d8 Add basic checking for passing NULL to CFRetain/CFRelease, since those functions
are not explicitly marked as not accepting NULL pointers. This check illustrates
how we need more refactoring in the custom-check logic.

llvm-svn: 75570
2009-07-14 00:43:42 +00:00
Ted Kremenek b63f71528e Enhance SimpleSValuator::EvalBinOpNN to recognize the trivial case
where we are comparing a symbolic value against itself, regardless of
the nature of that symbolic value.

This enhancement identified a case where RegionStoreManager is not
correctly symbolicating the values of the pointees of parameters.  The
failing test is now in 'test/Analysis/misc-ps-region-store.m', with
that test file now (temporarily) marked XFAIL.

llvm-svn: 75521
2009-07-13 21:55:12 +00:00
Devang Patel 450f266095 New testcase for rev 75503.
llvm-svn: 75504
2009-07-13 21:20:20 +00:00
Devang Patel 9c3a0188cd Update debug info type cache after fwd decl is replaced by real decl.
llvm-svn: 75473
2009-07-13 17:03:14 +00:00
Chris Lattner fb42a1820f add push/pop semantics for diagnostics. Patch by Louis Gerbarg!
llvm-svn: 75431
2009-07-12 21:18:45 +00:00
Daniel Dunbar d37908f149 Revert to using shell to find files instead of 'find', that wasn't portable.
- I think I did this commit sequence before. :)

llvm-svn: 75420
2009-07-12 19:00:20 +00:00
Daniel Dunbar 0f4736424e Stop looking for tests in the Output/ directory.
llvm-svn: 75404
2009-07-11 23:43:59 +00:00
Daniel Dunbar 619bf84ad4 The -disable-free hack didn't work...
llvm-svn: 75401
2009-07-11 23:05:12 +00:00
Daniel Dunbar 024c68b734 Force NeXT runtime for this test.
llvm-svn: 75400
2009-07-11 23:04:43 +00:00
Daniel Dunbar df1cff7356 Remove excessive use of Carbon.h / Cocoa.h in clang tests.
- These kinds of "shotgun" tests are very slow, and do not belong in the
   regression suite. If these kinds of tests are regarded to have value, they
   should be added to the LLVM test-suite.

 - I would actually like to remove all of these tests, but I left Sema/carbon.c
   and SemaObjC/cocoa.m...

llvm-svn: 75399
2009-07-11 23:03:07 +00:00
Daniel Dunbar 09bb21f80c Fix comment, and reduce computational expense of this test.
- I don't see any need for it to be this expensive.

llvm-svn: 75395
2009-07-11 22:44:48 +00:00
Daniel Dunbar cfd6800c76 Add -disable-free to this test in the hopes if having it pass on Linux for now.
llvm-svn: 75390
2009-07-11 22:00:53 +00:00
Daniel Dunbar 7e5f052772 Fix type conversion of ObjCObjectPointerType.
- Previous code was based on a misunderstanding (on my part) of the type
   representation.

llvm-svn: 75385
2009-07-11 21:12:14 +00:00
Daniel Dunbar 9d82da40ec Generate correct prototype for objc_enumerationMutation.
- This was a latent bug exposed by the recent objc type changes.

llvm-svn: 75383
2009-07-11 20:32:50 +00:00
Daniel Dunbar 631a57e30f Fix test case to match intent.
llvm-svn: 75381
2009-07-11 20:17:35 +00:00
Nuno Lopes 14ea24e422 restore proper valgrind support.
disclaim: I know nothing about Python, so apologies in advance if I break something

llvm-svn: 75368
2009-07-11 18:34:43 +00:00
Ted Kremenek da03e8443e Handle insidious corner case exposed by RegionStoreManager when handling void* values that are bound
to symbolic regions and then treated like integers.

llvm-svn: 75356
2009-07-11 04:38:49 +00:00
Zhongxing Xu e00c981feb remove duplicated test cast.
llvm-svn: 75329
2009-07-11 02:33:35 +00:00
Anders Carlsson 0d14291fbf Fix a test.
llvm-svn: 75327
2009-07-11 01:00:52 +00:00
Anders Carlsson 43171d6aeb Add another test.
llvm-svn: 75324
2009-07-11 00:55:33 +00:00
Anders Carlsson ae01993a12 Implement more of C++0x 'auto'. A variable with an auto type specifier must have an initializer. Also, move some tests around to match the C++0x draft better.
llvm-svn: 75322
2009-07-11 00:34:39 +00:00
Ted Kremenek 156700fd14 This test passes with RegionStoreManager.
llvm-svn: 75318
2009-07-11 00:07:06 +00:00
Ted Kremenek 74a7b9188a This test now passes with RegionStoreManager.
llvm-svn: 75316
2009-07-11 00:03:23 +00:00
Steve Naroff 7cae42b07a This patch includes a conceptually simple, but very intrusive/pervasive change.
The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.

This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.

By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. 

Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.

llvm-svn: 75314
2009-07-10 23:34:53 +00:00
Eli Friedman fd9b1094b8 Fix silly mistake I made applying patch to fix test.
llvm-svn: 75303
2009-07-10 22:27:56 +00:00
Ted Kremenek e057d4e5a9 Rename test file.
llvm-svn: 75297
2009-07-10 21:48:43 +00:00
Ted Kremenek 3fcf628b40 RegionStoreManager also passes this test file.
llvm-svn: 75296
2009-07-10 21:48:10 +00:00
Ted Kremenek 488495e491 RegionStoreManager now correctly passes this test file.
llvm-svn: 75295
2009-07-10 21:45:10 +00:00
Ted Kremenek 6cb2a34e3c Test case in test/Analysis/xfail_regionstore_wine_crash.c no longer fails, so
move this case to 'test/Analysis/misc-ps.m' to test with both BasicStoreManager
and RegionStoreManager.

llvm-svn: 75294
2009-07-10 21:43:30 +00:00
Anders Carlsson 7ca3f6feea Fix type of 'this' and add a decltype test.
llvm-svn: 75291
2009-07-10 21:35:09 +00:00
Ted Kremenek bf73ad47a8 Revert r75281 and simply remove the assertion in NewCastRegion that
CodeTextRegions can only be casted to FunctionPointer or BlockPointerTypes. This
simply isn't true. We can handle bogus operations on CodeTextRegions (e.g, an
array access) elsewhere.

llvm-svn: 75285
2009-07-10 21:24:45 +00:00
Ted Kremenek 6c94771a0b Fix crash in StoreManager::NewCastRegion regarding handling casts to void*,
void**, void***, etc.  Such casts should just pass the region through.

llvm-svn: 75281
2009-07-10 21:11:16 +00:00
Fariborz Jahanian 3554b5a37c Patch to build list of inherited virtual base classes
in their order of construction for each class and use it 
to to check on propery order of base class construction 
under -Wreorder option.

llvm-svn: 75270
2009-07-10 20:13:23 +00:00
Eli Friedman 7d369cd2a6 Misc fixes to fix tests on OpenBSD, per email to cfe-commits. Patches
by Jonathan Gray and Krister Walfridsson.

llvm-svn: 75268
2009-07-10 20:10:06 +00:00
Ted Kremenek f66557978e Switch BasicStoreManager to use the new CastRegion implementation by default,
and replace the 'clang-cc' option '-analyzer-store=basic-new-cast' with
'-analyzer-store=basic-old-cast'. We'll keep the old CastRegion implementation
around for a little while for regression testing.

llvm-svn: 75209
2009-07-10 00:41:58 +00:00
Fariborz Jahanian 5582f231f2 don't crash if class is using itself as its super class.
llvm-svn: 75178
2009-07-09 22:08:26 +00:00
Anders Carlsson cf1441ab20 Fix another decltype crash.
llvm-svn: 75175
2009-07-09 22:00:53 +00:00
Fariborz Jahanian 341583c3ac Sema check on out of order object initialization of
class object's base and members under -Wreorder flag.

llvm-svn: 75168
2009-07-09 19:59:47 +00:00
Anders Carlsson 17973e684d Use getDeclName in DefineImplicitOverloadedAssign as well.
llvm-svn: 75152
2009-07-09 17:47:25 +00:00
Douglas Gregor b05ce0f395 Another little test for C++ [over.over]
llvm-svn: 75151
2009-07-09 17:44:05 +00:00
Anders Carlsson 52b9180587 Pass the DeclName to the diagnostic builder so that member names will be quoted correctly.
llvm-svn: 75150
2009-07-09 17:37:12 +00:00
Douglas Gregor 6b6ba8bad8 Add test for C++ [over.over.]p1, the contexts in which one can take the address of an overloaded function.
llvm-svn: 75146
2009-07-09 17:16:51 +00:00
Anders Carlsson 03f89b1828 Store the isAddressOfOperand in the UnresolvedDeclRefExpr, so that we can pass it when instantiating the expr. Fixes another member pointer bug.
llvm-svn: 75075
2009-07-09 00:05:08 +00:00
Douglas Gregor b257e4fff8 Implement the simple form of overload resolution used when taking the
address of an overloaded function (which may involve both functions
and function templates). 

llvm-svn: 75069
2009-07-08 23:33:52 +00:00
Ted Kremenek 8ee3dd7cc5 Fix: <rdar://problem/7034511> ValueManager::makeIntVal(uint64_t X, QualType T) should return a 'Loc' when 'T' is a pointer
llvm-svn: 75062
2009-07-08 22:42:46 +00:00
Anders Carlsson 0b675f5ad5 It's not allowed to form member pointers to members that have reference type. Add a test for this and the rest of [dcl.mptr]p3.
llvm-svn: 75054
2009-07-08 21:45:58 +00:00
Douglas Gregor 9b14658713 Implement template argument deduction when taking the address of a
function template. Most of the change here is in factoring out the
common bits used for template argument deduction from a function call
and when taking the address of a function template.

llvm-svn: 75044
2009-07-08 20:55:45 +00:00
Fariborz Jahanian 8e0d04249d Patch adds test to my previous patch for assigning to
gc'able structs in the Next runtime and adds missing
PCH info.

llvm-svn: 75014
2009-07-08 16:37:44 +00:00
Douglas Gregor be759256b9 Fix a corner case with argument-dependent lookup and overloaded function sets.
llvm-svn: 74999
2009-07-08 10:57:20 +00:00
Douglas Gregor 197e5f7bb7 Improve argument-dependent lookup to find associated classes and
namespaces based on the template arguments of a class template
specialization type.

llvm-svn: 74993
2009-07-08 07:51:57 +00:00
Chris Lattner 2a7deb64c0 reimplement vector comparisons as [fi]cmp+sext instead of using v[if]cmp.
Also, enable them in sema so that they are tested, and now that the x86 backend
has stablized.

llvm-svn: 74983
2009-07-08 01:08:03 +00:00
Douglas Gregor d3cb356d14 Overload resolution prefers non-templates to templates
llvm-svn: 74971
2009-07-07 23:38:56 +00:00
Douglas Gregor e81f3e71f8 Improve template argument deduction from a call. In particular,
implement C++ [temp.deduct.call]p3b3, which allows a template-id
parameter to match a derived class of the argument, while deducing
template arguments.

llvm-svn: 74965
2009-07-07 23:09:34 +00:00
Sebastian Redl 86be854fa8 Implement checking of exception spec compatibility for overriding virtual functions.
llvm-svn: 74943
2009-07-07 20:29:57 +00:00
Anders Carlsson 1f9648da17 Some (most) type trait expressions require that the argument passed in is a complete type.
llvm-svn: 74937
2009-07-07 19:06:02 +00:00
Fariborz Jahanian 385db80cc5 Diagnose, and not crash, when taking address of property expression.
llvm-svn: 74935
2009-07-07 18:50:52 +00:00
Douglas Gregor 2074977695 Tighten up the conditions under which we build an implicit function
declaration for a builtin.

llvm-svn: 74917
2009-07-07 17:00:05 +00:00
Douglas Gregor 27821cee82 Make ASTContext explicitly keep track of the declaration for the C
FILE type, rather than using name lookup to find FILE within the
translation unit. Within precompiled headers, FILE is treated as yet
another "special type" (like __builtin_va_list).

This change should provide a performance improvement (not verified),
since the lookup into the translation unit declaration 
forces the (otherwise unneeded) construction of a large hash table.
More importantly, with precompiled headers, the construction
of that table requires deserializing most of the top-level
declarations from the precompiled header, which are then unused.

Fixes PR 4509.

llvm-svn: 74911
2009-07-07 16:35:42 +00:00
Douglas Gregor 0086a5a3bb Introduce the notion of "Relocatable" precompiled headers, which are built
with a particular system root directory and can be used with a different
system root directory when the headers it depends on have been installed.
Relocatable precompiled headers rewrite the file names of the headers used
when generating the PCH file into the corresponding file names of the 
headers available when using the PCH file.

Addresses <rdar://problem/7001604>.

llvm-svn: 74885
2009-07-07 00:12:59 +00:00
Ted Kremenek 97213bac53 NewCastRegion: Handle casts *from* pointers to incomplete structs to other types.
llvm-svn: 74884
2009-07-06 23:47:19 +00:00
Ted Kremenek c5ab3a0eab StoreManager::NewCastRegion:
- Refactor logic that creates ElementRegions into a help method 'MakeElementRegion'.
- Fix crash due to not handling StringRegions.  Casts of StringRegions now
  result in a new ElementRegion layered on the original StringRegion.

llvm-svn: 74867
2009-07-06 22:23:45 +00:00
Ted Kremenek eea8c29aa3 Make 'BasicStoreManager' + 'NewCastRegion' testable from the command line using '-analyzer-store=basic-new-cast'.
llvm-svn: 74865
2009-07-06 21:58:46 +00:00
Douglas Gregor e64c196868 Fix a problem with false diagnostics when comparing distinct NULL pointer types, from David Majnemer
llvm-svn: 74850
2009-07-06 20:14:23 +00:00
Douglas Gregor 1342e84c17 Fix PR 4489, a crash in PCH loading that occurs when loading the name
of a top-level declaration loads another top-level declaration of the
same name whose type depends on the first declaration having been
completed. This commit breaks the circular dependency by delaying
loads of top-level declarations triggered by loading a name until we
are no longer recursively loading types or declarations.

llvm-svn: 74847
2009-07-06 18:54:52 +00:00
Ted Kremenek 0578e43862 Fix <rdar://problem/7033733>. The CF_RETURNS_RETAINED attribute should work if the return type on an Objective-C method is a CF type reference, not just an Objective-C object reference.
llvm-svn: 74841
2009-07-06 18:30:43 +00:00
Douglas Gregor dce892e128 Parsing fix for out-of-line constructors, from Piotr Rak
llvm-svn: 74833
2009-07-06 16:40:48 +00:00
Douglas Gregor 9d243d47dd Fix out-of-source regression testing for makefiles
llvm-svn: 74832
2009-07-06 16:35:57 +00:00
Douglas Gregor 19623dc075 Fix bitfield promotion in the presence of explicit casts, from Abrama Bagnara.
llvm-svn: 74830
2009-07-06 15:38:40 +00:00
Argyrios Kyrtzidis 1561c6cf54 Having tests that depend on previously created files is bad idea. Fix them to be self-sufficient.
llvm-svn: 74810
2009-07-06 00:03:47 +00:00
Eli Friedman c131d3b5a2 Fix for PR4502: add calculation of the integer conversion rank for
wchar_t.

llvm-svn: 74808
2009-07-05 23:44:27 +00:00
Argyrios Kyrtzidis 5641111e3f Make use of the Index library through the index-test tool.
'index-test' is now able to provide additional info for a Decl, through multiple AST files:
-Find declarations
-Find definitions
-Find references

llvm-svn: 74803
2009-07-05 22:22:35 +00:00
Sebastian Redl 4f4d7b5d8e Catch function redeclarations with incompatible exception specifications.
llvm-svn: 74787
2009-07-04 11:39:00 +00:00
Zhongxing Xu 9988bab609 add test case for r74407.
llvm-svn: 74761
2009-07-03 05:33:23 +00:00
Ted Kremenek 0b0f206efa Fix a horrible CFG bug reported in <rdar://problem/7027684>. The wrong successor
block would get hooked up in some cases when processing empty compound
statements.

llvm-svn: 74743
2009-07-03 00:10:50 +00:00
Ted Kremenek 725b4a3a51 Enhance RegionStore to lazily symbolicate fields and array elements for
structures passed-by-value as function arguments.

llvm-svn: 74729
2009-07-02 22:02:15 +00:00
Ted Kremenek 71bf4264bf Fix RUN line so this test doesn't hang.
llvm-svn: 74719
2009-07-02 18:44:31 +00:00
Douglas Gregor c6d5edd2ed Add support for retrieving the Doxygen comment associated with a given
declaration in the AST. 

The new ASTContext::getCommentForDecl function searches for a comment
that is attached to the given declaration, and returns that comment, 
which may be composed of several comment blocks.

Comments are always available in an AST. However, to avoid harming
performance, we don't actually parse the comments. Rather, we keep the
source ranges of all of the comments within a large, sorted vector,
then lazily extract comments via a binary search in that vector only
when needed (which never occurs in a "normal" compile).

Comments are written to a precompiled header/AST file as a blob of
source ranges. That blob is only lazily loaded when one requests a
comment for a declaration (this never occurs in a "normal" compile). 

The indexer testbed now supports comment extraction. When the
-point-at location points to a declaration with a Doxygen-style
comment, the indexer testbed prints the associated comment
block(s). See test/Index/comments.c for an example.

Some notes:
  - We don't actually attempt to parse the comment blocks themselves,
  beyond identifying them as Doxygen comment blocks to associate them
  with a declaration.
  - We won't find comment blocks that aren't adjacent to the
  declaration, because we start our search based on the location of
  the declaration.
  - We don't go through the necessary hops to find, for example,
  whether some redeclaration of a declaration has comments when our
  current declaration does not. Similarly, we don't attempt to
  associate a \param Foo marker in a function body comment with the
  parameter named Foo (although that is certainly possible).
  - Verification of my "no performance impact" claims is still "to be
  done".

llvm-svn: 74704
2009-07-02 17:08:52 +00:00
Douglas Gregor e4d00dd7f6 Fix PR 4489, a PCH crash during de-serialization.
llvm-svn: 74664
2009-07-01 23:29:14 +00:00
Ted Kremenek a8a295f2d9 Temporarily disable RegionStore for stack-addr-ps.c, as a new test case reveals
a case where RegionStore doesn't create symbolic values for the fields of
structs that are passed-by-value.

llvm-svn: 74662
2009-07-01 23:24:11 +00:00
Ted Kremenek 55e07efeed Add a FIXME to RegionStore, do some minor code cleanup, and get RegionStore to
pass misc-ps.m. Currently RegionStore/BasicStore don't do any special reasoning
about clang-style vectors, so we should return UnknownVal (in all cases) when
accessing their values via an array.

llvm-svn: 74660
2009-07-01 23:19:52 +00:00
Douglas Gregor ff6cbdf806 Keep track of more information within the template instantiation stack, e.g.,
by distinguishing between substitution that occurs for template
argument deduction vs. explicitly-specifiad template arguments. This
is used both to improve diagnostics and to make sure we only provide
SFINAE in those cases where SFINAE should apply.

In addition, deal with the sticky issue where SFINAE only considers
substitution of template arguments into the *type* of a function
template; we need to issue hard errors beyond this point, as
test/SemaTemplate/operator-template.cpp illustrates.

llvm-svn: 74651
2009-07-01 22:01:06 +00:00
Fariborz Jahanian c1fc3ec878 Patch to implement template types in ctor-initializer list.
Also has fix for bugzilla-4469.

llvm-svn: 74631
2009-07-01 19:21:19 +00:00
Douglas Gregor e3f1f350ff Cope with explicitly-specified function template arguments when there
are fewer template arguments than there are template parameters for
that function.

llvm-svn: 74578
2009-07-01 00:28:38 +00:00
Douglas Gregor 89026b5018 When explicit template arguments are provided for a function call,
substitute those template arguments into the function parameter types
prior to template argument deduction. There's still a bit of work to
do to make this work properly when only some of the template arguments
are specified.

llvm-svn: 74576
2009-06-30 23:57:56 +00:00
Fariborz Jahanian 302bb6661f Patch to support optional nested-name-specifier in in ctor-initializer
list.

llvm-svn: 74571
2009-06-30 23:26:25 +00:00
Douglas Gregor a727cb98a4 Preliminary parsing and ASTs for template-ids that refer to function
templates, such as make<int&>. These template-ids are only barely
functional for function calls; much more to come.

llvm-svn: 74563
2009-06-30 22:34:41 +00:00
Fariborz Jahanian cae5482f6c Diagnose multiple initialization of anonymous union
fields in the ctor-initializer list.

llvm-svn: 74554
2009-06-30 21:52:59 +00:00
Fariborz Jahanian 7baa71e2dd More diagnostics related to initialization of direct bases
in ctor-initializer list.

llvm-svn: 74541
2009-06-30 17:34:52 +00:00
Douglas Gregor dda7ced32e When recursively instantiating function templates, keep track of the
instantiation stack so that we provide a full instantiation
backtrace. Previously, we performed all of the instantiations implied
by the recursion, but each looked like a "top-level" instantiation.

The included test case tests the previous fix for the instantiation of
DeclRefExprs. Note that the "instantiated from" diagnostics still
don't tell us which template arguments we're instantiating with.

llvm-svn: 74540
2009-06-30 17:20:14 +00:00
Douglas Gregor 18d6945650 Update C++ section data and directory structure to reflect N2914
llvm-svn: 74535
2009-06-30 16:45:27 +00:00
Zhongxing Xu e205d43c75 When retrieving element region, if its super region has binding, return
unknown for it.

Mark the super region of a live region as live, if the live region is pointed
to by a live pointer variable.

These fixes xfail_regionstore_wine_crash.c.

llvm-svn: 74524
2009-06-30 12:32:59 +00:00
Chris Lattner d466ea1b08 Implement PR4175, catching some questionable comparisons. Patch by
David Majnemer!

llvm-svn: 74513
2009-06-30 06:24:05 +00:00
Anders Carlsson 124f34c150 Make an error message more clear.
llvm-svn: 74481
2009-06-30 00:06:57 +00:00
Fariborz Jahanian 651185bf47 A more detailed diagnosis of ill-formed ctor-initializer
list.

llvm-svn: 74480
2009-06-30 00:02:17 +00:00
Anders Carlsson 074a18a8fd Improvements to decltype. We now don't crash anymore when the expr is an overloaded function decl.
llvm-svn: 74472
2009-06-29 22:58:55 +00:00
Douglas Gregor e8925dbc1d Improve code generation for function template specializations:
- Track implicit instantiations vs. the not-yet-supported explicit
  specializations
  - Give implicit instantiations of function templates (and member
  functions of class templates) linkonce_odr linkage.
  - Improve name mangling for function template specializations,
  including the template arguments of the instantiation and the return
  type of the function.

Note that our name-mangling is improved, but not correct: we still
don't mangle substitutions, although the manglings we produce can be
demangled.

llvm-svn: 74466
2009-06-29 22:39:32 +00:00
Fariborz Jahanian 2be8bf44cd Diagnose multiple initialzation of data-member/base
in the ctor-initializer list. More to come.

llvm-svn: 74465
2009-06-29 22:33:26 +00:00
Douglas Gregor 8f5d4423ca Keep track of function template specializations, to eliminate
redundant, implicit instantiations of function templates and provide a
place where we can hang function template specializations.

llvm-svn: 74454
2009-06-29 20:59:39 +00:00
Daniel Dunbar 10de9e6602 OpenBSD support.
- Patch by Jonathan Gray!

llvm-svn: 74453
2009-06-29 20:52:51 +00:00
Zhongxing Xu 4744d560b8 Invalidate the alloca region by setting its default value to conjured symbol.
llvm-svn: 74419
2009-06-29 06:43:40 +00:00
Anders Carlsson b012ca92ac Move the check for vprintf* functions inside of SemaCheckStringLiteral. Fixes PR4470.
llvm-svn: 74413
2009-06-28 19:55:58 +00:00
Chris Lattner 877a48e67a make these tests pass with the stack canary stuff even on targets where they default to on.
llvm-svn: 74412
2009-06-28 19:49:49 +00:00
Zhongxing Xu 55e070031f Now this test case passes.
llvm-svn: 74410
2009-06-28 14:25:10 +00:00
Zhongxing Xu 6f610707cf Invalidate a field of struct type by setting its default value to conjured
symbol.

llvm-svn: 74408
2009-06-28 13:59:24 +00:00
Bill Wendling d63bbadbef Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.

llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Nate Begeman bd956c4290 OpenCL 1.0 support:
Handle rules for ExtVector + ExtVector and ExtVector + Scalar operations. 
Fix problem Eli noticed where we were allowing pointer types to be splatted to
vector elements.

llvm-svn: 74404
2009-06-28 02:36:38 +00:00
Douglas Gregor 15448f8d23 Improve support for overloaded operator templates.
llvm-svn: 74390
2009-06-27 21:05:07 +00:00
Eli Friedman 5e774b1333 Fix the parser error hanlding for __builtin_offsetof to actually print
out an error for a malformed __builtin_offsetof.

llvm-svn: 74388
2009-06-27 20:38:33 +00:00
Eli Friedman 173e0b7a96 Fix a bogus error overloading an operator where the only class
parameter has a dependent type.

llvm-svn: 74380
2009-06-27 05:59:59 +00:00
Anders Carlsson f0a7f3b089 Implement support for the format_arg attribute. Fixes PR4442.
llvm-svn: 74369
2009-06-27 04:05:33 +00:00
Anders Carlsson 74d7f0dd65 Make it possible for using decls to point to operators. Fixes PR4441.
llvm-svn: 74362
2009-06-27 00:27:47 +00:00
Douglas Gregor cf0b47d179 During template argument deduction from a function call, allow
deduction from pointer and pointer-to-member types to work even in the
presence of a qualification conversion (C++ [temp.deduct.type]p3
bullet 2). 

llvm-svn: 74354
2009-06-26 23:10:12 +00:00
Anders Carlsson 94ff77a356 More auto work.
llvm-svn: 74339
2009-06-26 22:18:59 +00:00
Anders Carlsson f82bb6b4ed Fix test.
llvm-svn: 74335
2009-06-26 21:54:43 +00:00
Douglas Gregor febe45a727 A little template argument deduction test uncovered an "oops". As part
of template instantiation, we were dropping cv-qualifiers on the
instantiated type in a few places. This change reshuffles the
type-instantiation code a little bit so that there's a single place
where we add qualifiers to the instantiated type, so that we won't end
up with this same bug in the future.

llvm-svn: 74331
2009-06-26 21:40:05 +00:00
Douglas Gregor 705c900d23 Template argument deduction is no longer responsible for checking
non-dependent parameter types. Instead, class template partial
specializations perform a final check of all of the instantiated
arguments. This model is cleaner, and works better for function
templates where the "final check" occurs during overload resolution.

Also, cope with cv-qualifiers when the parameter type was originally a
reference type, so that the deduced argument can be more qualified
than the transformed argument.

llvm-svn: 74323
2009-06-26 20:57:09 +00:00
Anders Carlsson 6bd992d1c3 Can't have arrays of auto.
llvm-svn: 74314
2009-06-26 19:33:28 +00:00
Anders Carlsson 364035d1a8 An auto variable can't appear in its own initializer.
llvm-svn: 74312
2009-06-26 19:16:07 +00:00
Anders Carlsson 082acded44 Implement enough of the 'auto' keyword so we can claim to support N2546.
llvm-svn: 74307
2009-06-26 18:41:36 +00:00
Devang Patel 0d425350b2 Revrt PR4228 fix for now.
llvm-svn: 74304
2009-06-26 18:32:22 +00:00
Douglas Gregor cceb97559e Improve template argument deduction for reference parameters when
deducing template arguments from a function call. Plus, add a bunch of
tests.

llvm-svn: 74301
2009-06-26 18:27:22 +00:00
Nate Begeman 2ffd384441 OpenCL 1.0 Support:
Add support for scalar to vector and partially initialized vector constant initializers. 

llvm-svn: 74299
2009-06-26 18:22:18 +00:00
Chris Lattner d86a13e02e Improve error recovery in C++: when we hit 'implicit int' cases in C++,
these are usually because the parser was thoroughly confused.  In addition
to typing the value being declared as an int and hoping for the best, we
mark the value as invalid so we don't get chains of errors when it is
used downstream.  In C, implicit int actually is valid, so typing the thing
as int is good and marking it invalid is bad. :)

llvm-svn: 74266
2009-06-26 04:45:06 +00:00
Chris Lattner 5558e9fc55 fix PR4452, a crash on invalid. The error recovery is still terrible in this case
but at least we don't crash :)

llvm-svn: 74264
2009-06-26 04:27:47 +00:00
Anders Carlsson 5f212cbb73 Fix another assert related to using decls.
llvm-svn: 74262
2009-06-26 03:54:13 +00:00
Anders Carlsson 8d0f6b7c87 When creating LookupResults, see through UsingDecls. Fixes PR4450.
llvm-svn: 74258
2009-06-26 03:37:05 +00:00
Anders Carlsson 5140b3c4a6 Fix PR4448.
llvm-svn: 74257
2009-06-26 03:02:18 +00:00
Nate Begeman c69b740df4 OpenCL 1.0 support: explicit casts to ext-vector types
llvm-svn: 74247
2009-06-26 00:50:28 +00:00
Douglas Gregor 4adbc6d947 Implicit instantiation for function template specializations.
For a FunctionDecl that has been instantiated due to template argument
deduction, we now store the primary template from which it was
instantiated and the deduced template arguments. From this
information, we can instantiate the body of the function template.

llvm-svn: 74232
2009-06-26 00:10:03 +00:00
Ted Kremenek 1642bdaaa5 Introduce a new concept to the static analyzer: SValuator.
GRTransferFuncs had the conflated role of both constructing SVals (symbolic
expressions) as well as handling checker-specific logic. Now SValuator has the
role of constructing SVals from expressions and GRTransferFuncs just handles
checker-specific logic. The motivation is by separating these two concepts we
will be able to much more easily create richer constraint-generating logic
without coupling it to the main checker transfer function logic.

We now have one implementation of SValuator: SimpleSValuator.

SimpleSValuator is essentially the SVal-related logic that was in GRSimpleVals
(which is removed in this patch). This includes the logic for EvalBinOp,
EvalCast, etc. Because SValuator has a narrower role than the old
GRTransferFuncs, the interfaces are much simpler, and so is the implementation
of SimpleSValuator compared to GRSimpleVals. I also did a line-by-line review of
SVal-related logic in GRSimpleVals and cleaned it up while moving it over to
SimpleSValuator.

As a consequence of removing GRSimpleVals, there is no longer a
'-checker-simple' option. The '-checker-cfref' did everything that option did
but also ran the retain/release checker. Of course a user may not always wish to
run the retain/release checker, nor do we wish core analysis logic buried in the
checker-specific logic. The next step is to refactor the logic in CFRefCount.cpp
to separate out these pieces into the core analysis engine.

llvm-svn: 74229
2009-06-26 00:05:51 +00:00
Fariborz Jahanian a158e018d4 Test case for my last patch.
llvm-svn: 74216
2009-06-25 22:40:36 +00:00
Douglas Gregor ad3f2fcf43 Improved semantic analysis and AST respresentation for function
templates.

For example, this now type-checks (but does not instantiate the body
of deref<int>):

  template<typename T> T& deref(T* t) { return *t; }

  void test(int *ip) {
    int &ir = deref(ip);
  }

Specific changes/additions:
  * Template argument deduction from a call to a function template.
  * Instantiation of a function template specializations (just the
  declarations) from the template arguments deduced from a call.
  * FunctionTemplateDecls are stored directly in declaration contexts
  and found via name lookup (all forms), rather than finding the
  FunctionDecl and then realizing it is a template. This is
  responsible for most of the churn, since some of the core
  declaration matching and lookup code assumes that all functions are
  FunctionDecls.

llvm-svn: 74213
2009-06-25 22:08:12 +00:00
Nate Begeman 0359e12208 OpenCL 1.0 Support, patch 1/N: upper case swizzle operator and hex element index.
llvm-svn: 74202
2009-06-25 21:06:09 +00:00
Argyrios Kyrtzidis 92772215af Introduce tools/index-test.
This tool will be the test bed for indexing related operations. It basically reads PCH files passed by the command line and performs various operations.

Currently it can accept a file:line:column which resolves to a declaration/statement and displays some information about them.

llvm-svn: 74198
2009-06-25 18:22:52 +00:00
Anders Carlsson 7d209570b6 Decltype needs to have a dependent type if the expr passed to it is type dependent. Fixes PR4444.
llvm-svn: 74175
2009-06-25 15:00:34 +00:00
Anders Carlsson ad6bd35b46 C++ decltype support (N2343)
llvm-svn: 74118
2009-06-24 21:24:56 +00:00
Fariborz Jahanian 6e9e4f3436 Fix a clang crash caused by incorrect user code.
llvm-svn: 74080
2009-06-24 17:00:18 +00:00
Douglas Gregor 23061ded56 Implement matching of function templates, so that one can declare overloaded function templates. C++ [temp.over.link] paragraphs 4-8.
llvm-svn: 74079
2009-06-24 16:50:40 +00:00
Anders Carlsson 9e47af8b59 Add test for [class.local]p2.
llvm-svn: 74051
2009-06-24 02:00:28 +00:00
Douglas Gregor 17a7c1297a Make sure that the template parameter lists get from the parser down to ActOnFunctionDeclarator for function template definitions
llvm-svn: 74040
2009-06-24 00:54:41 +00:00
Anders Carlsson 829574edab Add test for [class.nested.type]p1
llvm-svn: 74033
2009-06-24 00:30:37 +00:00
Anders Carlsson d2e8adfc75 Support for [class.local]p4.
llvm-svn: 74030
2009-06-24 00:28:53 +00:00
Anders Carlsson 946b86d91a [class.local] p1 and p3. Also, add back the xcodeproj file.
llvm-svn: 74027
2009-06-24 00:10:43 +00:00
Douglas Gregor b52fabb2a8 Start propagating template parameter lists to the right places to
handle function templates. There's no actual code for function
templates yet, but at least we complain about typedef templates.

llvm-svn: 74021
2009-06-23 23:11:28 +00:00
Fariborz Jahanian 248c719a68 Patch fixes an obscure bug when 'used' attribute is applied to
variables in ObjC's Next runtime mode. Next runtime also implicitly applies
'used' attribute on some of its meta-data. This results in two 
'llvm.used' arrays to be generated, and one of them is renamed to
'llvm.used1'.

llvm-svn: 74008
2009-06-23 21:47:46 +00:00
Douglas Gregor 6127ca4561 Make sure that argument-dependent lookup looks into the global scope
when it should.

llvm-svn: 73992
2009-06-23 20:14:09 +00:00
Douglas Gregor 2b154f41f2 Add a test illustrating our current inability to properly cope with the point of instantation of a member function of a class template specialization
llvm-svn: 73956
2009-06-23 15:45:29 +00:00
Douglas Gregor 7ee2be46a6 New test for when the subexpressions within a typeid are potentially evaluated. We seem to be the only ones to get this right.
llvm-svn: 73955
2009-06-23 15:32:13 +00:00
Chris Lattner 4c8da96ea9 fix PR4423.
llvm-svn: 73938
2009-06-23 01:38:41 +00:00
Douglas Gregor 412190b067 Some semantic tests for implicit instantiations
llvm-svn: 73924
2009-06-22 23:57:29 +00:00
Douglas Gregor 71a5718f2d Robustify a bunch of C++-related declaration actions.
llvm-svn: 73918
2009-06-22 23:20:33 +00:00
Douglas Gregor 77b50e1126 Implement implicit instantiation of the member functions of a class template
specialization. At present, all implicit instantiations occur at the
end of the translation unit.

llvm-svn: 73915
2009-06-22 23:06:13 +00:00
Fariborz Jahanian 246219bc9f Fixed text of a diagnostics.
llvm-svn: 73885
2009-06-22 16:33:37 +00:00
Zhongxing Xu 540c009fbe Return UnknownVal for pointer arithmetic on struct fields.
llvm-svn: 73851
2009-06-21 13:24:24 +00:00
Fariborz Jahanian 1c9d5d956c Made improvements in c++'s object model patch on Doug's review.
llvm-svn: 73833
2009-06-20 20:23:38 +00:00
Douglas Gregor fec52635f0 Parsing and AST support for using declarations, from John Thompson!
llvm-svn: 73812
2009-06-20 00:51:54 +00:00
Douglas Gregor 6fa36b4246 Add -fblocks
llvm-svn: 73804
2009-06-20 00:29:46 +00:00
Douglas Gregor c9c02ed8f4 Keep track of when declarations are "used" according to C and
C++. This logic is required to trigger implicit instantiation of
function templates and member functions of class templates, which will
be implemented separately.

This commit includes support for -Wunused-parameter, printing warnings
for named parameters that are not used within a function/Objective-C
method/block. Fixes <rdar://problem/6505209>.

llvm-svn: 73797
2009-06-19 23:52:42 +00:00
Fariborz Jahanian 3fd7310d70 Use QualType to represent block's implicit return type as
to not lose its 'const/volatile' qualifier.

llvm-svn: 73795
2009-06-19 23:37:08 +00:00
Fariborz Jahanian 423a81f259 Patch for implementation of C++'s object model. This is
work in progress.

llvm-svn: 73782
2009-06-19 19:55:27 +00:00
Zhongxing Xu 54fb536b5c A further step of r73690: associate the cast-to type with the created symbol,
because the type of the symbol is used to create the default range. We need the
sign to be consistent.

llvm-svn: 73756
2009-06-19 06:00:32 +00:00