Commit Graph

5509 Commits

Author SHA1 Message Date
Sebastian Redl 4915e63d3b Test exception spec compatibility on return type and parameters.
Along the way, use RequireCompleteType when testing exception spec types.
Separate all the ugly spec stuff into its own file.

llvm-svn: 83764
2009-10-11 09:03:14 +00:00
Sebastian Redl 5d43164bc2 Implement the core checking for compatible exception specifications in assignment and initialization.
The exception specification of the assignee must be the same or a subset of the target. In addition, exception specifications on arguments and return types must be equivalent, but this is not implemented yet.
This currently produces two diagnostics for every invalid assignment/initialization, due to the diagnostic produced outside PerformImplicitConversion, e.g. in CheckSingleInitializer. I don't know how to suppress this; in any case I think it is the wrong place for a diagnostic, since there are other diagnostics produced inside the function. So I'm leaving it as it is for the moment.

llvm-svn: 83710
2009-10-10 12:04:10 +00:00
John McCall 6538c93050 Qualified lookup through using declarations. Diagnose a new type of ambiguity.
Split the various ambiguous result enumerators into their own enum.  Tests
for most of C++ [namespace.qual].

llvm-svn: 83700
2009-10-10 05:48:19 +00:00
Anders Carlsson 7f84ed9287 Add CheckCallReturnType and start using it for regular call expressions. This will improve error messages. For
struct B;

B f();

void g() {
f();
}

We now get

t.cpp:6:3: error: calling 'f' with incomplete return type 'struct B'
  f();
  ^~~
t.cpp:3:3: note: 'f' declared here
B f();
  ^
t.cpp:1:8: note: forward declaration of 'struct B'
struct B;
       ^

llvm-svn: 83692
2009-10-09 23:51:55 +00:00
Mike Stump 1ba6edb030 Efficiency refinements.
llvm-svn: 83666
2009-10-09 20:16:49 +00:00
Axel Naumann 04ca7e181f Passing const Triple& is sufficient for AddDefaultSystemIncludePaths()
llvm-svn: 83663
2009-10-09 19:37:12 +00:00
Fariborz Jahanian 0fe5e0308e Produce good looking diagnostics on ambiguous built-in operators.
Now we produce things like:
bug1.cpp:21:11: error: use of overloaded operator '->*' is ambiguous
        int i = c->*pmf;        // expected-error {{use of overloaded operator '->*' is ambiguous}} \
                ~^  ~~~
bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int const struct A::*')
bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int restrict struct A::*')
...

Still need to look at an issue (indicated as FIXME in the test case).

llvm-svn: 83650
2009-10-09 17:09:58 +00:00
Zhongxing Xu 9b6a9be301 Remove unused code.
llvm-svn: 83612
2009-10-09 02:24:00 +00:00
Fariborz Jahanian 29f9d39568 Improve on reporting ambiguity involving built-in candidates.
I still don't like it but it is improvement over what we had.

llvm-svn: 83603
2009-10-09 00:13:15 +00:00
Mike Stump 904ad90bc8 Set up include paths for VC++ and Cygwin headers, along with the
existing MinGW headers, plus the newer 4.4.0 version.  Patch by John
Thompson.

llvm-svn: 83594
2009-10-08 23:29:47 +00:00
Mike Stump c99c022841 This fixes support for complex literals, reworked to avoid a goto, and
to add a flag noting the presence of a Microsoft extension suffix (i8,
i16, i32, i64).  Patch by John Thompson.

llvm-svn: 83591
2009-10-08 22:55:36 +00:00
Fariborz Jahanian 8ae5b0a18b Fix up error reporting when object cannot be constructed
because of missing default constructor of a member.
Fixes pr5154.

llvm-svn: 83583
2009-10-08 22:15:49 +00:00
Steve Naroff 936354c62a Add code completion support for ObjC property declarations/attributes.
llvm-svn: 83579
2009-10-08 21:55:05 +00:00
Douglas Gregor 3beaf9bbcd Implement support for -Wunused-variable, from Oscar Bonilla!
llvm-svn: 83577
2009-10-08 21:35:42 +00:00
Douglas Gregor 18289eeb1d Fix an assertion in the XML output, from Olaf Krzikalla!
llvm-svn: 83576
2009-10-08 21:29:50 +00:00
Douglas Gregor bbe8f46621 Improve checking for specializations of member classes of class
templates, and keep track of how those member classes were
instantiated or specialized. 

