Commit Graph

10277 Commits

Author SHA1 Message Date
Anders Carlsson 5843635b37 TargetInfo::validateAsmConstraint now takes a reference to the full constraints string. This will make it possible to support multi-character constraints. No functionality change (for now).
llvm-svn: 65696
2009-02-28 17:11:49 +00:00
Steve Naroff 70f41d6f07 Minor name change (move the ObjC prefix to a more appropriate place).
llvm-svn: 65695
2009-02-28 16:59:13 +00:00
Steve Naroff d123bd05ca Fix <rdar://problem/6451399> problems with labels and blocks.
- Move the 'LabelMap' from Sema to Scope. To avoid layering problems, the second element is now a 'StmtTy *', which makes the LabelMap a bit more verbose to deal with.
- Add 'ActiveScope' to Sema. Managed by ActOnStartOfFunctionDef(), ObjCActOnStartOfMethodDef(), ActOnBlockStmtExpr().
- Changed ActOnLabelStmt(), ActOnGotoStmt(), ActOnAddrLabel(), and ActOnFinishFunctionBody() to use the new ActiveScope.
- Added FIXME to workaround in ActOnFinishFunctionBody() (for dealing with C++ nested functions).  

llvm-svn: 65694
2009-02-28 16:48:43 +00:00
Gabor Greif fda885d048 Adapt help string to what the code is doing (default is lang_gnu99). Thanks rdivacky!
llvm-svn: 65689
2009-02-28 09:22:15 +00:00
Mike Stump 1db7d04b71 First cut CodeGen support for __block variables.
llvm-svn: 65688
2009-02-28 09:07:16 +00:00
Eli Friedman cba899ff7b Check a few more kinds of declarations that make a scope.
llvm-svn: 65680
2009-02-28 06:22:14 +00:00
Eli Friedman f69d09bae5 Start of checking for gotos which jump to an illegal destination.
As far as I know, this catches all cases of jumping into the scope of a 
variable with a variably modified type (excluding statement 
expressions) in C.  This is missing some stuff we probably want to check
(other kinds of variably modified declarations, statement expressions, 
indirect gotos/addresses of labels in a scope, ObjC @try/@finally, cleanup 
attribute), the diagnostics aren't very good, and it's not particularly 
efficient, but it's a decent start.

This patch is a slightly modified version of the patch I attached to
PR3259, and it fixes that bug.  I was sort of planning on improving 
it, but I think it's okay as-is, especially since it looks like CodeGen 
doesn't have any use for this sort of data structure.  The only 
significant change I can think of from the version I attached to PR3259 
is that this version skips running the checking code when a function 
doesn't contain any labels.

