Commit Graph

4791 Commits

Author SHA1 Message Date
Anders Carlsson b5296558f1 If the base type of a member call is a record type we don't need to emit a virtual call.
llvm-svn: 83816
2009-10-11 23:55:52 +00:00
Sebastian Redl 6e4c871855 Types appearing more than once in a spec shouldn't matter.
llvm-svn: 83766
2009-10-11 09:11:23 +00:00
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
Fariborz Jahanian 07ca72725a Generate weak read barriers when reading a weak __block
variable inside the block.

llvm-svn: 83729
2009-10-10 20:07:56 +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 c4859baea4 Check that the return type is complete when calling a member function.
llvm-svn: 83694
2009-10-10 00:06:20 +00:00
Anders Carlsson 1040f2e9db Add another test.
llvm-svn: 83693
2009-10-09 23:58:25 +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
John McCall 9f3059a192 Refactor the LookupResult API to simplify most common operations. Require users to
pass a LookupResult reference to lookup routines.  Call out uses which assume a single
result.

llvm-svn: 83674
2009-10-09 21:13:30 +00:00
Douglas Gregor 7f34baeb4b When declaring a friend class template, we may end up finding an
injected-class-name (e.g., when we're referring to other
specializations of the current class template). Make sure that we see
the template rather than the injected-class-name. Fixes PR4768.

llvm-svn: 83672
2009-10-09 21:11:42 +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
Steve Naroff 3b08630b06 - Fixup SortCodeCompleteResult() to properly sort keywords on Mac OS (compare was system dependent). Worked on Linux, failed on Mac OS (which caused the recently added testcase to fail on Linux).
- Sort results in testcase.

llvm-svn: 83597
2009-10-08 23:45:10 +00:00
Mike Stump f8c1f0d1f0 Speed up testing by avoiding stdio.h, also helps testing on windows.
Patch by John Thompson.

llvm-svn: 83593
2009-10-08 23:05:06 +00:00
Douglas Gregor 1245e6ff69 Tests for C++ [expr], from James Porter!
llvm-svn: 83588
2009-10-08 22:38:14 +00:00
Mike Stump e07e33a196 Tolerate .exe on executables. Patch by John Thompson. Changed * to .* by me.
llvm-svn: 83586
2009-10-08 22:30:02 +00:00
Mike Stump 8409f9102b Tolerate .exe on executables. Patch by John Thompson.
llvm-svn: 83584
2009-10-08 22:25:29 +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
Mike Stump 03686660b1 In VC++, the *printf functions put an extra "0" in the exponent part
of a floating point number.  This add regular expressions to account
for this.  Patch by John Thompson.

llvm-svn: 83581
2009-10-08 21:57:41 +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
Mike Stump c2eeac617d Convert some tests to FileCheck to be more portable. Patch by John Thompson.
llvm-svn: 83578
2009-10-08 21:52:07 +00:00
Douglas Gregor 3beaf9bbcd Implement support for -Wunused-variable, from Oscar Bonilla!
llvm-svn: 83577
2009-10-08 21:35:42 +00:00
Fariborz Jahanian 03b4f666ed Implement [expr.mptr.oper]p6 for '->*' operator.
llvm-svn: 83562
2009-10-08 18:00:39 +00:00
Anders Carlsson a18ed9b113 If a global initializer has a non-trivial constructor or destructor, we never want to defer generation of it, even if it is declared static.
With this change we're finally able to compile and run the (infamous)

#include <string>
#include <iostream>

int main(int argc, char **argv) {
  std::cout << "Hello, World" << std::endl;
}

$ clang hello.cpp -lstdc++ -o hello
$ ./hello 
Hello, World

llvm-svn: 83559
2009-10-08 17:28:59 +00:00
Anders Carlsson 9776bd61bc Port test over to FileCheck.
llvm-svn: 83558
2009-10-08 17:22:47 +00:00
Anders Carlsson 3482b819db Mangle std::basic_ostream<char, std::char_traits<char>> as So.
llvm-svn: 83557
2009-10-08 17:20:26 +00:00
Douglas Gregor eeffde3a1d Add more testing for the properties of explicit specialization.
Also, eliminate a redundant diagnostic by marking a variable declared
with incomplete type as an invalid declaration.

