Граф коммитов

4077 Коммитов

Автор SHA1 Сообщение Дата
Mike Stump befbcf4e02 The middle operand in ?: is optional, really.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65609 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 03:16:57 +00:00
Douglas Gregor 72564e7327 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
2009-02-26 23:50:07 +00:00
Chris Lattner 3a2503227c 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
2009-02-26 23:43:47 +00:00
Chris Lattner 220b6369d7 fix a bozobug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65589 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 23:42:47 +00:00
Chris Lattner 19753cfa60 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
2009-02-26 23:36:02 +00:00
Chris Lattner 8879e3b29d 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
2009-02-26 23:26:43 +00:00
Fariborz Jahanian fb41ca86ee 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
2009-02-26 23:05:51 +00:00
Chris Lattner dbb1ecc32c 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
2009-02-26 23:01:51 +00:00
Fariborz Jahanian 21228b7753 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
2009-02-26 22:30:39 +00:00
Douglas Gregor fc705b8434 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
2009-02-26 22:19:44 +00:00
Ted Kremenek 8af2975d50 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
2009-02-26 21:30:32 +00:00
Devang Patel 9ca36b6641 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
2009-02-26 21:10:26 +00:00
Ted Kremenek e198116646 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
2009-02-26 21:04:07 +00:00
Douglas Gregor 4b2d3f7bcc 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
2009-02-26 21:00:50 +00:00
Daniel Dunbar 8958891f5f 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
2009-02-26 20:52:22 +00:00
Ted Kremenek 3daea0a051 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
2009-02-26 20:29:19 +00:00
Daniel Dunbar 68694ada8f 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
2009-02-26 19:54:52 +00:00
Daniel Dunbar 6aeae7fa9c 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
2009-02-26 19:48:14 +00:00
Daniel Dunbar bb71001d28 Drop uses of getAsPointerLikeType.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65563 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 19:13:44 +00:00
Steve Naroff 22dc0b0435 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
2009-02-26 19:11:32 +00:00
Daniel Dunbar 24a9f6e11d Drop uses of isPointerLikeType.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 19:03:24 +00:00
Fariborz Jahanian fab98c4e24 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
2009-02-26 18:23:47 +00:00
Steve Naroff 1f484f4aef 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
2009-02-26 18:16:19 +00:00
Anders Carlsson 708762b66a Classify enum types correctly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 17:31:15 +00:00
Steve Naroff f1afaf6fe2 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
2009-02-26 15:55:06 +00:00
Sebastian Redl 2850784bda 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
2009-02-26 14:39:58 +00:00
Steve Naroff b558422a49 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
2009-02-26 11:32:02 +00:00
Eli Friedman 33ef1456a1 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
2009-02-26 10:19:36 +00:00
Eli Friedman e28d7195aa 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
2009-02-26 09:29:13 +00:00
Mike Stump 54cc43fd66 Fixup spacing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 08:00:25 +00:00
Daniel Dunbar 9a8c2e9051 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
2009-02-26 07:21:35 +00:00
Eli Friedman 2129828098 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
2009-02-26 04:47:58 +00:00
Eli Friedman bc592e6e56 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
2009-02-26 03:58:54 +00:00
Douglas Gregor 65100792a6 Use RecordFirst/RecordLast range checks in DeclContext
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65489 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 00:02:51 +00:00
Douglas Gregor 7f43d67647 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
2009-02-25 23:52:28 +00:00
Mike Stump 8a2b4b1c5b CodeGen support for copied BlockDeclRefExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65487 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 23:33:13 +00:00
Ted Kremenek b293902c5c 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
2009-02-25 23:32:10 +00:00
Ted Kremenek 3579073233 Fix recently introduced switch case fallthrough bug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65485 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 23:11:49 +00:00
Douglas Gregor 3965b7be25 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
2009-02-25 23:02:36 +00:00
Ted Kremenek 48af2a9c1e 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
2009-02-25 22:32:02 +00:00
Douglas Gregor 6bc9f7e286 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
2009-02-25 22:18:32 +00:00
Douglas Gregor 88b7094185 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
2009-02-25 22:02:03 +00:00
Daniel Dunbar 0334a4ec63 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
2009-02-25 20:59:29 +00:00
Daniel Dunbar e5731f8149 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
2009-02-25 20:08:33 +00:00
Daniel Dunbar a985b31fc3 Fold GeneraticStaticBlockVarDecl into callers.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65470 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 19:45:19 +00:00
Douglas Gregor 39a8de10c1 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
2009-02-25 19:37:18 +00:00
Daniel Dunbar 0096acf421 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
2009-02-25 19:24:29 +00:00
Chris Lattner 01e4b5c3bf 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
2009-02-25 18:06:37 +00:00
Anders Carlsson b90052a8cc 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
2009-02-25 17:19:08 +00:00
Douglas Gregor 2224f84658 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
2009-02-25 16:33:18 +00:00