This patch doesn't cover case statements, which also need similar 
checking; I'm not sure how we should deal with that. Extending the goto 
checking to also check case statements wouldn't be too hard; it's just a 
matter of keeping track of the scope of the closest switch and checking that
the scope of every case is the same as the scope of the switch.  That said, 
it would likely be a performance hit to run this check on every 
function (it's an extra pass over the entire function), so we probably want
some other solution.

llvm-svn: 65678
2009-02-28 05:41:13 +00:00
Eli Friedman a1c7b6c5f6 Fix obvious shortcoming in the implementations of Evaluate for
integer __real__ and __imag__.  Not sure how I missed this.

llvm-svn: 65677
2009-02-28 03:59:05 +00:00
Ted Kremenek 8a56e5c29b Update checker build.
llvm-svn: 65676
2009-02-28 02:04:49 +00:00
Douglas Gregor 89ee6822d8 Eliminate CXXRecordType
llvm-svn: 65671
2009-02-28 01:32:25 +00:00
Douglas Gregor 0ab407d57d Add a FIXME for something I can't look at just yet
llvm-svn: 65669
2009-02-28 01:09:26 +00:00
Douglas Gregor 6eaaf30968 Template instantiation for function types
llvm-svn: 65668
2009-02-28 01:04:19 +00:00
Fariborz Jahanian cd073cc2e9 Alignment of pointers in __objc_classlist must be on their
natural alignment. Otherwise, the excess hole confuses the
objc2 runtime (this is darwin specific).

llvm-svn: 65666
2009-02-28 00:54:00 +00:00
Douglas Gregor 17c0d7bacf Implement template instantiation for pointer, reference, and (some)
array types. Semantic checking for the construction of these types has
been factored out of GetTypeForDeclarator and into separate
subroutines (BuildPointerType, BuildReferenceType,
BuildArrayType). We'll be doing the same thing for all other types
(and declarations and expressions).

As part of this, moved the type-instantiation functions into a class
in an anonymous namespace. 

llvm-svn: 65663
2009-02-28 00:25:32 +00:00
Eli Friedman 015a4742c1 Fix enumeration in switch warnings. No behavior change.
llvm-svn: 65659
2009-02-27 23:15:07 +00:00
Eli Friedman cad9638bd9 Fix enumeration in switch warnings, plus misc comment changes. No
behavior change.

llvm-svn: 65658
2009-02-27 23:04:43 +00:00
Mike Stump 537abb0dec Fix PR3612. We ensure that we add builtins to the GlobalDeclMap and
we ensure that things added to the module can be found even when they
are not in GlobalDeclMap.  The later is for increased flexibility,
should someone want to do something tricky like extern "Ada" in the
same module.

llvm-svn: 65657
2009-02-27 22:42:30 +00:00
Fariborz Jahanian f5c1c923e8 Diagnose gc attribute mismatch of property and its ivar.
llvm-svn: 65656
2009-02-27 22:38:11 +00:00
Chris Lattner 537fd9337f Give a code insertion hint for how to fix 'implicit int' warnings and errors.
llvm-svn: 65653
2009-02-27 22:31:56 +00:00
Douglas Gregor 72dfbc754e Fix a typo
llvm-svn: 65652
2009-02-27 22:05:23 +00:00
Ted Kremenek cbcc5e83ca When retrieving the location of a Node, for MemberExprs use the location of the
'.' or '->'.

llvm-svn: 65651
2009-02-27 20:05:10 +00:00
Ted Kremenek e879e15ed9 In BuildAnonymousStructUnionMemberReference, we shouldn't invalidate OpLoc when
building nested member expressions. This location is used to determine the range
of the entire expression, and the expression itself already has its location
inherited from its Base.

This fixes <rdar://problem/6629829>.

llvm-svn: 65650
2009-02-27 19:58:12 +00:00
Douglas Gregor fe1e11092e Implement the basic approach for instantiating types, with a lot of FIXME'd
stubs for those types we don't yet know how to instantiate (everything
that isn't a template parameter!).

We now instantiate default arguments for template type parameters when
needed. This will be our testbed while I fill out the remaining
type-instantiation logic.

llvm-svn: 65649
2009-02-27 19:31:52 +00:00
Chris Lattner 9605a55076 minor wording changes.
llvm-svn: 65648
2009-02-27 19:31:12 +00:00
Chris Lattner 7b0ec8a9df upgrade various 'implicit int' warnings from an ext-warn to warning when not
in C89 mode.  This makes it enabled by default instead of only enabled with
-pedantic.  Clang defaults to c99 mode, so people will see this more often
than with GCC, but they can always use -std=c89 if they really want c89.

llvm-svn: 65647
2009-02-27 18:53:28 +00:00
Chris Lattner de39c3efcb cleanup
llvm-svn: 65646
2009-02-27 18:38:20 +00:00
Chris Lattner e0c511688e cleanup
llvm-svn: 65645
2009-02-27 18:35:46 +00:00
Mike Stump 5b9a3d54b6 Silence warnings.
llvm-svn: 65644
2009-02-27 18:32:39 +00:00
Ted Kremenek 9723bcf60f When checking printf-arguments for functions with '__attribute__ ((format (printf, X, Y)))'
set HasVAListArg to true when 'Y' is 0 (i.e., ignore the data arguments).

This fixes <rdar://problem/6623513>.

llvm-svn: 65642
2009-02-27 17:58:43 +00:00
Douglas Gregor 96977da72c Clean up and document code modification hints.
llvm-svn: 65641
2009-02-27 17:53:17 +00:00
Chris Lattner 7094c15d7e change a diagnostic message from something pedantically correct but
useless to something more vague but hopefully more clear.
rdar://6624173

llvm-svn: 65639
2009-02-27 17:15:01 +00:00
Daniel Dunbar 13454cfcb0 Oops, Ted beat me to it. I'll just play angry god and remove his version!
llvm-svn: 65638
2009-02-27 17:10:38 +00:00
Daniel Dunbar 8d42281150 Add coverage of "member of anonymous union redeclares ..." diagnostic.
llvm-svn: 65637
2009-02-27 17:07:01 +00:00
Ted Kremenek dd34e06eeb Add test case for PR 3675.
llvm-svn: 65635
2009-02-27 16:48:08 +00:00
Ted Kremenek 918ae24edd Update checker build.
llvm-svn: 65625
2009-02-27 07:16:04 +00:00
Eli Friedman 988a16b9b8 Change the AST generated for offsetof a bit so that it looks like a
normal expression, and change Evaluate and IRGen to evaluate it like a 
normal expression.  This simplifies the code significantly, and fixes 
PR3396.

llvm-svn: 65622
2009-02-27 06:44:11 +00:00
Ted Kremenek 078b8879e7 Don't report 'Parser Rejects' for conftest files.
llvm-svn: 65619
2009-02-27 06:17:38 +00:00
Ted Kremenek 33b220510b Correctly check for ccc-analyzer in the same directory as scan-build.
llvm-svn: 65618
2009-02-27 06:17:05 +00:00
Eli Friedman 8f5f4ea466 Change the way clang generates union types a bit so it plays well
with the LLVM C backend.

llvm-svn: 65615
2009-02-27 04:53:40 +00:00
Eli Friedman 8d03f59479 Some additional ICE tests.
llvm-svn: 65614
2009-02-27 04:46:32 +00:00
Eli Friedman 4e7a241f49 Some minor improvements to Evaluate.
llvm-svn: 65613
2009-02-27 04:45:43 +00:00
Eli Friedman 2c7bd6b0ac Fix minor memory leak. Add comment describing what we need to do for
strict constant initializer checking.

llvm-svn: 65612
2009-02-27 04:17:12 +00:00
Eli Friedman 97e070ed68 Minor cleanup: use getDeclAlignInBytes helper.
llvm-svn: 65611
2009-02-27 04:11:37 +00:00
Eli Friedman 90afd3d4aa Make isICE assert when Evaluate can't evaluate an ICE, as suggested by
Daniel.  Some minor fixes/cleanup.  Allow __builtin_choose_expr, 
__real__, and __imag__ in ICEs, following gcc's example.

llvm-svn: 65610
2009-02-27 04:07:58 +00:00
Mike Stump ee5e376e32 The middle operand in ?: is optional, really.
llvm-svn: 65609
2009-02-27 03:16:57 +00:00
Douglas Gregor deaad8cc34 Create a new TypeNodes.def file that enumerates all of the types,
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types. 

Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved 
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.

As part of this, some types have been renamed:

  TypeOfExpr -> TypeOfExprType
  FunctionTypeProto -> FunctionProtoType
  FunctionTypeNoProto -> FunctionNoProtoType

There shouldn't be any functionality change...

llvm-svn: 65591
2009-02-26 23:50:07 +00:00
Chris Lattner 007cb026c9 make ASTContext::WCharTy a bit more sensical. In C++, it is a disctint type,
but in C99 it is just another int type.

llvm-svn: 65590
2009-02-26 23:43:47 +00:00
Chris Lattner 012b339693 fix a bozobug.
llvm-svn: 65589
2009-02-26 23:42:47 +00:00
Chris Lattner 09e592ea33 rename test
llvm-svn: 65587
2009-02-26 23:36:18 +00:00
Chris Lattner 7ec0bb6bc0 ok, not as broken as I thought, just confusing. This allows
initialization of wchar_t arrays with wide strings, and generalizes
wchar_size.c to work on all targets.

llvm-svn: 65586
2009-02-26 23:36:02 +00:00
Chris Lattner a9196810b3 allow wide strings to initialize arrays compatible with wchar_t.
Unfortunately this doesn't work yet because wchar_t is completely
broken in C.

llvm-svn: 65585
2009-02-26 23:26:43 +00:00
Ted Kremenek 1b44ba4295 Pass -ffreestanding' to clang.
llvm-svn: 65584
2009-02-26 23:09:43 +00:00
Fariborz Jahanian 7285cf57a3 Do not issue bogus error on __weak/__strong ivar access.
llvm-svn: 65583
2009-02-26 23:05:51 +00:00
Chris Lattner d42c29f9a2 fix some sema problems with wide strings and hook up basic codegen for them.
llvm-svn: 65582
2009-02-26 23:01:51 +00:00
Daniel Dunbar 26d5f05bf5 Add -emit-llvm-only option (generate LLVM IR & run passes, but discard
output).
 - For timing IRgen phase.

llvm-svn: 65580
2009-02-26 22:39:37 +00:00
Fariborz Jahanian ec3385733a Couple of meta-data segments were wrong. This patch fixes them.
llvm-svn: 65578
2009-02-26 22:30:39 +00:00
Douglas Gregor d56a91e8f6 Make the type associated with a ClassTemplateSpecializationDecl be a
nicely sugared type that shows how the user wrote the actual
specialization. This sugared type won't actually show up until we
start doing instantiations.

llvm-svn: 65577
2009-02-26 22:19:44 +00:00
Ted Kremenek e9817aaa05 PathDiagnosticPiece now automatically strips off trailing periods in diagnostic messages.
llvm-svn: 65574
2009-02-26 21:30:32 +00:00
Devang Patel f4c205b2fa Add support to emit debug info for objective-c interfaces.
(This is not yet used.)

llvm-svn: 65573
2009-02-26 21:10:26 +00:00
Ted Kremenek 6832977821 Refine some grammar in the retain/release diagnostics.
llvm-svn: 65571
2009-02-26 21:04:07 +00:00
Douglas Gregor 87f95b0a6a Introduce code modification hints into the diagnostics system. When we
know how to recover from an error, we can attach a hint to the
diagnostic that states how to modify the code, which can be one of:

  - Insert some new code (a text string) at a particular source
    location
  - Remove the code within a given range
  - Replace the code within a given range with some new code (a text
    string)

Right now, we use these hints to annotate diagnostic information. For
example, if one uses the '>>' in a template argument in C++98, as in
this code:

  template<int I> class B { };
  B<1000 >> 2> *b1;

we'll warn that the behavior will change in C++0x. The fix is to
insert parenthese, so we use code insertion annotations to illustrate
where the parentheses go:

test.cpp:10:10: warning: use of right-shift operator ('>>') in template
argument will require parentheses in C++0x
  B<1000 >> 2> *b1;
         ^
    (        )


Use of these annotations is partially implemented for HTML
diagnostics, but it's not (yet) producing valid HTML, which may be
related to PR2386, so it has been #if 0'd out.

In this future, we could consider hooking this mechanism up to the
rewriter to actually try to fix these problems during compilation (or,
after a compilation whose only errors have fixes). For now, however, I
suggest that we use these code modification hints whenever we can, so
that we get better diagnostics now and will have better coverage when
we find better ways to use this information.

This also fixes PR3410 by placing the complaint about missing tokens
just after the previous token (rather than at the location of the next
token).

llvm-svn: 65570
2009-02-26 21:00:50 +00:00
Daniel Dunbar 76ba41ce4f Add Type::hasPointerRepresentation predicate.
- For types whose native representation is a pointer.

 - Use to replace ExprConstant.cpp:HasPointerEvalType,
   CodeGenFunction::isObjCPointerType.

llvm-svn: 65569
2009-02-26 20:52:22 +00:00
Ted Kremenek 8b09ad17f9 Use Loc::IsLocType() instead of isPointerType() and isReferenceType().
llvm-svn: 65568
2009-02-26 20:29:19 +00:00
Daniel Dunbar d26d5c220b Remove PointerLikeType.
- Having pointers and references share a base was not a useful
   notion.

llvm-svn: 65567
2009-02-26 19:54:52 +00:00
Daniel Dunbar 201351933a Change PointersToResolve to list the pointee type to resolve, not the
pointer type.
 - Drops use of PointerLikeType.
 - No intended functionality change.

llvm-svn: 65566
2009-02-26 19:48:14 +00:00
Daniel Dunbar b566c6c758 Drop uses of getAsPointerLikeType.
- No functionality change.

llvm-svn: 65563
2009-02-26 19:13:44 +00:00
Steve Naroff de68001e76 Fix <rdar://problem/6574319> clang issues error on 'readonly' property with a defaul setter attribute.
Needed to make isPropertyReadonly() non-const (for this fix to compile). I imagine there's a way to retain the const-ness, however I have more important fish to fry.

llvm-svn: 65562
2009-02-26 19:11:32 +00:00
Daniel Dunbar e2617d97a5 Drop uses of isPointerLikeType.
- No functionality change.

llvm-svn: 65560
2009-02-26 19:03:24 +00:00
Mike Stump 92000e54ac Add end of line at end.
llvm-svn: 65557
2009-02-26 19:00:14 +00:00
Chris Lattner fff06dd4f9 this got moved to top level
llvm-svn: 65553
2009-02-26 18:38:21 +00:00
Fariborz Jahanian 03b300b734 Fix an inconsistance in objc2's meta-data related to
the symbol for the root meta-data.

llvm-svn: 65548
2009-02-26 18:23:47 +00:00
Steve Naroff 42ab0dd1ee Fix <rdar://problem/6614945> method not found.
This was a fairly recent regression.

llvm-svn: 65547
2009-02-26 18:16:19 +00:00
Chris Lattner 58ac0b4bac move this makefile goop up to the top level llvm makefile.
llvm-svn: 65544
2009-02-26 17:48:04 +00:00
Anders Carlsson 43e8a2b36e Add test for enum types
llvm-svn: 65540
2009-02-26 17:38:19 +00:00
Ted Kremenek 721c3c5f70 For scan-build based analyses, use the '-analyzer-eargely-assume' setting by default (turning it on to test how it impacts users).
llvm-svn: 65535
2009-02-26 17:36:31 +00:00
Anders Carlsson 7a1b87dd7d Set tab width to 2 on a number of CG related files
llvm-svn: 65534
2009-02-26 17:34:58 +00:00
Anders Carlsson 600183db9e Classify enum types correctly
llvm-svn: 65533
2009-02-26 17:31:15 +00:00
Steve Naroff b162f170da Fix http://llvm.org/bugs/show_bug.cgi?id=3544.
The code for looking up local/private method in Sema::ActOnInstanceMessage() was not handling categories properly. Sema::ActOnClassMessage() didn't have this bug.
Created a helper with the correct logic and changed both methods to use it.

llvm-svn: 65532
2009-02-26 15:55:06 +00:00
Sebastian Redl 8d2ccae28b Make more AST nodes and semantic checkers dependent-expression-aware.
llvm-svn: 65529
2009-02-26 14:39:58 +00:00
Steve Naroff 8ec2784f58 Fix ObjCInterfaceDecl::lookupInstanceMethod()/lookupClassMethod() to search in inherited protocols.
Also changed ObjCInterfaceDecl::lookupClassMethod() to look through a categories protocols.

Test/patch submitted by Jean-Daniel Dupas (thanks!).

llvm-svn: 65526
2009-02-26 11:32:02 +00:00
Eli Friedman 9cb9ff4342 Remove short-circuit evaluation and the extension warnings. I'm
pretty sure we want to keep constant expression verification outside of 
Evaluate. Because of that, the short-circuit evaluation doesn't 
generally make sense, and the comma warning doesn't make sense in its 
current form.

llvm-svn: 65525
2009-02-26 10:19:36 +00:00
Eli Friedman 98c56a4fe9 Rewrite of isIntegerConstantExpr to be centered around Evaluate. This
is a rather big change, but I think this is the direction we want to go; 
the code is significantly shorter now, and it doesn't duplicate Evaluate 
code.  There shouldn't be any visible changes as far as I know.

There has been some movement towards putting ICE handling into 
Evaluate (for example, VerifyIntegerConstantExpression uses Evaluate 
instead of isICE).  This patch is sort of the opposite of the approach, 
making ICE handling work without Evaluate being aware of it. I think 
this approach is better because it separates the code that does the 
constant evaluation from code that's calculating a rather 
arbitrary predicate.

The one thing I don't really like about this patch is that 
the handling of commas in C99 complicates it signficantly. (Seriously, 
what was the standards committee thinking when they wrote that 
part?) I think I've come up with a decent approach, but it doesn't feel
ideal.  I might add some way to check for evaluated commas from Evaluate 
in a subsequent patch; that said, it might not be worth bothering.

llvm-svn: 65524
2009-02-26 09:29:13 +00:00
Anton Korobeynikov 34c44301b1 Enable export maps also on {Free, Net}BSD.
Don't ask me, how does this makefile-horribleness even work ;)

llvm-svn: 65522
2009-02-26 09:04:29 +00:00
Mike Stump d8ba7a2cdf Fixup spacing.
llvm-svn: 65519
2009-02-26 08:00:25 +00:00
Daniel Dunbar b98d1f7140 x86_64 ABI: Qualified id types are passed as pointers.
- <rdar://problem/6622451> Bad x86_64 code gen for message call taking one argument.

llvm-svn: 65510
2009-02-26 07:21:35 +00:00
Owen Anderson dfa78089e8 Add an export map for clang on Linux.
llvm-svn: 65504
2009-02-26 06:29:54 +00:00
Eli Friedman 4f294cfefb Zap the Sema constant initializer checking code that we aren't using
anymore.  If we want to reuse bits and pieces to add strict checking for 
constant initializers, we can dig them out of SVN history; the existing 
code won't be useful as-is.

llvm-svn: 65502
2009-02-26 04:47:58 +00:00
Eli Friedman adf40d4bef Fix for PR3663/3669: use TryToFixInvalidVariablyModifiedType for
variable declarations where applicable.  Also, a few fixes to 
TryToFixInvalidVariablyModifiedType for issues that this exposed.

llvm-svn: 65500
2009-02-26 03:58:54 +00:00
Douglas Gregor 8d0921617e Use RecordFirst/RecordLast range checks in DeclContext
llvm-svn: 65489
2009-02-26 00:02:51 +00:00
Douglas Gregor d54dfb8718 Implementing parsing of template-ids as class-names, so that we can
derive from a class template specialization, e.g.,

  class B : public A<int> { };

llvm-svn: 65488
2009-02-25 23:52:28 +00:00
Mike Stump b750d928ce CodeGen support for copied BlockDeclRefExprs.
llvm-svn: 65487
2009-02-25 23:33:13 +00:00
Ted Kremenek ff290caf56 Fix subtle bug in EvalEagerlyAssume: Check if the previous node was at the same statement.
llvm-svn: 65486
2009-02-25 23:32:10 +00:00
Ted Kremenek 8ec8cf0207 Fix recently introduced switch case fallthrough bug.
llvm-svn: 65485
2009-02-25 23:11:49 +00:00
Douglas Gregor cbb45d0c65 Cope with use of the token '>>' inside a template argument list, e.g.,
vector<vector<double>> Matrix;

In C++98/03, this token always means "right shift". However, if we're in
a context where we know that it can't mean "right shift", provide a
friendly reminder to put a space between the two >'s and then treat it
as two >'s as part of recovery.

In C++0x, this token is always broken into two '>' tokens.

llvm-svn: 65484
2009-02-25 23:02:36 +00:00
Ted Kremenek 16f3d8dcfb scan-build now looks for ccc-analyzer first in the 'bin' subdirectory and then the directory where scan-build lives.
llvm-svn: 65483
2009-02-25 22:54:02 +00:00
Ted Kremenek dc3f50fbd9 Add experimental logic in GRExprEngine::EvalEagerlyAssume() to handle
expressions of the form: 'short x = (y != 10);' While we handle 'int x = (y !=
10)' lazily, the cast to another integer type currently loses the symbolic
constraint. Eager evaluation of the constraint causes the paths to bifurcate and
eagerly evaluate 'y != 10' to a constant of 1 or 0. This should address
<rdar://problem/6619921> until we have a better (more lazy approach) for
handling promotions/truncations of symbolic integer values.