llvm-svn: 83553
2009-10-08 16:41:22 +00:00
Douglas Gregor 19c52729ed Don't complain about out-of-line explicit specializations of member
function and member function templates that are not definitions. Add
more tests to ensure that explicit specializations of member function
templates prevent instantiation.

llvm-svn: 83550
2009-10-08 15:54:21 +00:00
Douglas Gregor 1e9b25caf4 More testing for explicit specializations of member class templates
llvm-svn: 83548
2009-10-08 15:27:05 +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 c093c1de2b Make sure to set the template specialization kind of an explicit
template instantiation of a member function of a class template.
FIXME -= 2;

llvm-svn: 83520
2009-10-08 01:19:17 +00:00
Douglas Gregor e3dfd4826b Only perform an implicit instantiation of a function if its template
specialization kind is TSK_ImplicitInstantiation. Previously, we would
end up implicitly instantiating functions that had explicit
specialization declarations or explicit instantiation declarations
(with no corresponding definitions).

llvm-svn: 83511
2009-10-08 00:14:38 +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
Anders Carlsson 6c966c458a Handle MemberExprs in ResolveAddressOfOverloadedFunction.
llvm-svn: 83495
2009-10-07 22:26:29 +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
Fariborz Jahanian ae01f78a31 When building candidate set for built-ins; when looking for
convesion functions, look in base classes to.
(Removes a FIXME).

llvm-svn: 83472
2009-10-07 17:26:09 +00:00
Douglas Gregor e4b05168f6 Class template partial specializations can be declared anywhere that
its definition may be defined, including in a class.

Also, put in an assertion when trying to instantiate a class template
partial specialization of a member template, which is not yet
implemented.

llvm-svn: 83469
2009-10-07 17:21:34 +00:00
Anders Carlsson 1e39bd944b Mangle anonymous structs/unions correctly. Fixes PR5139.
llvm-svn: 83448
2009-10-07 01:45:02 +00:00
Douglas Gregor fbe6d079e2 More testing of explicit specializations
llvm-svn: 83440
2009-10-07 00:45:53 +00:00
Ted Kremenek 3ea4ab8e79 Force a specific target triple in c-index-api-test.m, making the behavior of the test not be dependent on the host.
llvm-svn: 83438
2009-10-07 00:39:48 +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
Fariborz Jahanian 34d93dcddd Patch to implement C++ [over.built]p11 of overload resolution.
Doug, please review. There is a FIXME in the test case with a question
which is unrelated to this patch (that is, error is issued
before set of builtins are added to the candidate list).

llvm-svn: 83429
2009-10-06 23:08:05 +00:00
Anders Carlsson b703fd2216 Uncomment some commented out code.
llvm-svn: 83428
2009-10-06 23:02:00 +00:00
Mike Stump da6822f584 Add codegen for __builtin_abort. Convert to FileCheck.
llvm-svn: 83427
2009-10-06 22:58:45 +00:00
Anders Carlsson c6d171ec77 Change GetAddressCXXOfBaseClass to use CXXBasePaths for calculating base class offsets. Fix the code to handle virtual bases as well.
llvm-svn: 83426
2009-10-06 22:43:30 +00:00
Anders Carlsson 11d00cf972 When mangling names, always use the canonical decl. Fixes PR5144.
llvm-svn: 83420
2009-10-06 21:58:01 +00:00
Douglas Gregor 27c26e9a09 Test explicit specialization for all of the various cases where
explicit specializations can occur. Also, fix a minor recovery bug
where we should allow declarations coming from the parser to be NULL.

