Commit Graph

7409 Commits

Author SHA1 Message Date
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
Mike Stump 8dd1b6bd10 Improve CFG support for C++ throw expressions.
llvm-svn: 76814
2009-07-22 22:56:04 +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 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 2776079844 Add support for 'PreStmt' program points to GRCoreEngine and GRStmtNodeBuilder.
llvm-svn: 76792
2009-07-22 21:40:46 +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
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 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 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
Steve Naroff 51d4f79ffa Fix <rdar://problem/6770276> Support Class<Proto> syntax.
llvm-svn: 76741
2009-07-22 16:07:01 +00:00
Eli Friedman 5ac69057c0 Make vectorized floating-point comparisons work without crashing.
llvm-svn: 76726
2009-07-22 06:07:16 +00:00
Ted Kremenek 920ad71dab Temporarily disable most use of region casts in RegionStoreManager,
instead preferring to use the a region's actual type when creating
symbols and using the QualType passed to Retrieve for implicit
casting.  This preprocessor logic is temporary; eventually we will
either remove region casts or keep them.

Temporarily toggle (via preprocessor directives) that SymbolicRegions
with heap storage are not undefined, but instead should be
symbolicated.  If we want to model that a SymbolicRegion is
uninitialized, we can explicitly model that by binding UndefinedVal to
that region.  It turns out that we want to treat most heap objects as
being defined, not the other way around.

llvm-svn: 76720
2009-07-22 04:35:42 +00:00
Ted Kremenek b2d0409d50 Fix a crasher in StoreManager::InvalidateRegion() caused by using the
'cast type' of a region to invalidate its binding.  This only occurs
when using RegionStoreManager, as it records the cast type.  I'm
currently considering removing the notion of a cast type (see
comments in code).

llvm-svn: 76719
2009-07-22 04:23:20 +00:00
Mon P Wang acedf7768f Preserve address space information through member accesses, e.g.,
__attribute__((address_space(1))) struct {int arr[ 3 ]; }  *p1;
   ... = p1->arr[2];  // load from address space 1

llvm-svn: 76717
2009-07-22 03:08:17 +00:00
Mike Stump 18366cbe97 Remove an unneeded header.
llvm-svn: 76716
2009-07-22 01:39:14 +00:00
Fariborz Jahanian 891436d54c Minor mod. per Doug's comment.
llvm-svn: 76708
2009-07-22 00:42:46 +00:00
Douglas Gregor 168190d822 Complain if we're entering the context of a dependent nested-name-specifier but
cannot match that nested-name-specifier to a class template or class template
partial specialization.

llvm-svn: 76704
2009-07-22 00:28:09 +00:00
Douglas Gregor d8d297c0ac Basic parsing and semantic analysis for out-of-line definitions of the
member functions of class templates, e.g.,

  template<typename T> 
  struct X {
    void f(T);
  };

  template<typename T> X<T>::f(T) { /* ... */ }

llvm-svn: 76692
2009-07-21 23:53:31 +00:00
Ted Kremenek 8be513822c Fix long-lurking bug in ObjCSummaryCache revealed by Torok's recent memory
poisoning changes to DenseMap. We were using an iterator after it had been
invalidated by an insertion into the DenseMap.

llvm-svn: 76677
2009-07-21 23:27:57 +00:00
Fariborz Jahanian aee31ac316 Patch to accomodate Doug's comment on default
destruction of base/members for each destructor AST.

llvm-svn: 76663
2009-07-21 22:36:06 +00:00
Ted Kremenek 6dec002981 Patch by Stefan Bühler: Escape text in macro expansion when emitting HTML in the HTMLRewriter.
This fixes PR 4602.

llvm-svn: 76647
2009-07-21 21:16:46 +00:00
Ted Kremenek 1e35dfac17 Reorder files.
llvm-svn: 76642
2009-07-21 21:03:50 +00:00
Ted Kremenek ac7c7240f0 Fix PR 4594 by refactoring almost all casting logic from GRExprEngine::VisitCast
to SValuator::EvalCast. In the process, the StoreManagers now use this new cast
machinery, and the hack in GRExprEngine::EvalBind to handle implicit casts
involving OSAtomicCompareAndSwap and friends has been removed (and replaced with
logic closer to the logic specific to those functions).

llvm-svn: 76641
2009-07-21 21:03:30 +00:00
Daniel Dunbar 08e41d65a2 driver: Print --version on stdout, to match gcc.
- Patch by Jean-Daniel Dupas

llvm-svn: 76632
2009-07-21 20:06:58 +00:00
Eli Friedman 952c15dd52 Misc fixes for -Wreorder:
1. Make it work correctly with anonymous unions.
2. Don't compute it if the warning isn't enabled.
3. Optimize the algorithm slightly to make it linear time in the 
case where we don't produce any warnings.

llvm-svn: 76630
2009-07-21 19:28:10 +00:00
Douglas Gregor ddbf4e0c2c Make Sema::ActOnCXXEnterDeclaratorScope robust against failures to compute
the declaration context, as occurs with out-of-line class template member
definitions.

llvm-svn: 76622
2009-07-21 18:59:28 +00:00
Owen Anderson a265a3876c Update for LLVM API change.
llvm-svn: 76599
2009-07-21 18:06:41 +00:00
Argyrios Kyrtzidis 33c70c9388 Consider nested-names as part of the declarator when resolving an ambiguous statement.
llvm-svn: 76583
2009-07-21 17:05:03 +00:00
Fariborz Jahanian b154ecafa6 Diagnose when a destructor uses a unrelated class type as its name.
llvm-svn: 76577
2009-07-21 15:28:50 +00:00
Douglas Gregor 82fe3e3398 Add the location of the tag keyword into TagDecl. From Enea
Zaffanella, with tweaks from Abramo Bagnara.

llvm-svn: 76576
2009-07-21 14:46:17 +00:00
Duncan Sands 49c29ee43f Disambiguate an if statement.
llvm-svn: 76547
2009-07-21 07:56:29 +00:00
Argyrios Kyrtzidis 8274ad5281 Remove the ASTContext parameter from Entity::getPrintableName().
llvm-svn: 76546
2009-07-21 07:52:21 +00:00