Commit Graph

10566 Commits

Author SHA1 Message Date
Anders Carlsson 364051c6a6 Separate generating code for static variables and global variables.
llvm-svn: 91026
2009-12-10 00:57:45 +00:00
Chris Lattner b2434d558d Second half of r91023, saving files is good.
llvm-svn: 91024
2009-12-10 00:45:15 +00:00
Chris Lattner 5701386620 move GreaterThanIsOperatorScope into RAIIObjectsForParser. Add some more
TODOs for other classes that could be moved out of Parser.h.  I don't plan
to do these in the near term though.

llvm-svn: 91023
2009-12-10 00:44:03 +00:00
Chris Lattner 125c0ee5c7 fix PR5740: a colon is sacred when parsing case statement expressions!
llvm-svn: 91016
2009-12-10 00:38:54 +00:00
Chris Lattner d5c1c9d0ae refactor the 'ColonIsSacred' argument to ParseOptionalCXXScopeSpecifier
to be a bool in Parser that is twiddled by the ColonProtectionRAIIObject
class.  No functionality change.

llvm-svn: 91014
2009-12-10 00:32:41 +00:00
Anders Carlsson 633c6f6f36 Move more decl related functions to CGDeclCXX.cpp
llvm-svn: 91012
2009-12-10 00:30:05 +00:00
Chris Lattner 8a9a97a660 rename ExtensionRAIIObject.h -> RAIIObjectsForParser.h
llvm-svn: 91008
2009-12-10 00:21:05 +00:00
Anders Carlsson bc49cfed84 Add CGDeclCXX.cpp and move EmitCXXGlobalVarDeclInit there.
llvm-svn: 91006
2009-12-10 00:16:00 +00:00
Nuno Lopes 221c1fd63e spread 'const' love to some variables. this considerably reduces the amount of dirty data around.
llvm-svn: 91002
2009-12-10 00:07:02 +00:00
Mike Stump 75546b8c88 Fixup spacing.
llvm-svn: 91001
2009-12-10 00:06:18 +00:00
Mike Stump 2600491817 Fix spacing.
llvm-svn: 91000
2009-12-10 00:05:14 +00:00
Mike Stump f5cbb08c4b Ensure we only generate one terminate handler.
llvm-svn: 90998
2009-12-10 00:02:42 +00:00
Mike Stump 3b60f034f9 Remove obsolete FIXME and some dead fallback code.
llvm-svn: 90997
2009-12-09 23:52:09 +00:00
Mike Stump 102530719f Add terminate handler to cleanups on exceptional edges.
llvm-svn: 90996
2009-12-09 23:49:53 +00:00
Fariborz Jahanian 531c16f9fb Code gen for ObjCIsaExpr AST used as lvalue.
(fixes radar 7457534).

llvm-svn: 90995
2009-12-09 23:35:29 +00:00
Mike Stump 25b20fc2ae Add terminate handler for copy constructors for thrown objects. WIP.
llvm-svn: 90994
2009-12-09 23:31:35 +00:00
Ted Kremenek 8573913760 Fix null dereference in OSAtomicChecker and special case SymbolicRegions. We still aren't handling them correctly; I've added to failing test cases to test/Analysis/NSString-failed-cases.m that should pass and then be merged in to test/Analysis/NSString.m.
llvm-svn: 90993
2009-12-09 23:29:55 +00:00
Douglas Gregor 3e1e527826 Reimplement reference initialization (C++ [dcl.init.ref]) using the
new notion of an "initialization sequence", which encapsulates the
computation of the initialization sequence along with diagnostic
information and the capability to turn the computed sequence into an
expression. At present, I've only switched one CheckReferenceInit
callers over to this new mechanism; more will follow.

Aside from (hopefully) being much more true to the standard, the
diagnostics provided by this reference-initialization code are a bit
better than before. Some examples:

p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct
Derived'
      cannot bind to a value of unrelated type 'struct Base'
  Derived &dr2 = b; // expected-error{{non-const lvalue reference to
  ...
           ^     ~
p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to
a value of
      type 'struct Base const' drops qualifiers
  Base &br3 = bc; // expected-error{{drops qualifiers}}
        ^     ~~