Make sure that we don't try to instantiate an explicitly-specialized
member class of a class template, when that explicit specialization
was a declaration rather than a definition.

llvm-svn: 83547
2009-10-08 15:14:33 +00:00
Douglas Gregor 86d142a801 For instantiations of static data members of class templates, keep
track of the kind of specialization or instantiation. Also, check the
scope of the specialization and ensure that a specialization
declaration without an initializer is not a definition.

llvm-svn: 83533
2009-10-08 07:24:58 +00:00
Douglas Gregor f43472bd84 Compress storage for MemberSpecializationInfo into a single
pointer. Yay, PointerIntPair.

llvm-svn: 83512
2009-10-08 00:19:07 +00:00
Douglas Gregor d801b06232 Keep track of whether a member function instantiated from a member
function of a class template was implicitly instantiated, explicitly
instantiated (declaration or definition), or explicitly
specialized. The same MemberSpecializationInfo structure will be used
for static data members and member classes as well.

llvm-svn: 83509
2009-10-07 23:56:10 +00:00
John McCall c3987485f2 Refactoring around friend class templates. Better error message for friend enums.
Don't create a new declaration for friend classes if a declaration already exists.

llvm-svn: 83505
2009-10-07 23:34:25 +00:00
Douglas Gregor 5c0405d484 Type checking for specializations of member functions of class
templates. Previously, these weren't handled as specializations at
all. The AST for representing these as specializations is still a work
in progress.

llvm-svn: 83498
2009-10-07 22:35:40 +00:00
Fariborz Jahanian 3ee21f1b91 Fixes problem in finding visible convertion functions of a class
where matching conversion types in base classes were still visible.
Plus refactoring and cleanup.
Added a test case.

llvm-svn: 83485
2009-10-07 20:43:36 +00:00
Douglas Gregor 40fb74484e Diagnose explicit instantiations and specializations that occur in class scope
llvm-svn: 83473
2009-10-07 17:30:37 +00:00
Ted Kremenek 8c6066d021 Add 'template' keyword to disambiguate the use of a member template within a templated class. Hopefully this will please the buildbots.
llvm-svn: 83452
2009-10-07 06:20:14 +00:00
Ted Kremenek c3661decc3 Change ExplodedNode to have its NodeGroups all BumpPtrAllocated, avoiding malloc() traffic when adding successors/predecessors to a node. This was done by introducing BumpVector, which is essentially SmallVector with all memory being BumpPtrAllocated (this can certainly be cleaned up or moved into llvm/ADT).
This change yields a 1.8% speed increase when running the analyzer (with -analyzer-store=region) on a small benchmark file.

llvm-svn: 83439
2009-10-07 00:42:52 +00:00
Douglas Gregor 548886518d Refactor checking of the scope of explicit template specialization
declarations and explicit template instantiations, improving
diagnostics and making the code usable for function template
specializations (as well as class template specializations and partial
specializations). 

llvm-svn: 83436
2009-10-07 00:13:32 +00:00
Mike Stump 4992f59699 Fix eof.
llvm-svn: 83432
2009-10-06 23:38:31 +00:00
Mike Stump da6822f584 Add codegen for __builtin_abort. Convert to FileCheck.
llvm-svn: 83427
2009-10-06 22:58:45 +00:00
Mike Stump 23491449d6 Add more of __builtin_abort, WIP, still missing codegen.
llvm-svn: 83410
2009-10-06 20:30:09 +00:00
Douglas Gregor 36d1b14dde Refactor the code that walks a C++ inheritance hierarchy, searching
for bases, members, overridden virtual methods, etc. The operations
isDerivedFrom and lookupInBases are now provided by CXXRecordDecl,
rather than by Sema, so that CodeGen and other clients can use them
directly.

llvm-svn: 83396
2009-10-06 17:59:45 +00:00
Rafael Espindola 7787d79c7b Add the -nostdclanginc option to clang (the driver).
llvm-svn: 83377
2009-10-06 12:45:37 +00:00
Ted Kremenek 8ec5771dcb Fix: <rdar://problem/7275774> Static analyzer warns about NULL pointer when
adding assert

This fix required a few changes:

SimpleSValuator:
- Eagerly replace a symbolic value with its constant value in EvalBinOpNN
  when it is constrained to a constant.  This allows us to better constant fold
  values along a path.
