Commit Graph

14601 Commits

Author SHA1 Message Date
Anders Carlsson f55922b8b8 Set field info for unions.
llvm-svn: 76856
2009-07-23 04:59:05 +00:00
Anders Carlsson 718a89a501 Use arrays as union padding. Also, since the resulting struct will always contain a single element and either a single i8 element or an array of i8s, there's no reason to use a packed struct.
llvm-svn: 76854
2009-07-23 04:50:01 +00:00
Daniel Dunbar 8e31e77fd8 Revert r76831, there are many Analyzer test failures on multiple platforms.
--- Reverse-merging r76831 into '.':
U    include/clang/Analysis/PathSensitive/GRExprEngine.h
U    lib/Analysis/GRExprEngine.cpp

llvm-svn: 76851
2009-07-23 04:41:06 +00:00
Anders Carlsson f814ee6003 Handle zero width bit fields in unions correctly (by ignoring them).
llvm-svn: 76847
2009-07-23 04:00:39 +00:00
Anders Carlsson 697f65943d Implement union layout support.
llvm-svn: 76846
2009-07-23 03:43:54 +00:00
Anders Carlsson 307846fe67 Check in CGRecordLayoutBuilder which is a reimplementation of the record layout code. (Yay, no more packed structs unless absolutely necessary). We currently don't use the layouts being built but that will change when the new code is mature enough :)
llvm-svn: 76845
2009-07-23 03:17:50 +00:00
Daniel Dunbar a244814e6f These IRgen improvements have been done.
Technically we could still do a bit more to avoid deferred generation of statics
which we know are used, but I seriously doubt this is important.

llvm-svn: 76844
2009-07-23 03:03:07 +00:00
Ted Kremenek c5b4c0ec64 Add initial implementation of checking for uses of floating point as a loop counter.
llvm-svn: 76833
2009-07-23 01:07:19 +00:00
Ted Kremenek 4cd5577cdf Add instance predicate method to match static method.
llvm-svn: 76832
2009-07-23 01:06:10 +00:00
Ted Kremenek 5939402e2c Add 'previsit' Checker pass for ObjCMessageExprs.
llvm-svn: 76831
2009-07-23 01:05:31 +00:00
Steve Naroff 8e6aee5821 Remove a bunch of FIXME's related to ObjC type checking.
- Move Sema::ObjCQualifiedIdTypesAreCompatible(), Sema::QualifiedIdConformsQualifiedId(), and a couple helper functions to ASTContext.
- Change ASTContext::canAssignObjCInterfaces() to use ASTContext:: ObjCQualifiedIdTypesAreCompatible(). 
- Tweak several test cases to accommodate the new/improved type checking.

llvm-svn: 76830
2009-07-23 01:01:38 +00:00
Fariborz Jahanian 0228bc1a41 Add constructor used to initialize base/member in
CXXBaseOrMemberInitializer AST node. Needed by
its clients to do the initialization.

llvm-svn: 76826
2009-07-23 00:42:24 +00:00
Mike Stump 671cc00ce1 Fix case, apparently some people still build on case sensitive
filesystems.

llvm-svn: 76824
2009-07-23 00:20:25 +00:00
Mike Stump 33979f75a0 Add warning for falling off the end of a function that should return a
value.  This is on by default, and controlled by -Wreturn-type (-Wmost
-Wall).  I believe there should be very few false positives, though
the most interesting case would be:

  int() { bar(); }

when bar does:

  bar() { while (1) ; }

Here, we assume functions return, unless they are marked with the
noreturn attribute.  I can envision a fixit note for functions that
never return normally that don't have a noreturn attribute to add a
noreturn attribute.

If anyone spots other false positives, let me know!

llvm-svn: 76821
2009-07-22 23:56:57 +00:00
Douglas Gregor e93e46c690 Implement support for out-of-line definitions of the class members of class
templates, e.g.,

  template<typename T>
  struct Outer {
    struct Inner;
  };

  template<typename T>
  struct Outer<T>::Inner {
    // ...
  };

