]> granicus.if.org Git - clang/log
clang
15 years agoMake isICE assert when Evaluate can't evaluate an ICE, as suggested by
Eli Friedman [Fri, 27 Feb 2009 04:07:58 +0000 (04:07 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65610 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoThe middle operand in ?: is optional, really.
Mike Stump [Fri, 27 Feb 2009 03:16:57 +0000 (03:16 +0000)]
The middle operand in ?: is optional, really.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65609 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCreate a new TypeNodes.def file that enumerates all of the types,
Douglas Gregor [Thu, 26 Feb 2009 23:50:07 +0000 (23:50 +0000)]
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...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65591 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomake ASTContext::WCharTy a bit more sensical. In C++, it is a disctint type,
Chris Lattner [Thu, 26 Feb 2009 23:43:47 +0000 (23:43 +0000)]
make ASTContext::WCharTy a bit more sensical.  In C++, it is a disctint type,
but in C99 it is just another int type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65590 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix a bozobug.
Chris Lattner [Thu, 26 Feb 2009 23:42:47 +0000 (23:42 +0000)]
fix a bozobug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65589 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorename test
Chris Lattner [Thu, 26 Feb 2009 23:36:18 +0000 (23:36 +0000)]
rename test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65587 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agook, not as broken as I thought, just confusing. This allows
Chris Lattner [Thu, 26 Feb 2009 23:36:02 +0000 (23:36 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65586 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoallow wide strings to initialize arrays compatible with wchar_t.
Chris Lattner [Thu, 26 Feb 2009 23:26:43 +0000 (23:26 +0000)]
allow wide strings to initialize arrays compatible with wchar_t.
Unfortunately this doesn't work yet because wchar_t is completely
broken in C.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65585 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPass -ffreestanding' to clang.
Ted Kremenek [Thu, 26 Feb 2009 23:09:43 +0000 (23:09 +0000)]
Pass -ffreestanding' to clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65584 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDo not issue bogus error on __weak/__strong ivar access.
Fariborz Jahanian [Thu, 26 Feb 2009 23:05:51 +0000 (23:05 +0000)]
Do not issue bogus error on __weak/__strong ivar access.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65583 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix some sema problems with wide strings and hook up basic codegen for them.
Chris Lattner [Thu, 26 Feb 2009 23:01:51 +0000 (23:01 +0000)]
fix some sema problems with wide strings and hook up basic codegen for them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65582 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd -emit-llvm-only option (generate LLVM IR & run passes, but discard
Daniel Dunbar [Thu, 26 Feb 2009 22:39:37 +0000 (22:39 +0000)]
Add -emit-llvm-only option (generate LLVM IR & run passes, but discard
output).
 - For timing IRgen phase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65580 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCouple of meta-data segments were wrong. This patch fixes them.
Fariborz Jahanian [Thu, 26 Feb 2009 22:30:39 +0000 (22:30 +0000)]
Couple of meta-data segments were wrong. This patch fixes them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65578 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake the type associated with a ClassTemplateSpecializationDecl be a
Douglas Gregor [Thu, 26 Feb 2009 22:19:44 +0000 (22:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65577 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPathDiagnosticPiece now automatically strips off trailing periods in diagnostic messages.
Ted Kremenek [Thu, 26 Feb 2009 21:30:32 +0000 (21:30 +0000)]
PathDiagnosticPiece now automatically strips off trailing periods in diagnostic messages.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65574 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd support to emit debug info for objective-c interfaces.
Devang Patel [Thu, 26 Feb 2009 21:10:26 +0000 (21:10 +0000)]
Add support to emit debug info for objective-c interfaces.
(This is not yet used.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65573 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRefine some grammar in the retain/release diagnostics.
Ted Kremenek [Thu, 26 Feb 2009 21:04:07 +0000 (21:04 +0000)]
Refine some grammar in the retain/release diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65571 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIntroduce code modification hints into the diagnostics system. When we
Douglas Gregor [Thu, 26 Feb 2009 21:00:50 +0000 (21:00 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65570 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd Type::hasPointerRepresentation predicate.
Daniel Dunbar [Thu, 26 Feb 2009 20:52:22 +0000 (20:52 +0000)]
Add Type::hasPointerRepresentation predicate.
 - For types whose native representation is a pointer.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65569 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse Loc::IsLocType() instead of isPointerType() and isReferenceType().
Ted Kremenek [Thu, 26 Feb 2009 20:29:19 +0000 (20:29 +0000)]
Use Loc::IsLocType() instead of isPointerType() and isReferenceType().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65568 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove PointerLikeType.
Daniel Dunbar [Thu, 26 Feb 2009 19:54:52 +0000 (19:54 +0000)]
Remove PointerLikeType.
 - Having pointers and references share a base was not a useful
   notion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65567 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoChange PointersToResolve to list the pointee type to resolve, not the
Daniel Dunbar [Thu, 26 Feb 2009 19:48:14 +0000 (19:48 +0000)]
Change PointersToResolve to list the pointee type to resolve, not the
pointer type.
 - Drops use of PointerLikeType.
 - No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65566 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDrop uses of getAsPointerLikeType.
Daniel Dunbar [Thu, 26 Feb 2009 19:13:44 +0000 (19:13 +0000)]
Drop uses of getAsPointerLikeType.
 - No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65563 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix <rdar://problem/6574319> clang issues error on 'readonly' property with a defaul...
Steve Naroff [Thu, 26 Feb 2009 19:11:32 +0000 (19:11 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65562 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDrop uses of isPointerLikeType.
Daniel Dunbar [Thu, 26 Feb 2009 19:03:24 +0000 (19:03 +0000)]
Drop uses of isPointerLikeType.
 - No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65560 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd end of line at end.
Mike Stump [Thu, 26 Feb 2009 19:00:14 +0000 (19:00 +0000)]
Add end of line at end.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65557 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agothis got moved to top level
Chris Lattner [Thu, 26 Feb 2009 18:38:21 +0000 (18:38 +0000)]
this got moved to top level

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65553 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix an inconsistance in objc2's meta-data related to
Fariborz Jahanian [Thu, 26 Feb 2009 18:23:47 +0000 (18:23 +0000)]
Fix an inconsistance in objc2's meta-data related to
the symbol for the root meta-data.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65548 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix <rdar://problem/6614945> method not found.
Steve Naroff [Thu, 26 Feb 2009 18:16:19 +0000 (18:16 +0000)]
Fix <rdar://problem/6614945> method not found.

This was a fairly recent regression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65547 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomove this makefile goop up to the top level llvm makefile.
Chris Lattner [Thu, 26 Feb 2009 17:48:04 +0000 (17:48 +0000)]
move this makefile goop up to the top level llvm makefile.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65544 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd test for enum types
Anders Carlsson [Thu, 26 Feb 2009 17:38:19 +0000 (17:38 +0000)]
Add test for enum types

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65540 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFor scan-build based analyses, use the '-analyzer-eargely-assume' setting by default...
Ted Kremenek [Thu, 26 Feb 2009 17:36:31 +0000 (17:36 +0000)]
For scan-build based analyses, use the '-analyzer-eargely-assume' setting by default (turning it on to test how it impacts users).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65535 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSet tab width to 2 on a number of CG related files
Anders Carlsson [Thu, 26 Feb 2009 17:34:58 +0000 (17:34 +0000)]
Set tab width to 2 on a number of CG related files

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65534 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoClassify enum types correctly
Anders Carlsson [Thu, 26 Feb 2009 17:31:15 +0000 (17:31 +0000)]
Classify enum types correctly

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65533 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix http://llvm.org/bugs/show_bug.cgi?id=3544.
Steve Naroff [Thu, 26 Feb 2009 15:55:06 +0000 (15:55 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65532 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake more AST nodes and semantic checkers dependent-expression-aware.
Sebastian Redl [Thu, 26 Feb 2009 14:39:58 +0000 (14:39 +0000)]
Make more AST nodes and semantic checkers dependent-expression-aware.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65529 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix ObjCInterfaceDecl::lookupInstanceMethod()/lookupClassMethod() to search in inheri...
Steve Naroff [Thu, 26 Feb 2009 11:32:02 +0000 (11:32 +0000)]
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!).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65526 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove short-circuit evaluation and the extension warnings. I'm
Eli Friedman [Thu, 26 Feb 2009 10:19:36 +0000 (10:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65525 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRewrite of isIntegerConstantExpr to be centered around Evaluate. This
Eli Friedman [Thu, 26 Feb 2009 09:29:13 +0000 (09:29 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65524 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoEnable export maps also on {Free, Net}BSD.
Anton Korobeynikov [Thu, 26 Feb 2009 09:04:29 +0000 (09:04 +0000)]
Enable export maps also on {Free, Net}BSD.
Don't ask me, how does this makefile-horribleness even work ;)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65522 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFixup spacing.
Mike Stump [Thu, 26 Feb 2009 08:00:25 +0000 (08:00 +0000)]
Fixup spacing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65519 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agox86_64 ABI: Qualified id types are passed as pointers.
Daniel Dunbar [Thu, 26 Feb 2009 07:21:35 +0000 (07:21 +0000)]
x86_64 ABI: Qualified id types are passed as pointers.
 - <rdar://problem/6622451> Bad x86_64 code gen for message call taking one argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65510 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd an export map for clang on Linux.
Owen Anderson [Thu, 26 Feb 2009 06:29:54 +0000 (06:29 +0000)]
Add an export map for clang on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65504 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoZap the Sema constant initializer checking code that we aren't using
Eli Friedman [Thu, 26 Feb 2009 04:47:58 +0000 (04:47 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65502 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix for PR3663/3669: use TryToFixInvalidVariablyModifiedType for
Eli Friedman [Thu, 26 Feb 2009 03:58:54 +0000 (03:58 +0000)]
Fix for PR3663/3669: use TryToFixInvalidVariablyModifiedType for
variable declarations where applicable.  Also, a few fixes to
TryToFixInvalidVariablyModifiedType for issues that this exposed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65500 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse RecordFirst/RecordLast range checks in DeclContext
Douglas Gregor [Thu, 26 Feb 2009 00:02:51 +0000 (00:02 +0000)]
Use RecordFirst/RecordLast range checks in DeclContext

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65489 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplementing parsing of template-ids as class-names, so that we can
Douglas Gregor [Wed, 25 Feb 2009 23:52:28 +0000 (23:52 +0000)]
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> { };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65488 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCodeGen support for copied BlockDeclRefExprs.
Mike Stump [Wed, 25 Feb 2009 23:33:13 +0000 (23:33 +0000)]
CodeGen support for copied BlockDeclRefExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65487 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix subtle bug in EvalEagerlyAssume: Check if the previous node was at the same state...
Ted Kremenek [Wed, 25 Feb 2009 23:32:10 +0000 (23:32 +0000)]
Fix subtle bug in EvalEagerlyAssume: Check if the previous node was at the same statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65486 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix recently introduced switch case fallthrough bug.
Ted Kremenek [Wed, 25 Feb 2009 23:11:49 +0000 (23:11 +0000)]
Fix recently introduced switch case fallthrough bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65485 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoCope with use of the token '>>' inside a template argument list, e.g.,
Douglas Gregor [Wed, 25 Feb 2009 23:02:36 +0000 (23:02 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65484 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoscan-build now looks for ccc-analyzer first in the 'bin' subdirectory and then the...
Ted Kremenek [Wed, 25 Feb 2009 22:54:02 +0000 (22:54 +0000)]
scan-build now looks for ccc-analyzer first in the 'bin' subdirectory and then the directory where scan-build lives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65483 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAdd experimental logic in GRExprEngine::EvalEagerlyAssume() to handle
Ted Kremenek [Wed, 25 Feb 2009 22:32:02 +0000 (22:32 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65480 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImprove location information on "reused" class template specialization
Douglas Gregor [Wed, 25 Feb 2009 22:18:32 +0000 (22:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65478 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPerform additional semantic checking of class template
Douglas Gregor [Wed, 25 Feb 2009 22:02:03 +0000 (22:02 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65476 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoDo not automatically run the 'missing -dealloc' check until we have adequate time...
Ted Kremenek [Wed, 25 Feb 2009 21:08:30 +0000 (21:08 +0000)]
Do not automatically run the 'missing -dealloc' check until we have adequate time to make it much smarter (too much noise).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65474 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoTemporarily disable clearing of insert point (to indicate unreachable
Daniel Dunbar [Wed, 25 Feb 2009 20:59:29 +0000 (20:59 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65473 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoAllow constant initializers to reference their defining decl.
Daniel Dunbar [Wed, 25 Feb 2009 20:08:33 +0000 (20:08 +0000)]
Allow constant initializers to reference their defining decl.
 - PR3662.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65472 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoInclude the appropriate header for malloc
Douglas Gregor [Wed, 25 Feb 2009 19:48:02 +0000 (19:48 +0000)]
Include the appropriate header for malloc

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65471 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFold GeneraticStaticBlockVarDecl into callers.
Daniel Dunbar [Wed, 25 Feb 2009 19:45:19 +0000 (19:45 +0000)]
Fold GeneraticStaticBlockVarDecl into callers.
 - No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65470 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement parsing of nested-name-specifiers that involve template-ids, e.g.,
Douglas Gregor [Wed, 25 Feb 2009 19:37:18 +0000 (19:37 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65467 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoPull COdeGenFunction::CreateStaticBlockVarDecl (just for creating the
Daniel Dunbar [Wed, 25 Feb 2009 19:24:29 +0000 (19:24 +0000)]
Pull COdeGenFunction::CreateStaticBlockVarDecl (just for creating the
global variable) out of GenerateStaticBlockVarDecl.
 - No intended functionality change.
 - Prep for some mild cleanups and PR3662.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65466 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoadd c++ search path for GCC 4.2, PR3668, patch by Pawel Worach!
Chris Lattner [Wed, 25 Feb 2009 18:06:37 +0000 (18:06 +0000)]
add c++ search path for GCC 4.2, PR3668, patch by Pawel Worach!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65462 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUse CheckAssignmentConstraints for checking the cleanup attr function. Fixes PR3656.
Anders Carlsson [Wed, 25 Feb 2009 17:19:08 +0000 (17:19 +0000)]
Use CheckAssignmentConstraints for checking the cleanup attr function. Fixes PR3656.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65461 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoC99 DR #316 implies that the function parameter types that are known
Douglas Gregor [Wed, 25 Feb 2009 16:33:18 +0000 (16:33 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65460 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofix (hopefully) some validation errors
Gabor Greif [Wed, 25 Feb 2009 15:22:45 +0000 (15:22 +0000)]
fix (hopefully) some validation errors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65455 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agominor tweaks to readability
Gabor Greif [Wed, 25 Feb 2009 09:45:40 +0000 (09:45 +0000)]
minor tweaks to readability

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65440 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoupdate
Chris Lattner [Wed, 25 Feb 2009 05:43:33 +0000 (05:43 +0000)]
update

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65433 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoHeaders are basically done, debug info is just about done (and
Chris Lattner [Wed, 25 Feb 2009 05:39:01 +0000 (05:39 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65432 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoclang seems "generally useful" for c and objc by now, though obviously bugs
Chris Lattner [Wed, 25 Feb 2009 05:35:47 +0000 (05:35 +0000)]
clang seems "generally useful" for c and objc by now, though obviously bugs
still remain.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65431 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMinor cleanup for IntToBlockPointer so it applies to all callers of
Eli Friedman [Wed, 25 Feb 2009 04:20:42 +0000 (04:20 +0000)]
Minor cleanup for IntToBlockPointer so it applies to all callers of
Sema::CheckAssignmentConstraints; not really visible, but the right
thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65428 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoretain/release checker: Implement basic tracking of autorelease stack. Next thing...
Ted Kremenek [Wed, 25 Feb 2009 02:54:57 +0000 (02:54 +0000)]
retain/release checker: Implement basic tracking of autorelease stack.  Next thing is to wire up pools with their contents.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65425 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoImplement 'Add' method for GRStatePartialTrait<ImmutableList<T>>.
Ted Kremenek [Wed, 25 Feb 2009 02:54:00 +0000 (02:54 +0000)]
Implement 'Add' method for GRStatePartialTrait<ImmutableList<T>>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65424 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix comments.
Devang Patel [Wed, 25 Feb 2009 01:36:11 +0000 (01:36 +0000)]
Fix comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65423 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoEnable debug info emission for objc methods.
Devang Patel [Wed, 25 Feb 2009 01:09:46 +0000 (01:09 +0000)]
Enable debug info emission for objc methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65422 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoUpdate checker build.
Ted Kremenek [Wed, 25 Feb 2009 00:54:41 +0000 (00:54 +0000)]
Update checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65421 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoRemove a FIXME; I was mistaken in believing gcc rejected this.
Daniel Dunbar [Wed, 25 Feb 2009 00:22:25 +0000 (00:22 +0000)]
Remove a FIXME; I was mistaken in believing gcc rejected this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65420 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix condition in ccc-analyzer that would cause the analyzer never to be run.
Ted Kremenek [Wed, 25 Feb 2009 00:10:37 +0000 (00:10 +0000)]
Fix condition in ccc-analyzer that would cause the analyzer never to be run.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65417 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMinor refactoring.
Fariborz Jahanian [Tue, 24 Feb 2009 23:38:42 +0000 (23:38 +0000)]
Minor refactoring.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65414 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agopatch for two things.
Fariborz Jahanian [Tue, 24 Feb 2009 23:34:44 +0000 (23:34 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65413 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix broken logic from my last commit. Branches only occur at basic blocks that end...
Ted Kremenek [Tue, 24 Feb 2009 23:34:17 +0000 (23:34 +0000)]
Fix broken logic from my last commit.  Branches only occur at basic blocks that end with terminators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65410 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix diagnostic regression where the leak diagnostic could appear earlier in the path...
Ted Kremenek [Tue, 24 Feb 2009 23:30:57 +0000 (23:30 +0000)]
Fix diagnostic regression where the leak diagnostic could appear earlier in the path than the branches taken.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65407 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoIf Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.
Devang Patel [Tue, 24 Feb 2009 23:16:03 +0000 (23:16 +0000)]
If Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65403 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agohandle @encode interactions with array initializers.
Chris Lattner [Tue, 24 Feb 2009 23:10:27 +0000 (23:10 +0000)]
handle @encode interactions with array initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65401 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agorename CheckStringLiteralInit to CheckStringInit and pass in the
Chris Lattner [Tue, 24 Feb 2009 23:01:39 +0000 (23:01 +0000)]
rename CheckStringLiteralInit to CheckStringInit and pass in the
string size as an argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65400 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomake SemaRef be a reference to sema, not a pointer.
Chris Lattner [Tue, 24 Feb 2009 22:50:46 +0000 (22:50 +0000)]
make SemaRef be a reference to sema, not a pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65399 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomove InitListChecker to be private to SemaInit.cpp
Chris Lattner [Tue, 24 Feb 2009 22:48:58 +0000 (22:48 +0000)]
move InitListChecker to be private to SemaInit.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65398 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoMake CheckSingleInitializer a static function in SemaInit.cpp
Chris Lattner [Tue, 24 Feb 2009 22:46:58 +0000 (22:46 +0000)]
Make CheckSingleInitializer a static function in SemaInit.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65397 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomake CheckStringLiteralInit a static function in SemaInit.cpp
Chris Lattner [Tue, 24 Feb 2009 22:41:04 +0000 (22:41 +0000)]
make CheckStringLiteralInit a static function in SemaInit.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65396 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agochange IsStringLiteralInit into a static function in SemaInit.cpp
Chris Lattner [Tue, 24 Feb 2009 22:36:59 +0000 (22:36 +0000)]
change IsStringLiteralInit into a static function in SemaInit.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65395 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agomove some initialization checking code from SemaDecl.cpp
Chris Lattner [Tue, 24 Feb 2009 22:27:37 +0000 (22:27 +0000)]
move some initialization checking code from SemaDecl.cpp
to SemaInit.cpp, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65394 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agofirst wave of fixes for @encode sema support. This is part of PR3648.
Chris Lattner [Tue, 24 Feb 2009 22:18:39 +0000 (22:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65391 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoccc-analyzer: Don't analyze files with '-arch ppc' or '-arch ppc64' since Clang
Ted Kremenek [Tue, 24 Feb 2009 22:07:12 +0000 (22:07 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65390 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agosome minor cleanups, handle ObjCEncodeExpr in a couple places.
Chris Lattner [Tue, 24 Feb 2009 21:54:33 +0000 (21:54 +0000)]
some minor cleanups, handle ObjCEncodeExpr in a couple places.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65389 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoimprove comments.
Chris Lattner [Tue, 24 Feb 2009 21:52:14 +0000 (21:52 +0000)]
improve comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65388 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoSet flag for -fobjc-gc in IMAGE_INFO variable.
Fariborz Jahanian [Tue, 24 Feb 2009 21:08:09 +0000 (21:08 +0000)]
Set flag for -fobjc-gc in IMAGE_INFO variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65387 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoWhen we're declaring an object or function with linkage, teach name
Douglas Gregor [Tue, 24 Feb 2009 20:03:32 +0000 (20:03 +0000)]
When we're declaring an object or function with linkage, teach name
lookup to skip over names without linkage. This finishes
<rdar://problem/6127293>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65386 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoExtend the implicit declaration and checking against out-of-scope
Douglas Gregor [Tue, 24 Feb 2009 19:23:27 +0000 (19:23 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65385 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoretain/release checker:
Ted Kremenek [Tue, 24 Feb 2009 19:15:11 +0000 (19:15 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65384 91177308-0d34-0410-b5e6-96231b3b80d8

15 years agoFix IRgen of constant expressions referring to external/static
Daniel Dunbar [Tue, 24 Feb 2009 18:41:57 +0000 (18:41 +0000)]
Fix IRgen of constant expressions referring to external/static
variables.
 - PR3657.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65381 91177308-0d34-0410-b5e6-96231b3b80d8