p5-var.cpp:57:15: error: ambiguous conversion from derived class
      'struct Diamond' to base class 'struct Base':
    struct Diamond -> struct Derived -> struct Base
    struct Diamond -> struct Derived2 -> struct Base
  Base &br5 = diamond; // expected-error{{ambiguous conversion from
      ...
              ^~~~~~~
p5-var.cpp:59:9: error: non-const lvalue reference to type 'long'
      cannot bind to
      a value of unrelated type 'int'
  long &lr = i; // expected-error{{non-const lvalue reference to type
      ...
        ^    ~

p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct
Base' cannot
      bind to a temporary of type 'struct Base'
  Base &br1 = Base(); // expected-error{{non-const lvalue reference to
  ...
        ^     ~~~~~~

p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field
'i'
  int & ir1 = (ib.i); // expected-error{{non-const reference cannot
  ...
        ^     ~~~~~~
p5-var.cpp:98:7: note: bit-field is declared here
  int i : 17; // expected-note{{bit-field is declared here}}
      ^

llvm-svn: 90992
2009-12-09 23:02:17 +00:00
Mike Stump 2b488873bf Break out code for reuse. WIP.
llvm-svn: 90991
2009-12-09 22:59:31 +00:00
Fariborz Jahanian 26de2e594b Fixes a bogus error when declaring an extern "C" array.
(fixes radar 7457109).

llvm-svn: 90986
2009-12-09 21:39:38 +00:00
Mike Stump f16b8c30d9 Add throw support. WIP.
llvm-svn: 90982
2009-12-09 19:24:08 +00:00
Fariborz Jahanian a5fee26d28 Codegen. support for ObjCIsaExpr AST which until now
was not needed (fixes radar 7453430).

llvm-svn: 90981
2009-12-09 19:05:56 +00:00
Anders Carlsson 538af0906d Add DeclContext::dump.
llvm-svn: 90974
2009-12-09 17:27:46 +00:00
Zhongxing Xu 1042bf4ae2 Refactor OSAtomic evaluation logic into OSAtomicChecker.
llvm-svn: 90968
2009-12-09 12:23:28 +00:00
Zhongxing Xu 8cca37fae0 Use a temporary destination set such that we can clear fake auto transitions.
Otherwise, even when real evaluation occurs, the previous fake auto 
transitions would still be in the destination set, causing fake state 
bifurcation.

llvm-svn: 90967
2009-12-09 12:16:07 +00:00
John McCall 5677499fbf First pass at implementing C++ enum semantics: calculate (and store) an
"integer promotion" type associated with an enum decl, and use this type to
determine which type to promote to.  This type obeys C++ [conv.prom]p2 and
is therefore generally signed unless the range of the enumerators forces
it to be unsigned.

Kills off a lot of false positives from -Wsign-compare in C++, addressing
rdar://7455616

llvm-svn: 90965
2009-12-09 09:09:27 +00:00
Zhongxing Xu 1d153328be OSAtomic simulation: use the original region as the location to load from,
instead of the ElementRegion obtained from casts.

Test cast: the leak cannot occur bacause the true branch cannot be taken.

llvm-svn: 90964
2009-12-09 08:32:57 +00:00
Anders Carlsson c50b340108 Look through using declarations when searching for allocation overloads.
llvm-svn: 90961
2009-12-09 07:39:44 +00:00
Zhongxing Xu f5448561ed remove dead code.
llvm-svn: 90953
2009-12-09 05:52:12 +00:00
Zhongxing Xu d1dee7e71a Insert instead of assign to the dest node set, since we use the dest node set
repeatedly.

llvm-svn: 90952
2009-12-09 05:48:53 +00:00
Eli Friedman f7195532ee Fix for PR5730: make sure to consistently call
PerformObjectArgumentInitialization from BuildCXXMemberCallExpr.