llvm-svn: 65480
2009-02-25 22:32:02 +00:00
Douglas Gregor 1e249f8641 Improve location information on "reused" class template specialization
decls. Test and document the semantic location of class template
specialization definitions that occur within a scope enclosing the
scope of the class template.

llvm-svn: 65478
2009-02-25 22:18:32 +00:00
Douglas Gregor f47b911f6e Perform additional semantic checking of class template
specializations. In particular:

  - Make sure class template specializations have a "template<>"
    header, and complain if they don't.
  - Make sure class template specializations are declared/defined
    within a valid context. (e.g., you can't declare a specialization
    std::vector<MyType> in the global namespace).

llvm-svn: 65476
2009-02-25 22:02:03 +00:00
Ted Kremenek 32a59b2315 Do not automatically run the 'missing -dealloc' check until we have adequate time to make it much smarter (too much noise).
llvm-svn: 65474
2009-02-25 21:08:30 +00:00
Daniel Dunbar 4208835eec Temporarily disable clearing of insert point (to indicate unreachable
code) when calling noreturn functions; general expression emission
isn't ready to do the right thing in all cases.

llvm-svn: 65473
2009-02-25 20:59:29 +00:00
Daniel Dunbar 1cdbc5404b Allow constant initializers to reference their defining decl.
- PR3662.