llvm-svn: 83416
2009-10-06 21:27:51 +00:00
Anders Carlsson 273cdf096c Fix test.
llvm-svn: 83398
2009-10-06 18:12:12 +00:00
Anders Carlsson 6b7378bbe1 Emit the destructor epilogue in a cleanup block so a return from a destructor body still calls the epilogue.
llvm-svn: 83397
2009-10-06 18:09:57 +00:00
Anders Carlsson 80ef6f1a46 Pass the right type to GetAddrOfFunction when getting functions for the VTable. Fixes PR5021.
llvm-svn: 83395
2009-10-06 17:54:23 +00:00
Ted Kremenek 2f935535b1 Fix crash introduced by r83358 where a symbol could be eagerly
evaluated to an APSInt with a different bitwidth than the other
operand in a binary expression.

llvm-svn: 83368
2009-10-06 03:44:49 +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
Fariborz Jahanian 333bb733a5 Refixed pr5086 by letting Expr::isNullPointerConstant
handle checking for a null pointer for a zero-valued
enumerator; moving the test case from CodeGen to Sema.

llvm-svn: 83350
2009-10-06 00:09:31 +00:00
Mike Stump 3472ae5bac Ensure we have atleast 2-byte alignment for member functions.
llvm-svn: 83337
2009-10-05 22:49:20 +00:00
Mike Stump f6ab1f0a4d Testcase for recent checkin.
llvm-svn: 83330
2009-10-05 22:24:47 +00:00
Chris Lattner 78a2e6356b remove this test, grepping for define isn't really testing anything.
llvm-svn: 83325
2009-10-05 21:16:22 +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
Steve Naroff d7eb7179a2 - Fix assert in clang_getCursorDecl (having to do with recently added ObjC_ProtocolRef).
- Make sure CHECK: lines in test case match the expected output. 

llvm-svn: 83316
2009-10-05 17:58:19 +00:00
Anders Carlsson 2ee3c011d9 Implement code generation of member function pointer calls. Fixes PR5121.
llvm-svn: 83271
2009-10-03 19:43:08 +00:00
Anders Carlsson de55f647ff Ignore No-op casts when evaluating lvalue expressions. Fixes PR5122.
llvm-svn: 83267
2009-10-03 16:30:22 +00:00
Anders Carlsson c46bf276e1 Teach AggExprEmitter about pointers to member functions.
llvm-svn: 83266
2009-10-03 15:43:24 +00:00
Anders Carlsson 3162e4945a Handle base-to-derived casts of member function pointers in CGExprConstant.cpp
llvm-svn: 83265
2009-10-03 15:13:22 +00:00
Anders Carlsson 128a5d5147 Handle members to function pointers in CGExprConstant.
llvm-svn: 83264
2009-10-03 15:02:02 +00:00
Anders Carlsson 6ad01742d5 Rewrite member function pointer test not to rely on -O2.
llvm-svn: 83262
2009-10-03 14:39:13 +00:00
Benjamin Kramer 80401b96c2 FileCheckize test case.
llvm-svn: 83244
2009-10-02 10:32:51 +00:00
Anders Carlsson 8a744ad8a6 Don't update the struct alignment when adding fields to a packed struct. Fixes PR5118.
llvm-svn: 83235
2009-10-02 04:52:12 +00:00
Anders Carlsson 39e3eb12ae When building constant structs, check if the resulting LLVM struct will be bigger than the record layout size and use a packed struct if that's the case. Fixes PR5108.
llvm-svn: 83230
2009-10-02 02:15:20 +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
Douglas Gregor 78b691a458 When the return type of a function is dependent, don't perform any
of the flow-control checks for falling off the end of a function,
since the return type may instantiate to void. Similarly, if a
return statement has an expression and the return type of the function
is void, don't complain if the expression is type-dependent, since
that type could instantiate to void.

Fixes PR5071.

llvm-svn: 83222
2009-10-01 23:25:31 +00:00
Fariborz Jahanian a0f91ad59c enumerator value of 0 is not a null pointer constant for
deciding const of null pointer conversion. Fixes PR5086.

llvm-svn: 83217
2009-10-01 22:10:15 +00:00
Douglas Gregor 369acf9304 CodeGen may see out-of-line declarations of the various special member
functions when they are explicitly declared, e.g., via a function
template specialization or explicit template instantiation
declaration. Don't try to synthesize bodies for the special member
functions in this case; rather, check whether we have an implicit
declaration and, if so, synthesize the appropriate function
body. Fixes PR5084.