Implementing this feature required some extensions to ActOnTag, which
now takes a set of template parameter lists, and is the precursor to
removing the ActOnClassTemplate function from the parser Action
interface. The reason for this approach is simple: the parser cannot
tell the difference between a class template definition and the
definition of a member of a class template; both have template
parameter lists, and semantic analysis determines what that template
parameter list means.

There is still some cleanup to do with ActOnTag and
ActOnClassTemplate. This commit provides the basic functionality we
need, however.

llvm-svn: 76820
2009-07-22 23:48:44 +00:00
Eli Friedman f32f0a7146 Fix test breakage.
llvm-svn: 76816
2009-07-22 23:24:42 +00:00
Argyrios Kyrtzidis 3a24c4aa00 Change Preprocessor to keep a copy of LangOptions instead of reference, like ASTContext.
Now when creating a Preprocessor we can pass it a temporary LangOptions object instead of having to remember to keep it around.

llvm-svn: 76815
2009-07-22 23:13:42 +00:00
Mike Stump 8dd1b6bd10 Improve CFG support for C++ throw expressions.
llvm-svn: 76814
2009-07-22 22:56:04 +00:00
Mike Stump 24cbfc370b Prep for new warning.
llvm-svn: 76813
2009-07-22 22:55:09 +00:00
Ted Kremenek bfd28fd596 Refactor 'PostStmt' and 'PreStmt' to subclass a common parent 'StmtPoint'.
Educate GRExprEngine::VisitGraph() about 'PreStmt'.

Mark the constructor of 'PostStmt' to be explicit, preventing implicit
conversions and the selection of the wrong 'generateNode' method in
GRStmtNodeBuilder.

Constify a bunch of arguments, which falls out of the changes to ProgramPoint.

llvm-svn: 76809
2009-07-22 22:35:28 +00:00
Eli Friedman 6aea57560f Slight code reorganization to allow instantiating post-inc/dec.
llvm-svn: 76807
2009-07-22 22:25:00 +00:00
Douglas Gregor 1a7ba62e3a Calls to Sema::MatchTemplateParametersToScopeSpecifier should not depend on the order of evaluation of their arguments to be correct.
llvm-svn: 76804
2009-07-22 22:05:02 +00:00
Ted Kremenek b8725e2099 Use SaveAndRestore in 'clang/Analysis/Support/SaveAndRestore.h'
llvm-svn: 76800
2009-07-22 21:52:10 +00:00
Ted Kremenek 5b9b066aeb Add AssumeDual method.
llvm-svn: 76798
2009-07-22 21:51:00 +00:00
Ted Kremenek 915c351496 Migrate the path-sensitive checking of 'nonnull' arguments over to the new
'Checker' interface. An updated test case illustrates that after calling a
function with the 'nonnull' attribute we now register the fact that the passed
pointer must be non-null. This retention of information was not possible with
the previously used GRSimpleAPICheck interface.

llvm-svn: 76797
2009-07-22 21:46:56 +00:00
Eli Friedman 3af2a77717 Fix the parsing of default arguments for inline member function
definitions.

I'm not very familiar with this code, so please review.

llvm-svn: 76796
2009-07-22 21:45:50 +00:00
Ted Kremenek b1c170e64b Make 'SaveAndRestore' and friends reusable classes in libAnalysis.
llvm-svn: 76795
2009-07-22 21:45:16 +00:00
Ted Kremenek 49513ccaec Add support for registering 'Checker' objects with GRExprEngine.
Add a 'previsit' stage (that dispatches to registered Checkers) when evaluating the effects of CallExprs.

llvm-svn: 76794
2009-07-22 21:43:51 +00:00
Ted Kremenek 63fc4352b6 Add new 'Checker' and 'CheckerVisitor' classes, which represent a more powerful
interface to plug in domain-specific checker logic than the current
GRSimpleAPICheck interface. The new 'Checker' interface can actually generate
new nodes, allowing it to modify the state and refine the analysis (which
GRSimpleAPIChecks could not).