llvm-svn: 65472
2009-02-25 20:08:33 +00:00
Douglas Gregor 441f24118a Include the appropriate header for malloc
llvm-svn: 65471
2009-02-25 19:48:02 +00:00
Daniel Dunbar a374e60e57 Fold GeneraticStaticBlockVarDecl into callers.
- No functionality change.

llvm-svn: 65470
2009-02-25 19:45:19 +00:00
Douglas Gregor 7f74112756 Implement parsing of nested-name-specifiers that involve template-ids, e.g.,
std::vector<int>::allocator_type

When we parse a template-id that names a type, it will become either a
template-id annotation (which is a parsed representation of a
template-id that has not yet been through semantic analysis) or a
typename annotation (where semantic analysis has resolved the
template-id to an actual type), depending on the context. We only
produce a type in contexts where we know that we only need type
information, e.g., in a type specifier. Otherwise, we create a
template-id annotation that can later be "upgraded" by transforming it
into a typename annotation when the parser needs a type. This occurs,
for example, when we've parsed "std::vector<int>" above and then see
the '::' after it. However, it means that when writing something like
this:

  template<> class Outer::Inner<int> { ... };

We have two tokens to represent Outer::Inner<int>: one token for the
nested name specifier Outer::, and one template-id annotation token
for Inner<int>, which will be passed to semantic analysis to define
the class template specialization.