llvm-svn: 90950
2009-12-09 04:53:56 +00:00
Eli Friedman a958a01e9f Whitespace fix.
llvm-svn: 90949
2009-12-09 04:52:43 +00:00
Anders Carlsson f9812782b7 In CXXRecordDecl::forallBases, add the base to the "queue", so we walk more than one heirarchy of classes. John, please review.
llvm-svn: 90948
2009-12-09 04:26:02 +00:00
Ted Kremenek 06ba78d07d Fix crash in DisplayFunction(). ObjCInterfaceDecls can also get passed to this function, but we don't want to display them.
llvm-svn: 90944
2009-12-09 03:45:19 +00:00
Anders Carlsson a038825b1c Don't warn about function templates or function template specializations.
llvm-svn: 90943
2009-12-09 03:44:46 +00:00
Mike Stump aff69af918 Add cleanups for exceptional edges. WIP.
llvm-svn: 90940
2009-12-09 03:35:49 +00:00
John McCall daa3d6bb50 Rename Sema::IsOverload to Sema::CheckOverload. Teach it to ignore unresolved
using value decls;  we optimistically assume they won't turn into conflicts.
Teach it to tell the caller *why* the function doesn't overload with the returned
decl;  this will be useful for using hiding.

llvm-svn: 90939
2009-12-09 03:35:25 +00:00
Anders Carlsson 31c7e88667 Move the missing prototypes checking out into a new function. Don't warn about inline functions. Add a test.
llvm-svn: 90938
2009-12-09 03:30:09 +00:00
Eli Friedman 4f678f3de1 Fix for PR5709: use the computed type of the declaration instead of the
type of the builtin when generating the function declaration for a builtin
library call.

llvm-svn: 90936
2009-12-09 03:05:59 +00:00
Anders Carlsson efa4732747 Pass the current SourceLocation to getAssignOperatorMethod, fixing a crash when the assign operator method needs to be instantiated. Doug, please review the updated default-assignment-operator.cpp change.
llvm-svn: 90935
2009-12-09 03:01:51 +00:00
Ted Kremenek 32c32892f7 Fix a horrid bug in GRExprEngine::CheckerVisit() that was identified
by the test case in PR 5627.  Essentially we shouldn't clear the
ExplodedNodeSet where we deposit newly constructed nodes if that set
is the 'Dst' set passed in.  It is not okay to clear that set because
it may already contain nodes.

llvm-svn: 90931
2009-12-09 02:45:41 +00:00
Chris Lattner 53d80e2c07 Neil points out that this could be simplified, do it.
llvm-svn: 90927
2009-12-09 02:08:14 +00:00
Mike Stump 85d9968533 Add support for the cleanup attribute for C++; we don't have to copy
all of g++'s bugs.

llvm-svn: 90924
2009-12-09 01:50:36 +00:00
Douglas Gregor 40cb9ad391 Implemented an implicit conversion from "noreturn" function types (and
pointers thereof) to their corresponding non-noreturn function
types. This conversion is considered an exact match for
overload-resolution purposes. Note that we are a little more strict
that GCC is, because we encode noreturn in the type system, but that's
a Good Thing (TM) because it does not allow us to pretend that
potentially-returning function pointers are non-returning function
pointers.

Fxies PR5620.

llvm-svn: 90913
2009-12-09 00:47:37 +00:00
Fariborz Jahanian e19122ff01 Added a missing case to a switch statement.
llvm-svn: 90902
2009-12-08 23:46:15 +00:00
Daniel Dunbar e07f152e6d Increase inlining threshold at -O3, to match llvm-gcc.
llvm-svn: 90897
2009-12-08 23:15:55 +00:00
Fariborz Jahanian 859c415567 More detailed analysis of typecast to an objective-c pointer
in objective-c++ mode without being too lenient.

llvm-svn: 90895
2009-12-08 23:09:15 +00:00
John McCall 3a60c87a59 Handle unresolved using decls in bare lookups. These are not being adequately
tested.  Fixes PR5727.

llvm-svn: 90893
2009-12-08 22:45:53 +00:00
Mike Stump 4a6b337cfd Add fixme.
llvm-svn: 90884
2009-12-08 22:12:48 +00:00
Mike Stump e6d54ca553 Remove some old code. WIP.
llvm-svn: 90882
2009-12-08 21:46:41 +00:00