llvm-svn: 83212
2009-10-01 20:44:19 +00:00
Fariborz Jahanian b3c44f9ee9 Patch to implement static casting which requires one
user-defined type conversion. Fixes PR5040.

llvm-svn: 83211
2009-10-01 20:39:51 +00:00
Ted Kremenek 5c22e110a1 Fix bad grammar in static analyzer diagnostic. Reported by Robert Purves!
llvm-svn: 83204
2009-10-01 17:31:50 +00:00
Douglas Gregor e364e7bc2b Fix a lame regression in IR gen for C++ delete expressions. PR5102
llvm-svn: 83195
2009-10-01 05:49:51 +00:00
Steve Naroff a6c56bb849 Add support for class and protocol references.
llvm-svn: 83186
2009-10-01 00:31:07 +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
Douglas Gregor 42909754f6 Improve template argument deduction in the case where the parameter
type is a template-id (e.g., basic_ostream<CharT, Traits>) and the
argument type is a class that has a derived class matching the
parameter type. Previously, we were giving up on template argument
deduction too early.

llvm-svn: 83177
2009-09-30 22:13:51 +00:00
Douglas Gregor 66950a32d9 When overload resolution fails for an overloaded operator, show the
overload candidates (but not the built-in ones). We still rely on the
underlying built-in semantic analysis to produce the initial
diagnostic, then print the candidates following that diagnostic. 

One side advantage of this approach is that we can perform more validation
of C++'s operator overloading with built-in candidates vs. the
semantic analysis for those built-in operators: when there are no
viable candidates, we know to expect an error from the built-in
operator handling code. Otherwise, we are not modeling the built-in
semantics properly within operator overloading. This is checked as:

      assert(Result.isInvalid() && 
             "C++ binary operator overloading is missing
             candidates!");
      if (Result.isInvalid())
        PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);

The assert() catches cases where we're wrong in a +Asserts build. The
"if" makes sure that, if this happens in a production clang
(-Asserts), we still build the proper built-in operator and continue
on our merry way. This is effectively what happened before this
change, but we've added the assert() to catch more flies.

llvm-svn: 83175
2009-09-30 21:46:01 +00:00
Douglas Gregor 3dc959f88b Tweak CHECK lines to eliminate a failure on i686-apple-darwin10
llvm-svn: 83173
2009-09-30 21:39:51 +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
Chris Lattner 24440102aa Convert from nonportable grep to filecheck, patch by John Thompson
llvm-svn: 83158
2009-09-30 19:55:07 +00:00
Fariborz Jahanian ac3005cecc Note location of operators caused the circularity.
llvm-svn: 83153
2009-09-30 17:46:20 +00:00
Fariborz Jahanian e01e434aef <rdar://problem/7263113> Make clang produce gcc's objc_assign_StrongCast as a result of type-cast of an ivar in assignment.
llvm-svn: 83150
2009-09-30 17:10:29 +00:00
John McCall c1538c08d7 Detect operator-> chains of arbitrary length. Use a terrible data structure
to strike fear into the hearts of CPUs everywhere.

llvm-svn: 83133
2009-09-30 01:01:30 +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
Douglas Gregor 80a6cc5800 Find operators new/delete in base classes. FIXME -= 2;
llvm-svn: 83119
2009-09-30 00:03:47 +00:00
Douglas Gregor 98496dc3eb The C++ delete expression strips cv-qualifiers from the pointed-to type. My previous fix eliminated this behavior, so bring it back again.
llvm-svn: 83113
2009-09-29 21:38:53 +00:00
Fariborz Jahanian 3a36ab08b7 13.1-p3 Overloadable declarations
Parameter declarations that differ only in the presence or absence of const and/or volatile are equivalent.

llvm-svn: 83104
2009-09-29 20:28:06 +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
Daniel Dunbar d71a03b164 Fix truck sized thinko where Darwin/ARM toolchain didn't look for programs in
libexec, *blush*.

llvm-svn: 83086
2009-09-29 18:52:10 +00:00
Daniel Dunbar 88f2300d19 Add a test case demonstrating a situation where we get protocol type checking
right for multiple anonymous categories.