Most of the churn in the template tests in this patch come from an
improvement in our error recovery from ill-formed template-ids.

llvm-svn: 65467
2009-02-25 19:37:18 +00:00
Daniel Dunbar 22a87f94a9 Pull COdeGenFunction::CreateStaticBlockVarDecl (just for creating the
global variable) out of GenerateStaticBlockVarDecl. 
 - No intended functionality change.
 - Prep for some mild cleanups and PR3662.

llvm-svn: 65466
2009-02-25 19:24:29 +00:00
Chris Lattner d92f1bfa11 add c++ search path for GCC 4.2, PR3668, patch by Pawel Worach!
llvm-svn: 65462
2009-02-25 18:06:37 +00:00
Anders Carlsson f2f2e7f6a1 Use CheckAssignmentConstraints for checking the cleanup attr function. Fixes PR3656.
llvm-svn: 65461
2009-02-25 17:19:08 +00:00
Douglas Gregor 739ef0c183 C99 DR #316 implies that the function parameter types that are known
only from a function definition (that does not have a prototype) are
only used to determine the compatible with other declarations of that
same function. In particular, when referencing the function we pretend
as if it does not have a prototype. Implement this behavior, which
fixes PR3626.

llvm-svn: 65460
2009-02-25 16:33:18 +00:00
Gabor Greif dd4ddf13a6 fix (hopefully) some validation errors
llvm-svn: 65455
2009-02-25 15:22:45 +00:00
Gabor Greif 267e01cb28 minor tweaks to readability
llvm-svn: 65440
2009-02-25 09:45:40 +00:00
Chris Lattner d79eb11e22 update
llvm-svn: 65433
2009-02-25 05:43:33 +00:00
Chris Lattner 014d2ad55f Headers are basically done, debug info is just about done (and
will improve a lot this week hopefully), and a libgcc replacement
is ready once I wrangle lawyers.