llvm-svn: 76793
2009-07-22 21:42:34 +00:00
Ted Kremenek 2776079844 Add support for 'PreStmt' program points to GRCoreEngine and GRStmtNodeBuilder.
llvm-svn: 76792
2009-07-22 21:40:46 +00:00
Ted Kremenek 8a2cb9cede Add 'PreStmt' program point. This will be used to represent checking for
preconditions (in GRExprEngine) before the statement itself is evaluated.

llvm-svn: 76791
2009-07-22 21:39:25 +00:00
Ted Kremenek 0af7e85bf7 Implement operator= for ExplodedNodeSet.
llvm-svn: 76790
2009-07-22 21:38:15 +00:00
Douglas Gregor d6605dbbc0 Fix the problems with template argument deduction and array types for
real. It turns out that we need to actually move all of the qualifiers
up to the array type itself, then recanonicalize the deduced template
argument type.

llvm-svn: 76788
2009-07-22 21:30:48 +00:00
Mike Stump aa19375206 Make -Wreturn-type be part of -Wmost and therefore -Wall.
llvm-svn: 76784
2009-07-22 21:00:27 +00:00
Douglas Gregor b77af8f4aa Fix some memory allocation/deallocation issues
llvm-svn: 76783
2009-07-22 20:55:49 +00:00
Eli Friedman 2729132ec3 Fix a nasty little use-after-free bug.
llvm-svn: 76779
2009-07-22 20:29:16 +00:00
Douglas Gregor 7ac44f4cfb Canonicalize the types produced by template argument deduction.
llvm-svn: 76777
2009-07-22 20:25:36 +00:00
Fariborz Jahanian f87fbc058d Improved on performance of the algorithm for proper ordering of
ctor's initialization of bases and fields.

llvm-svn: 76776
2009-07-22 20:25:00 +00:00
Douglas Gregor b3a1fdc363 Slighty more testing for template argument deduction with array arguments
llvm-svn: 76774
2009-07-22 20:07:21 +00:00
Douglas Gregor 6045482792 Improve template argument deduction for array types, so that a parameter
const T

can be matched with, e.g.,

  volatile int [5]

llvm-svn: 76773
2009-07-22 20:02:25 +00:00
Mike Stump af6ab88979 Prep for new warning.
llvm-svn: 76772
2009-07-22 20:02:03 +00:00
Mike Stump 212005c1b4 Use isa instead of dyn_cast for conditionals.
llvm-svn: 76771
2009-07-22 18:58:19 +00:00
Devang Patel 06cceef545 Use DICompositeType->replaceAllUsesWith().
This requires llvm rev. 76769 or higher.

llvm-svn: 76770
2009-07-22 18:57:00 +00:00
Douglas Gregor 8a27391190 "This patch implements the restrictions on union members detailed in
[class.union]p1", from John McCall!

llvm-svn: 76766
2009-07-22 18:25:24 +00:00
Ted Kremenek f1282074c3 Move bug reporter "visitors" to their own file and make them part of the public
BugReporter API.  No real functionality change.

llvm-svn: 76760
2009-07-22 17:55:28 +00:00
Fariborz Jahanian 5c14ec30cd Allocate BaseOrMemberInitializers and CXXBaseSpecifier nodes
via ASTContext.

llvm-svn: 76758
2009-07-22 17:41:53 +00:00
Douglas Gregor b09f3d82cc Implement parsing and semantic analysis for out-of-line definitions of static
data members of class templates. We don't instantiate the definitions yet,
however.

llvm-svn: 76756
2009-07-22 17:18:37 +00:00
Steve Naroff 3de6b70730 Fix a couple recent ABI regressions noticed during code review (fallout from the ObjC type system rewrite).
It's unfortunate that the mangling includes the low-level structs. Nevertheless, we need this for binary compatibility with GCC.

llvm-svn: 76755
2009-07-22 17:14:51 +00:00
Eli Friedman 5173349565 Switch some functions from using x86 builtins to using vector
operations.

llvm-svn: 76753
2009-07-22 17:08:01 +00:00
Mike Stump 7a5eaf6dd4 Add some documentation, to make it so the next person doens't select
the wrong function.  :-)

llvm-svn: 76752
2009-07-22 16:55:20 +00:00