llvm-svn: 83085
2009-09-29 18:51:43 +00:00
Douglas Gregor bb3e12fc0b Handle C++ delete expressions when the overloaded delete operator is a
"usual deallocation function" with two arguments. CodeGen will have to
handle this case specifically, since the value for the second argument
(the size of the allocated object) may have to be computed at run
time.

Fixes the Sema part of PR4782.

llvm-svn: 83080
2009-09-29 18:16:17 +00:00
Ted Kremenek 228539f015 Fix: <rdar://problem/7261075> [RegionStore] crash when handling load: '*((unsigned int *)"????")'
This issue was originally reported via personal email by Thomas Clement!

llvm-svn: 83069
2009-09-29 16:36:48 +00:00
Douglas Gregor 6b603c9ec5 Allow the PYTHON make variable to override the default Python when running Clang tests, from Ken Dyck.
llvm-svn: 83065
2009-09-29 14:54:28 +00:00
Douglas Gregor a49cb4e494 Slightly improve the semantics of extern templates for member functions of class templates
llvm-svn: 83063
2009-09-29 14:38:03 +00:00
Ted Kremenek cc22424c87 Fix really insidious bug in RegionStoreManager::RemoveDeadBindings()
identified with a false positive reported by Thomas Clement.  This
involved doing another rewrite of
RegionStoreManager::RemoveDeadBindings(), which phrases the entire
problem of scanning for dead regions as a graph exploration problem.
It is more methodic than the previous implementation.

llvm-svn: 83053
2009-09-29 06:35:00 +00:00
Anders Carlsson 025893300c Remove PR5061 workaround.
llvm-svn: 83046
2009-09-29 05:36:21 +00:00
Anders Carlsson 8f4fd60c47 Handle CXXMemberCallExprs that point to a static method. Fixes PR5093.
llvm-svn: 83045
2009-09-29 03:54:11 +00:00
Anders Carlsson 33c6a7a12e Forgot test.
llvm-svn: 83044
2009-09-29 03:38:56 +00:00
Ted Kremenek 5daec8a834 Reapply most of r82939, but add a guard that FieldRegions and friends
are only specially treated by RegionStore::InvalidateRegion() when
their super region is also invalidated.  When this isn't the case,
conjure a new symbol for a FieldRegion.  Thanks to Zhongxing Xu and
Daniel Dunbar for pointing out this issue.

llvm-svn: 83043
2009-09-29 03:34:03 +00:00
Mike Stump e7a2b48572 Fix http://llvm.org/PR5090.
llvm-svn: 83035
2009-09-29 00:50:50 +00:00
Ted Kremenek 196d2a0095 Remove test case's dependency on platform headers.
llvm-svn: 83030
2009-09-28 23:54:40 +00:00
Douglas Gregor 56fbc37bbb Provide a custom diagnostic when code tries to use an unknown builtin
llvm-svn: 83014
2009-09-28 21:14:19 +00:00
Fariborz Jahanian c9c3917a86 Multiple conversions to the same type are ambiguous but for the
purpose of overload resolution is to be treated as a uner-defined
conversion.

llvm-svn: 83004
2009-09-28 19:06:58 +00:00
Douglas Gregor 5ad7c54bb9 Make sure that out-of-line function and variable definitions are not
pushed into scope. Fixes PR5056.

llvm-svn: 83003
2009-09-28 18:41:37 +00:00
Fariborz Jahanian 774cf79987 Patch for AST representation for the implicit conversion to a function
reference/pointer. And a test case for code gen.

llvm-svn: 83000
2009-09-28 18:35:46 +00:00
Douglas Gregor c5790dfeb4 Parse a C++ scope specifier followed by a "typename" annotation token as a type name within the declaration specifiers. Fixes PR5061.
llvm-svn: 82974
2009-09-28 07:26:33 +00:00
Douglas Gregor e6688e653f Determinism is for wimps. <Wimper>
llvm-svn: 82962
2009-09-28 03:51:44 +00:00
Douglas Gregor 505ad49a09 Teach Sema::isDeclInScope to handle overload sets constructed from
functions that occur in multiple declaration contexts, e.g., because
some were found via using declarations. Now, isDeclInScope will build
a new overload set (when needed) containing only those declarations
that are actually in scope. This eliminates a problem found with
libstdc++'s <iostream>, where the presence of using 