llvm-svn: 65432
2009-02-25 05:39:01 +00:00
Chris Lattner a004a1846b clang seems "generally useful" for c and objc by now, though obviously bugs
still remain.

llvm-svn: 65431
2009-02-25 05:35:47 +00:00
Eli Friedman 8163b7aa20 Minor cleanup for IntToBlockPointer so it applies to all callers of
Sema::CheckAssignmentConstraints; not really visible, but the right 
thing to do.

llvm-svn: 65428
2009-02-25 04:20:42 +00:00
Ted Kremenek dce7846c24 retain/release checker: Implement basic tracking of autorelease stack. Next thing is to wire up pools with their contents.
llvm-svn: 65425
2009-02-25 02:54:57 +00:00
Ted Kremenek 47bd78ef73 Implement 'Add' method for GRStatePartialTrait<ImmutableList<T>>.
llvm-svn: 65424
2009-02-25 02:54:00 +00:00
Devang Patel 410dc00184 Fix comments.
llvm-svn: 65423
2009-02-25 01:36:11 +00:00
Devang Patel 9d7d17a8ec Enable debug info emission for objc methods.
llvm-svn: 65422
2009-02-25 01:09:46 +00:00
Ted Kremenek 7a164114f6 Update checker build.
llvm-svn: 65421
2009-02-25 00:54:41 +00:00
Daniel Dunbar a1047857f7 Remove a FIXME; I was mistaken in believing gcc rejected this.
llvm-svn: 65420
2009-02-25 00:22:25 +00:00
Ted Kremenek 86cb75a7cc Fix condition in ccc-analyzer that would cause the analyzer never to be run.
llvm-svn: 65417
2009-02-25 00:10:37 +00:00
Fariborz Jahanian 30b3ac5e9e Minor refactoring.
llvm-svn: 65414
2009-02-24 23:38:42 +00:00
Fariborz Jahanian 240f2b7851 patch for two things.
make sure objc2's nonfragile abi is enacted for Leopard too.
add -fobjc-gc-only flag to the image_info symbol.