- Handle trivial case of '<', '>' comparison of pointers when the two pointers
  are exactly the same.

RegionStoreManager:

llvm-svn: 83358
2009-10-06 01:39:48 +00:00
Rafael Espindola c3031a9643 Refactor the c++ include path a bit.
llvm-svn: 83357
2009-10-06 01:33:02 +00:00
Mike Stump 4348c565ad This is slightly contentious, but, if llvm has gone to addressable
units, we should as well.  The problem is the non-predictability of
the dimension of the values.  I'd love for the dimension to be part of
the static type system...  but in C++ it is kinda annoying to do.

llvm-svn: 83345
2009-10-05 23:40:59 +00:00
Douglas Gregor d54f3a1e58 Encode the Clang branch and Subversion revision into a PCH file, and
assume that PCH files from different Clang revisions are not
compatible. Addresses <rdar://problem/7266572>.

llvm-svn: 83323
2009-10-05 21:07:28 +00:00
Fariborz Jahanian 092cd6e624 Patch to implement Protocols on class extensions.
<rdar://problem/7269631> Protocols on class extensions don't work

llvm-svn: 83322
2009-10-05 20:41:32 +00:00
Douglas Gregor 1b7035da6f Provide a common set of routines in Version.h that return Subversion
branch/revision information. Use that information in the driver,
rather than one-off branch/revision computation. 

llvm-svn: 83321
2009-10-05 20:33:49 +00:00
Douglas Gregor f343fd8929 Make sure to free the explicit template arguments provided for an
explicit instantiation. Also, tighten up reference-count checking to
help catch these issues earlier. Fixes PR5069.

llvm-svn: 83225
2009-10-01 23:51:25 +00:00
Steve Naroff bb69c94798 - Remove Sema::FindMethodInNestedImplementations().
- Add ObjCInterfaceDecl::lookupPrivateInstanceMethod().
- Convert clients.

No functionality change - One less method in Sema:-)

llvm-svn: 83224
2009-10-01 23:46:04 +00:00
John McCall 4fa5342758 Anonymous namespaces, sema + codegen. A lot of semantics are still broken,
apparently because using directives aren't quite working correctly.

llvm-svn: 83184
2009-10-01 00:25:31 +00:00
Fariborz Jahanian db82308633 Issue good diagnostics when initializing a refernce type with
a bad initializer. Fixes pr4274.

llvm-svn: 83169
2009-09-30 21:23:30 +00:00
Tanya Lattner fd2dcba7f3 Add an error for function parameters that have a qualified address space since this is not allowed by the embedded c extension spec.
llvm-svn: 83165
2009-09-30 20:47:43 +00:00
Fariborz Jahanian 10ce958550 self-referecing operator '->' member function was causing
infinit recursion. This patch fixes it. [13.3.1.2]-p2

llvm-svn: 83124
2009-09-30 00:19:41 +00:00
John McCall a192536ebe Desugaring optimizations. Add single-step desugaring methods to all
concrete types.  Use unqualified desugaring for getAs<> and sundry.
Fix a few users to either not desugar or use qualified desugar, as seemed
appropriate.  Removed Type's qualified desugar method, as it was easy
to accidentally use instead of QualType's.

llvm-svn: 83116
2009-09-29 23:03:30 +00:00
Argyrios Kyrtzidis 8da9ce6328 Pull TypeLocVisitor into its own header file.
llvm-svn: 83112
2009-09-29 21:27:32 +00:00
Argyrios Kyrtzidis edd1129c36 Fix Decl class hierarchy.
llvm-svn: 83109
2009-09-29 21:26:14 +00:00
Argyrios Kyrtzidis 0643e333a3 Introduce ObjCInterfaceLoc which provides type source information for ObjC interfaces.
llvm-svn: 83097
2009-09-29 19:45:22 +00:00
Argyrios Kyrtzidis d4bcfaf351 Introduce TypedefLoc::getTypedefDecl().
llvm-svn: 83096
2009-09-29 19:44:47 +00:00
Argyrios Kyrtzidis 4cbe85904c Modify ASTLocation and apart from being a Decl or Stmt, allow it to also be:
-A NamedDecl reference
-A TypeLoc

llvm-svn: 83095
2009-09-29 19:44:27 +00:00
Argyrios Kyrtzidis 73360e1bbb Introduce ObjCProtocolListLoc for keeping source location information for protocol references.
llvm-svn: 83094
2009-09-29 19:43:35 +00:00