In the longer term, I'd like to eliminate Sema::isDeclInScope in favor
of better handling of the RedeclarationOnly flag in the name-lookup
routines. That way, name lookup only returns the entities that matter,
rather than taking the current two-pass approach of producing too many
results and then filtering our the wrong results. It's not efficient,
and I'm sure that we aren't filtering everywhere we should be.

llvm-svn: 82954
2009-09-28 00:47:05 +00:00
Douglas Gregor a29a3ffd18 Improve handling of friend function templates somewhat
llvm-svn: 82950
2009-09-28 00:08:27 +00:00
Ted Kremenek e41b81e9ab Fix:
<rdar://problem/6914474> checker doesn't realize that variable might
have been assigned if a pointer to that variable was passed to another
function via a structure

The problem here was the RegionStoreManager::InvalidateRegion didn't
invalidate the bindings of invalidated regions.  This required a
rewrite of this method using a worklist.

As part of this fix, changed ValueManager::getConjuredSymbolVal() to
require a 'void*' SymbolTag argument.  This tag is used to
differentiate two different symbols created at the same location.

llvm-svn: 82920
2009-09-27 20:45:21 +00:00
Anders Carlsson 02bca738b4 Mangle dependent name expressions. Fixes PR5063.
llvm-svn: 82915
2009-09-27 20:11:34 +00:00
Anders Carlsson d122de5f32 Use mangleTemplatePrefix when we know that we're mangling a nested template name.
llvm-svn: 82912
2009-09-27 19:53:49 +00:00
Anders Carlsson 9bf787ad1f Look for substitutions when mangling TypenameTypes.
llvm-svn: 82885
2009-09-27 01:06:07 +00:00
Anders Carlsson e00745b285 Better template parameter type mangling.
llvm-svn: 82883
2009-09-27 00:38:53 +00:00
Anders Carlsson 2e5935241a Mangle std::basic_string<char, std::char_traits<char>, std::allocator<char> > as Ss.
llvm-svn: 82882
2009-09-27 00:12:57 +00:00
Anders Carlsson 853bb50382 Mangle ::std::basic_string as Sb.
llvm-svn: 82881
2009-09-26 23:14:39 +00:00
Anders Carlsson 872ce0dc31 Mangle ::std::allocator as Sa.
llvm-svn: 82880
2009-09-26 23:10:05 +00:00
Anders Carlsson 3e83c30c4c Handle substitutions in mangleTemplatePrefix.
llvm-svn: 82879
2009-09-26 22:18:22 +00:00
Chris Lattner a26b471f1d builtin_trap should be noreturn, this fixes PR5062, patch by
Roman Divacky!

llvm-svn: 82876
2009-09-26 21:16:00 +00:00
Douglas Gregor 2208a2912c Simplify the handling of non-dependent friend class template
specializations such as:

  friend class std::vector<int>;

by using the same code path as explicit specializations, customized to
reference an existing ClassTemplateSpecializationDecl (or build a new
"undeclared" one).

llvm-svn: 82875
2009-09-26 20:57:03 +00:00
Anders Carlsson aa9e3c8793 Substitute "::std::" as "St".
llvm-svn: 82874
2009-09-26 20:53:44 +00:00
Anders Carlsson 49232b9f42 Don't crash when trying to mangle function templates.
llvm-svn: 82872
2009-09-26 20:13:56 +00:00
Anders Carlsson e33eed5c1e Set alignment on static function level decls and VLAs. Fixes PR5060.
llvm-svn: 82868
2009-09-26 18:16:06 +00:00
Ted Kremenek 2f5198b022 Added test case for <rdar://problem/7152418>.
llvm-svn: 82866
2009-09-26 17:18:44 +00:00
Daniel Dunbar bb6ac47ea1 Revert "Force triple in test.", this wasn't the problem.
llvm-svn: 82855
2009-09-26 07:43:49 +00:00
Daniel Dunbar a87097a6ac Add the lib path to LD_LIBRARY_PATH, so finding .so works (more) portably.
llvm-svn: 82853
2009-09-26 07:36:09 +00:00
Daniel Dunbar 1b436d6950 Force triple in test.
llvm-svn: 82850
2009-09-26 07:06:36 +00:00
Douglas Gregor 9acb690827 Fix name lookup for friend class templates to consider anything in a
scope *up to and including* the innermost namespace scope, rather than
just searching in the innermost namespace scope. 