llvm-svn: 65413
2009-02-24 23:34:44 +00:00
Ted Kremenek 260c49a712 Fix broken logic from my last commit. Branches only occur at basic blocks that end with terminators.
llvm-svn: 65410
2009-02-24 23:34:17 +00:00
Ted Kremenek c324a0e089 Fix diagnostic regression where the leak diagnostic could appear earlier in the path than the branches taken.
llvm-svn: 65407
2009-02-24 23:30:57 +00:00
Devang Patel ab19ecad22 If Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.
llvm-svn: 65403
2009-02-24 23:16:03 +00:00
Chris Lattner d8b741c85f handle @encode interactions with array initializers.
llvm-svn: 65401
2009-02-24 23:10:27 +00:00
Chris Lattner 94e6c4be9a rename CheckStringLiteralInit to CheckStringInit and pass in the
string size as an argument.

llvm-svn: 65400
2009-02-24 23:01:39 +00:00
Chris Lattner b0912a59d3 make SemaRef be a reference to sema, not a pointer.
llvm-svn: 65399
2009-02-24 22:50:46 +00:00
Chris Lattner 9ececceea9 move InitListChecker to be private to SemaInit.cpp
llvm-svn: 65398
2009-02-24 22:48:58 +00:00
Chris Lattner 94d2f6819f Make CheckSingleInitializer a static function in SemaInit.cpp
llvm-svn: 65397
2009-02-24 22:46:58 +00:00
Chris Lattner edbf3ba3d2 make CheckStringLiteralInit a static function in SemaInit.cpp
llvm-svn: 65396
2009-02-24 22:41:04 +00:00
Chris Lattner 9c60e859a5 change IsStringLiteralInit into a static function in SemaInit.cpp
llvm-svn: 65395
2009-02-24 22:36:59 +00:00
Chris Lattner 0cb7803341 move some initialization checking code from SemaDecl.cpp
to SemaInit.cpp, no functionality change.

