Commit Graph

63821 Commits

Author SHA1 Message Date
Dan Gohman b215100c7c Revert r75663 (and r76805), as it is causing regressions on powerpc.
llvm-svn: 76823
2009-07-23 00:09:46 +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
Chris Lattner d2aeef0703 remove SectionFlags::Small: it is only used on Xcore, and we'll find
a better solution for it in the future.

llvm-svn: 76818
2009-07-22 23:27:22 +00:00
Dan Gohman 824ab40381 x86 isel tweak: use lea (%reg,%reg) instead of lea (,%reg,2).
llvm-svn: 76817
2009-07-22 23:26:55 +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
Dan Gohman cc1cd6f484 Add new keywords to the vim syntax highlighting.
llvm-svn: 76812
2009-07-22 22:45:50 +00:00
Dan Gohman 3a353a61fc Add new optimization keywords to the polygen grammar.
llvm-svn: 76811
2009-07-22 22:45:30 +00:00
Dan Gohman 902dfff8b6 Rename the new unsigned and signed keywords to nuw and nsw,
which stand for no-unsigned-wrap and no-signed-wrap.

llvm-svn: 76810
2009-07-22 22:44:56 +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
David Greene 1164d1f283 Reorder if-else branches as suggested by Bill.
llvm-svn: 76808
2009-07-22 22:32:19 +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
David Goodwin a0b2dc93b5 Fix typo in addrmode definition.
llvm-svn: 76806
2009-07-22 22:24:31 +00:00
Dan Gohman cdbef5f2c0 Add -march=ppc32 lines so that this test doesn't ever default to ppc64.
llvm-svn: 76805
2009-07-22 22:08:31 +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
Evan Cheng e270d4a4dd Use getTargetConstant instead of getConstant since it's meant as an constant operand.
llvm-svn: 76803
2009-07-22 22:03:29 +00:00
Dan Gohman c510293251 Make the grep line in this test more specific, to avoid
unintended matches.

llvm-svn: 76802
2009-07-22 22:02:42 +00:00
David Greene e88680e33e Constify the key in Mi2IndexMap.
llvm-svn: 76801
2009-07-22 21:56:14 +00:00
Ted Kremenek b8725e2099 Use SaveAndRestore in 'clang/Analysis/Support/SaveAndRestore.h'
llvm-svn: 76800
2009-07-22 21:52:10 +00:00
Evan Cheng d2d52d1906 Ignore undef uses.
llvm-svn: 76799
2009-07-22 21:51:42 +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
Daniel Dunbar 5899dda08c Switch some clients to Value::getName(), and other getName() user
simplification.
 - NFC

llvm-svn: 76789
2009-07-22 21:33:09 +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
Devang Patel 096ecf1bed Fix indentation.
llvm-svn: 76787
2009-07-22 21:10:50 +00:00
Daniel Dunbar 99abb47dd6 Simplify some uses of Value::getName()
llvm-svn: 76786
2009-07-22 21:10:12 +00:00
Daniel Dunbar 4a6554006d Define npos in a way that should make MSVC happier.
llvm-svn: 76785
2009-07-22 21:08:31 +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
Daniel Dunbar 0989a9a338 Remove unnecessary store to temporary std::string.
llvm-svn: 76782
2009-07-22 20:46:46 +00:00
David Greene 6e2eda1c8d Put comment printing under asm-verbose.
llvm-svn: 76780
2009-07-22 20:33:26 +00:00
Eli Friedman 2729132ec3 Fix a nasty little use-after-free bug.
llvm-svn: 76779
2009-07-22 20:29:16 +00:00
Daniel Dunbar ed1c14ba65 Fix indentation.
llvm-svn: 76778
2009-07-22 20:26:37 +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
David Greene 1e2a04ba99 Make some changes suggested by Bill and Evan.
llvm-svn: 76775
2009-07-22 20:08:25 +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