llvm-svn: 82849
2009-09-26 07:05:09 +00:00
Douglas Gregor 3dad842b35 Rework the Parse-Sema interaction for friends to better support friend
class templates. We now treat friend class templates much more like
normal class templates, except that they still get special name lookup
rules. Fixes PR5057 and eliminates a bunch of spurious diagnostics in
<iostream>.

llvm-svn: 82848
2009-09-26 06:47:28 +00:00
Anders Carlsson 0374742326 Use ABIArgInfo::getDirect() for all types that have a pointer representation.
llvm-svn: 82845
2009-09-26 03:56:53 +00:00
Anders Carlsson 296f8dc52f Mangle record types as decls.
llvm-svn: 82843
2009-09-26 03:55:37 +00:00
Ted Kremenek 7226af69cb Add a "positive" matching test case for attribute 'noreturn' that involves a nested infinite loop.
llvm-svn: 82842
2009-09-26 03:54:06 +00:00
Ted Kremenek 9fa2eefa4c Add two more test cases for attribute 'noreturn'.
llvm-svn: 82841
2009-09-26 03:48:56 +00:00
Anders Carlsson bdaaab4671 Improve mangling of typename types.
llvm-svn: 82833
2009-09-26 02:26:02 +00:00
Anders Carlsson 7f78d85be4 Start at NextOffset when laying out bases as well.
llvm-svn: 82831
2009-09-26 01:29:10 +00:00
Anders Carlsson a6d95b5a3e Use NextOffset when laying out a field.
llvm-svn: 82828
2009-09-26 01:09:35 +00:00
Douglas Gregor 0e876e0180 Use explicitly-specified template argument lists to help naming
explicit template specializations, when available.

llvm-svn: 82824
2009-09-25 23:53:26 +00:00
Steve Naroff 43b118fc2c Fix cut/paste error resulting in bad column info.
llvm-svn: 82810
2009-09-25 22:15:54 +00:00
Douglas Gregor d90fd526d3 Declarators can now properly represent template-ids, e.g., for
template void f<int>(int);
                ~~~~~~
Previously, we silently dropped the template arguments. With this
change, we now use the template arguments (when available) as the
explicitly-specified template arguments used to aid template argument
deduction for explicit template instantiations.

llvm-svn: 82806
2009-09-25 21:45:23 +00:00
Steve Naroff 63f475a212 Add clang_getDeclLine and clang_getDeclColumn
Fix clang_getCursorDecl to do the right thing for expr refs
Fixup test file to accommodate new output (which includes the line/column for the referenced decl)

llvm-svn: 82798
2009-09-25 21:32:34 +00:00
Fariborz Jahanian 49850dfc4e Refixed pr5050 per Anders comment. Test case enhanced
per Doug's comment.

llvm-svn: 82791
2009-09-25 18:59:21 +00:00
Douglas Gregor 450f0084a2 WIP implementation of explicit instantiation of function templates,
member functions of class template specializations, and static data
members. The mechanics are (mostly) present, but the semantic analysis
is very weak.

llvm-svn: 82789
2009-09-25 18:43:00 +00:00
Fariborz Jahanian 5aec1b54bc Fix the AST tree so ir-gen can do the conversion via copy construction.
Fixed pr5050.

llvm-svn: 82783
2009-09-25 18:11:25 +00:00
Anders Carlsson d7d358a65e Even more work on empty classes.
llvm-svn: 82770
2009-09-25 15:39:00 +00:00