llvm-svn: 65394
2009-02-24 22:27:37 +00:00
Chris Lattner d7e7b8e411 first wave of fixes for @encode sema support. This is part of PR3648.
The big difference here is that (like string literal) @encode has 
array type, not pointer type.

llvm-svn: 65391
2009-02-24 22:18:39 +00:00
Ted Kremenek 9b15effcd1 ccc-analyzer: Don't analyze files with '-arch ppc' or '-arch ppc64' since Clang
doesn't support Altivec intrisics nor is it likely that we're currently
generating all the right #defines, etc., for those architectures.

llvm-svn: 65390
2009-02-24 22:07:12 +00:00
Chris Lattner 0be5aa875a some minor cleanups, handle ObjCEncodeExpr in a couple places.
llvm-svn: 65389
2009-02-24 21:54:33 +00:00
Chris Lattner 3bf2878556 improve comments.
llvm-svn: 65388
2009-02-24 21:52:14 +00:00
Fariborz Jahanian 6fe4306195 Set flag for -fobjc-gc in IMAGE_INFO variable.
llvm-svn: 65387
2009-02-24 21:08:09 +00:00
Douglas Gregor eddf4333fd When we're declaring an object or function with linkage, teach name
lookup to skip over names without linkage. This finishes
<rdar://problem/6127293>.

llvm-svn: 65386
2009-02-24 20:03:32 +00:00
Douglas Gregor 5d68a20949 Extend the implicit declaration and checking against out-of-scope
external declarations to also support external variable
declarations. Unified the code for these two cases into two new
subroutines.

Note that we fail to diagnose cases like the one Neil pointed
out, where a visible non-external declaration hides an external
declaration by the same name. That will require some reshuffling of
name lookup.

llvm-svn: 65385
2009-02-24 19:23:27 +00:00
Ted Kremenek c52f9394ce retain/release checker:
- For autorelease pool tracking, keep information about the stack of pools
  separate from their contents. Also, keep track of the number of times an
  autorelease pool will send the "release" message to an object when the pool is
  destroyed.
- Update CFRefCount::Update to return a new state instead of a reference count
  binding. This will allow us to implement more complicated semantics with
  autorelease pools.

llvm-svn: 65384
2009-02-24 19:15:11 +00:00
Daniel Dunbar d4ecca135a Fix IRgen of constant expressions referring to external/static
variables.
 - PR3657.

llvm-svn: 65381
2009-02-24 18:41:57 +00:00
Daniel Dunbar 0b0dcd987d Some initial Obj-C zero cost EH support.
- Only handles cases with @try with no @catch blocks, and there are a
   number of problems with the implementation. Nevertheless, this is
   good enough to handled @synchronized correctly, and some other
   basic uses.

llvm-svn: 65378
2009-02-24 07:47:38 +00:00
Daniel Dunbar d2fd196045 Add a very primitive clang based multifile 'delta'.
- Interface is more or less like multidelta.

 - Keep in mind it won't work very well; delta is O(N^2) frequently in
   practice. multidelta manages to work because it folds lines to keep
   N small, but this is just working on raw tokens. However, I have a
   fancy pants DAG based delta algorithm which will be the bees knees
   once I get it wired to clang.

llvm-svn: 65377
2009-02-24 07:42:32 +00:00
Daniel Dunbar 36ae309434 Add a note about an IRgen optimization opportunity.
llvm-svn: 65376
2009-02-24 06:34:04 +00:00
Chris Lattner 59da739613 Fix PR3635 by handling ## magically
llvm-svn: 65374
2009-02-24 05:29:33 +00:00
Douglas Gregor de681d43eb In C, when we see a function declaration within a local scope, export
that declaration to global scope so that it can be found from other
scopes. This allows us to diagnose redeclaration errors for external
declarations across scopes. We also warn when name lookup finds such
an out-of-scope declaration. This is part of <rdar://problem/6127293>;
we'll also need to do the same thing for variables.

llvm-svn: 65373
2009-02-24 04:26:15 +00:00
Anders Carlsson 729a8202d0 Prevent accidental copying of CodeGenFunction and CodeGenModule.
llvm-svn: 65372
2009-02-24 04:21:31 +00:00
Anders Carlsson b9c9e1d16f Pass the CodeGenModule object to GenerateBlockFunction, instead of *this (which will call the copy constructor).
Also, since we're creating a new CodeGenFunction object for each block function, we don't need to clear the BreakContinueStack.

llvm-svn: 65371
2009-02-24 04:19:41 +00:00