Commit Graph

22209 Commits

Author SHA1 Message Date
Benjamin Kramer 659d7fc003 Silence warning.
llvm-svn: 101495
2010-04-16 17:43:15 +00:00
Douglas Gregor b05275ac47 Eliminate the ForceRValue parameter to Sema::AddOverloadCandidate
llvm-svn: 101494
2010-04-16 17:41:49 +00:00
Douglas Gregor f1e4669232 Eliminate the ForceRValue parameter from most of Sema's Add*Candidate
functions.

llvm-svn: 101492
2010-04-16 17:33:27 +00:00
Douglas Gregor 7b23e41774 Eliminate the ForceRValue parameter from Sema::IsUserDefinedConversion. It's not the way we're going to handle this.
llvm-svn: 101483
2010-04-16 17:25:05 +00:00
Douglas Gregor 73b0cd72ff Eliminate the default value for the UserCast parameter of Sema::IsUserDefinedConversion. No functionality change
llvm-svn: 101482
2010-04-16 17:21:50 +00:00
Douglas Gregor f149520464 Eliminate the Elidable parameter to PerformImplicitConversion; we
don't need it.

llvm-svn: 101481
2010-04-16 17:16:43 +00:00
Dan Gohman 6e8427e066 Remove this hard-coded buffer size. In some basic experiments preprocessing
large files, this doesn't seem significantly better than just letting
raw_ostream pick a buffer size.

This code predates raw-ostream's automatic buffer sizing; in fact, it
was introduced as part of the code which would eventually become
raw_ostream.

llvm-svn: 101473
2010-04-16 16:28:05 +00:00
Anders Carlsson be6f3181dd Make CGRecordLayoutBuilder deal with wide bit-fields. Will land tests shortly (Daniel, please review).
llvm-svn: 101472
2010-04-16 16:23:02 +00:00
Anders Carlsson d9abbe56a5 Remove printfs.
llvm-svn: 101470
2010-04-16 15:59:41 +00:00
Anders Carlsson 5723516ce9 More work on wide bit-fields, WIP.
llvm-svn: 101467
2010-04-16 15:57:11 +00:00
Anders Carlsson d5635feb1a Start working on handling wide bitfields in C++
llvm-svn: 101464
2010-04-16 15:16:32 +00:00
Anders Carlsson 5efc56e36b Rename the ASTContext member 'Context'.
llvm-svn: 101462
2010-04-16 15:07:51 +00:00
Douglas Gregor d2b896ab69 Only predefine the macro _GNU_SOURCE in C++ mode when we're on a
platform that typically uses glibc. Fixes a Boost.Thread compilation
failure.

llvm-svn: 101450
2010-04-16 06:31:05 +00:00
Chris Lattner 79bf976518 tidy up
llvm-svn: 101447
2010-04-16 06:12:51 +00:00
Eric Christopher 2a5aafff30 Expand the argument diagnostics for too many arguments and give
both number seen and number expected.

Finishes fixing PR6501.

llvm-svn: 101442
2010-04-16 04:56:46 +00:00
Eric Christopher abf1e18e32 Expand argument diagnostic for too few arguments to give the number
of arguments both seen and expected.

Fixes PR6501.

llvm-svn: 101441
2010-04-16 04:48:22 +00:00
Dan Gohman 314ca58a91 Convert libCIndex to use the new native EXPORTED_SYMBOL_FILE mechanism.
libCIndex also has a CMakeLists.txt file which has its own code for using
the exports file. To preserve existing functionality, create a separate
darwin-specific exports file for use by this CMakeLists.txt code.

llvm-svn: 101440
2010-04-16 04:45:02 +00:00
Douglas Gregor aef0022925 Fix a bug in caret-line-pruning logic that only happens when we have a
source line wider than the terminal where the associated fix-it line
is longer than the caret line. Previously, we would crash in this
case, which was rather unfortunate. Fixes <rdar://problem/7856226>.

llvm-svn: 101426
2010-04-16 00:23:51 +00:00
Douglas Gregor b8eaf2944b Audit uses of Sema::LookupSingleName for those lookups that are
intended for redeclarations, fixing those that need it. Fixes PR6831.

This uncovered an issue where the C++ type-specifier-seq parsing logic
would try to perform name lookup on an identifier after it already had
a type-specifier, which could also lead to spurious ambiguity errors
(as in PR6831, but with a different test case).

llvm-svn: 101419
2010-04-15 23:40:53 +00:00
Douglas Gregor b2ccf010fb Feed proper source-location information into Sema::LookupSingleResult,
in case it ends up doing something that might trigger diagnostics
(template instantiation, ambiguity reporting, access
reporting). Noticed while working on PR6831.

llvm-svn: 101412
2010-04-15 22:33:43 +00:00
Ted Kremenek a96a8eebbb Better support USRs for anonymous enums, structs, by including the location where
the tag was declared.  WIP.

llvm-svn: 101403
2010-04-15 21:51:13 +00:00
Ted Kremenek 1a596562ed Specify temporary file for -emit-llvm output in test case so that we don't deposit the file
in the original source directory.

llvm-svn: 101402
2010-04-15 21:11:33 +00:00
Ted Kremenek 9833d399ce Do not generate USRs for declarations with 'no linkage' except for enums, structs, typedefs.
Those still need work to disambiguate them across translation units.

llvm-svn: 101401
2010-04-15 21:04:25 +00:00
Anders Carlsson 7a4a25de1e Improve the bit-field too wide error message.
llvm-svn: 101384
2010-04-15 18:47:32 +00:00
Douglas Gregor e8154339f4 Diagnose attempts to throw an abstract class type.
llvm-svn: 101381
2010-04-15 18:05:39 +00:00
Ted Kremenek 8db54ff1de Fix PR 6844, a regression caused by the introduction of llvm_unreachable for the default
case in GRExprEngine::Visit (in r101129).  Instead, enumerate all Stmt cases and have
no 'default' case in the switch statement.  When we encounter a Stmt we don't handle,
we should explicitly add it to the switch statement.

llvm-svn: 101378
2010-04-15 17:33:31 +00:00
Anders Carlsson ea7b18298e Split adding the primary virtual base offsets out into a separate pass. This fixes a bug where we would lay out virtual bases in the wrong order.
llvm-svn: 101373
2010-04-15 16:12:58 +00:00
Douglas Gregor c1cf814c8b Fix a few cases where enum constant handling was using
ASTContext::getTypeSize() rather than ASTContext::getIntWidth() for
the width of an integral type. The former includes padding for bools
(to the target's size) while the latter does not, so we woud end up
zero-extending bools to the target width when we shouldn't. Fixes a
crash-on-valid in the included test.

llvm-svn: 101372
2010-04-15 15:53:31 +00:00
Daniel Dunbar 9302f60606 clang -cc1: Add a -fno-bitfield-type-align option, for my own testing purposes.
llvm-svn: 101370
2010-04-15 15:06:22 +00:00
Daniel Dunbar 1da6511b99 Tweak spelling (Bitfield -> BitField)
llvm-svn: 101369
2010-04-15 15:06:18 +00:00
Nick Lewycky a1e20de908 Teach -fixit to modify all of its inputs instead of just the main file, unless
-fixit-at specified a particular fixit to fix, or the -o flag was used.

llvm-svn: 101359
2010-04-15 06:46:58 +00:00
Ted Kremenek 72ac9505f0 Include sender address in completion log.
llvm-svn: 101358
2010-04-15 06:32:15 +00:00
Daniel Dunbar 3e0cac6f20 Tidy up comment.
llvm-svn: 101357
2010-04-15 06:18:42 +00:00
Daniel Dunbar 3d9289c736 Add TargetInfo::useBitfieldTypeAlignment().
- Used to determine whether the alignment of the type in a bit-field is
   respected when laying out structures. The default is true, targets can
   override this as needed.

 - This is designed to correspond to the PCC_BITFIELD_TYPE_MATTERS macro in
   gcc. The AST/Sema implementation only affects one line, unless I have
   forgotten something. I'd appreciate further review.

 - IRgen still needs to be updated to fully support this (which is effectively
   PR5591).

llvm-svn: 101356
2010-04-15 06:18:39 +00:00
Daniel Dunbar 76fa840d09 Driver/Frontend: Add support for -mllvm, which forwards options to the LLVM option parser.
- Note that this is a behavior change, previously -mllvm at the driver level forwarded to clang -cc1. The driver does a little magic to make sure that '-mllvm -disable-llvm-optzns' works correctly, but other users will need to be updated to use -Xclang.

llvm-svn: 101354
2010-04-15 06:09:03 +00:00
Daniel Dunbar 9c78d63fbc IRgen: Change CGBitFieldInfo to take the AccessInfo as constructor arguments, it is now an immutable object.
Also, add some checking of various invariants that should hold on the CGBitFieldInfo access.

llvm-svn: 101345
2010-04-15 05:09:32 +00:00
Daniel Dunbar bb13845c5f IRgen: Eliminate now unused fields from CGBitFieldInfo.
llvm-svn: 101344
2010-04-15 05:09:28 +00:00
Daniel Dunbar 67aba79b74 IRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.

 - No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.

The new fixes from r101222 are:

 1. The shift to the target position needs to occur after the value is extended to the correct size. This broke Clang bootstrap, among other things no doubt.

 2. Swap the order of arguments to OR, to get a tad more constant folding.

llvm-svn: 101339
2010-04-15 03:47:33 +00:00
Eric Christopher 1bbc7086ff Rewrite handling of 64-bit palignr intrinsics to be vector shuffles.
Stop multiplying constant by 8 accordingly in the header and change
intrinsic definition for what types we expect.

Add to existing palignr test to check that we're emitting the correct things.

llvm-svn: 101332
2010-04-15 01:43:08 +00:00
Ted Kremenek c9b748e74f Teach ASTVector::append() about the case where 'NumInputs' is 0. This hopefully fixes
a crash in InitListExpr's ctor.

llvm-svn: 101328
2010-04-15 01:14:12 +00:00
Ted Kremenek ef0ada67f5 Add simple python server for recording code completion timings.
llvm-svn: 101327
2010-04-15 01:02:31 +00:00
Ted Kremenek 9e0cf0978c Add optional timing logging for code completion results. This causes a UDP packet
containing the time taken for the code completion to be sent to a designated server
(which is specified using a compile-time -D flag).

llvm-svn: 101326
2010-04-15 01:02:28 +00:00
Douglas Gregor 454a5b65d4 Warn about non-aggregate classes with no user-declared constructors
that have reference or const scalar members, since those members can
never be initializer or modified. Fixes <rdar://problem/7804350>.

llvm-svn: 101316
2010-04-15 00:00:53 +00:00
Douglas Gregor 064fdb2fe8 Always diagnose and complain about problems in
ResolveAddressOfOverloadedFunction when asked to complain. Previously,
we had some weird handshake where ResolveAddressOfOverloadedFunction
expected its caller to handle some of the diagnostics but not others,
and yet there was no way for the caller to know which case we were
in. Eliminate this madness, fixing <rdar://problem/7765884>.

llvm-svn: 101312
2010-04-14 23:11:21 +00:00
Alexis Hunt 1deb972b55 Fix 80-cols violtaions
llvm-svn: 101311
2010-04-14 23:07:37 +00:00
Douglas Gregor 2d2d90750c Once we've emitted a fatal diagnostic, keep counting errors but with a
separate count of "suppressed" errors. This way, semantic analysis
bits that depend on the error count to determine whether problems
occured (e.g., some template argument deduction failures, jump-scope
checking) will not get confused.

The actual problem here is that a missing #include (which is a fatal
error) could cause the jump-scope checker to run on invalid code,
which it is not prepared to do. Trivial fix for both
<rdar://problem/7775941> and <rdar://problem/7775709>.

llvm-svn: 101297
2010-04-14 22:19:45 +00:00
Ted Kremenek ee457516e6 Make CXLanguage_Invalid the first enum value (with '0' as its value) in CXLanguageKind.
llvm-svn: 101287
2010-04-14 20:58:32 +00:00
Fariborz Jahanian b5795c01c4 Fix a -pedantic spurious warning involving @dynamic.
llvm-svn: 101284
2010-04-14 20:52:42 +00:00
Chris Lattner dd6697b4fa improve altivec c++ support by adding casts, patch by
Anton Yartsev!

llvm-svn: 101281
2010-04-14 20:35:39 +00:00
Douglas Gregor 2fb18b746f Thread a Scope pointer into BuildRecoveryCallExpr to help typo
correction find names when a call failed. Fixes
<rdar://problem/7853795>.

llvm-svn: 101278
2010-04-14 20:27:54 +00:00
Douglas Gregor 280e1ee0ae Teach typo correction about various language keywords. We can't
generally recover from typos in keywords (since we would effectively
have to mangle the token stream). However, there are still benefits to
typo-correcting with keywords:
  - We don't make stupid suggestions when the user typed something
  that is similar to a keyword. 
  - We can suggest the keyword in a diagnostic (did you mean
  "static_cast"?), even if we can't recover and therefore don't have
  a fix-it.

llvm-svn: 101274
2010-04-14 20:04:41 +00:00
Douglas Gregor fd0e2e31be Return the corrected DeclarationName from Sema::CorrectTypo rather
than just a bool indicating that correction occurred. No actual
functionality change (it's still always used like a bool), but this
refactoring will be used to support typo correction to keywords.

llvm-svn: 101259
2010-04-14 17:09:22 +00:00
Daniel Dunbar d51c1a6e09 IRgen/NeXT: Simplify to use AST record layout for getting offsets instead of the
IRgen record layout, which this code doesn't need to depend on.

llvm-svn: 101257
2010-04-14 17:02:21 +00:00
Douglas Gregor 2bf2d3d016 When diagnosing suspicious precedence or assignments, move the fix-it
that adds parentheses from the main diagnostic down to a new
note. This way, when the fix-it represents a choice between two
options, each of the options is associted with a note. There is no
default option in such cases. For example:

/Users/dgregor/t.c:2:9: warning: & has lower precedence than ==; ==
will be
      evaluated first [-Wparentheses]
  if (x & y == 0) {
        ^~~~~~~~
/Users/dgregor/t.c:2:9: note: place parentheses around the &
expression to
      evaluate it first
  if (x & y == 0) {
        ^
      (    )
/Users/dgregor/t.c:2:9: note: place parentheses around the ==
expression to
      silence this warning
  if (x & y == 0) {
        ^
          (     )

llvm-svn: 101249
2010-04-14 16:09:52 +00:00
Zhongxing Xu 5eb08f79fc Move GRStmtNodeBuilder::MakeNode() out of line. No functionality change.
llvm-svn: 101239
2010-04-14 06:35:09 +00:00
Zhongxing Xu 3fd05096ce Add support for CXXBoolLiteralExpr.
llvm-svn: 101238
2010-04-14 06:29:29 +00:00
Zhongxing Xu b5e94ac97d Use direct assignment instead of user defined conversion.
llvm-svn: 101236
2010-04-14 05:50:04 +00:00
Daniel Dunbar 91ea6ac3e9 Speculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.", I think it might be breaking bootstrap.
llvm-svn: 101235
2010-04-14 05:48:35 +00:00
Chris Lattner c745cec17c Improve line marker directive locations, patch by Jordy Rose
llvm-svn: 101226
2010-04-14 04:28:50 +00:00
Chris Lattner 851002d42e add builtin for __builtin_vsprintf, patch by Paul Davey
llvm-svn: 101224
2010-04-14 04:25:45 +00:00
Daniel Dunbar 230e1541b3 IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- Sadly, this doesn't seem to give any .ll size win so far. It is possible to make this routine significantly smarter & avoid various shifting, masking, and zext/sext, but I'm not really convinced it is worth it. It is tricky, and this is really instcombine's job.

 - No intended functionality change; the test case is just to increase coverage & serves as a demo file, it worked before this commit.

llvm-svn: 101222
2010-04-14 04:08:03 +00:00
Daniel Dunbar b2b40a479d IRgen: Tweak CGBitFieldInfo doxyments & add an accessor.
llvm-svn: 101221
2010-04-14 04:07:59 +00:00
Chris Lattner 0384e63501 make the token paste avoidance logic turn "..." into ".. ." instead of ". . ."
when avoiding paste.  Patch by David Peixotto!

llvm-svn: 101218
2010-04-14 03:57:19 +00:00
Chris Lattner dad4062b4d implement altivec.h and a bunch of support code, patch by Anton Yartsev!
llvm-svn: 101215
2010-04-14 03:54:58 +00:00
Chris Lattner 76fe8cb0b8 remove some obsolete super-handling code that I forgot to zap.
llvm-svn: 101212
2010-04-14 03:16:52 +00:00
Douglas Gregor 8aa4ebf0bc Implement typo correction for Objective-C message sends when the
receiver is a mis-typed class name. Previously, we would give a non-specific
typo-correction diagnostic from the expression-parsing code, but there
was no fix-it because it was too late to recover. Now, we give a nice
diagnostic

honk.m:6:4: error: unknown receiver 'Hnk'; did you mean 'Honk'?
  [Hnk method];
   ^~~
   Honk
honk.m:1:1: note: 'Honk' declared here
@interface Honk
^

which includes a fix-it.

We still need to recover better from mis-typing "super".

llvm-svn: 101211
2010-04-14 02:46:37 +00:00
Douglas Gregor a148a1d40e Introduce a parsing action to distinguish between class, instance, and
super message sends in Objective-C. No actual functionality change
here, but it provides a hook so that Sema can typo-correct the
receiver in some cases.

llvm-svn: 101207
2010-04-14 02:22:16 +00:00
John McCall b723860aac Mark a function declaration invalid if any of its parameter declarations
are invalid.  Prevents a crash-on-invalid during template instantiation.
I... really don't understand how this wasn't already present.

llvm-svn: 101203
2010-04-14 01:27:20 +00:00
John McCall b7c5c278bf Parse friend template ids as types instead of ending up in
ActOnClassTemplateSpecialization and being very confused.
Fixes PR6514 (for non-templated-scope friends).

llvm-svn: 101198
2010-04-14 00:24:33 +00:00
Fariborz Jahanian 9ffd706bd4 Add encoding of reference types like gcc does for objc methods and
blocks. Fixes PR6468.

llvm-svn: 101196
2010-04-13 23:45:47 +00:00
Ted Kremenek ac034616f1 Use ASTVector instead of std::vector for the Exprs in InitListExpr. Performance
measurements of '-fsyntax-only' on combine.c (403.gcc) shows no real performance
change, but now the vector isn't leaked.

llvm-svn: 101195
2010-04-13 23:39:13 +00:00
Ted Kremenek a98e8aa15d Introduce ASTVector, which is a std::vector-like class that allocates all memory
using the allocator associated with an ASTContext.  This is largely copy-and-paste
from SmallVector, and should be refactored one day.

llvm-svn: 101194
2010-04-13 23:39:09 +00:00
Ted Kremenek 225b8e39f1 Add cursor kind for C++ methods.
llvm-svn: 101193
2010-04-13 23:39:06 +00:00
Daniel Dunbar 3447a02d5f IRgen: Move EmitLoadOfBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposition, instead of computing the access policy itself.
- This lets the method focus slightly more on emitting clean IR to honor the policy which has been selected. On 403.gcc's combine.c, x86_64, -O0, this reduces the number of lines in the .ll file (~= # of instructions) by 2.5%.

 - No intended functionality change -- at -O3 this should produce equivalent if not identical output. On 403.gcc's combine.c, x86_64, -O3, this isn't quite true and some of the changes are regressions, but I'm not going to worry about that until we move to a new access policy.

 - There is still some room for improvement in the generated IR, in particular we can usually fold the sign-extension of the bit-field into one of the component access. See the FIXME.

llvm-svn: 101192
2010-04-13 23:34:15 +00:00
John McCall 900d980cd8 Fix an embarrasing memory error. I was apparently very tired when I wrote this
code the first time.

Fixes PR6827.

llvm-svn: 101184
2010-04-13 22:18:28 +00:00
Daniel Dunbar b935b9370d IRgen: Enhance CGBitFieldInfo with enough information to fully describe the "policy" with which a bit-field should be accessed.
- For now, these policies are computed to match the current IRgen strategy, although the new information isn't being used yet (except in -fdump-record-layouts).

 - Design comments appreciated.

llvm-svn: 101178
2010-04-13 20:58:55 +00:00
Daniel Dunbar fe53aaef51 Remove unnecessary cast.
llvm-svn: 101176
2010-04-13 20:52:05 +00:00
John McCall e820e5e006 Support befriending members of class template specializations.
llvm-svn: 101173
2010-04-13 20:37:33 +00:00
Fariborz Jahanian ea70a17626 Twik to radar 7839485. Do not attach weak_import attribute to class
for non-fragile abi on darwin.

llvm-svn: 101168
2010-04-13 20:22:35 +00:00
Fariborz Jahanian dd9a259975 Turn off warning about weak_import attribute
on objc classes for Darwin. Radar 7839485.

llvm-svn: 101164
2010-04-13 19:02:07 +00:00
Fariborz Jahanian 5e575c03b8 Removes a FIXME.
llvm-svn: 101161
2010-04-13 18:43:37 +00:00
Fariborz Jahanian 7e9d52aaca Variation of objc_copyStruct API generation when
property (atomic/nonatomic) is of aggregate type with
gc'able member objects) (NeXT runtime).

llvm-svn: 101156
2010-04-13 18:32:24 +00:00
Chris Lattner ff0e2a36e2 Rework the ConstStructBuilder code to emit missing initializer
elements with explicit zero values instead of with tail padding.
On an example like this:

struct foo { int a; int b; };

struct foo fooarray[] = {
    {1, 2},
    {4},
};

We now lay this out as:

@fooarray = global [2 x %struct.foo] [%struct.foo { i32 1, i32 2 }, %struct.foo { i32 4, i32 0 }]

instead of as:

@fooarray = global %0 <{ %struct.foo { i32 1, i32 2 }, %1 { i32 4, [4 x i8] zeroinitializer } }>

Preserving both the struct type of the second element, but also the array type of the entire thing.

llvm-svn: 101155
2010-04-13 18:16:19 +00:00
Chris Lattner d8d760ce66 unbreak tests.
llvm-svn: 101153
2010-04-13 17:57:11 +00:00
Chris Lattner cfa3e7ae6a move a bunch of ConstStructBuilder methods out of line.
llvm-svn: 101152
2010-04-13 17:45:57 +00:00
Chris Lattner 7a4a29f89a minor cleanups
llvm-svn: 101151
2010-04-13 17:39:09 +00:00
Chris Lattner a06794201d Teach HasSideEffect about InitListExprs. Not having
this caused us to codegen dead globals like this:

struct foo { int a; int b; };

static struct foo fooarray[] = {
  {1, 2},
  {4},
};

llvm-svn: 101150
2010-04-13 17:34:23 +00:00
Chris Lattner 8d269dc329 make the rewriter add a #ifndef around the #define of __attribute__.
Without it, there is no reason for a compiler that supports it to
emit the dead static globals that the rewriter labels attribute(used).

llvm-svn: 101149
2010-04-13 17:33:56 +00:00
Douglas Gregor 38ae6ab6bc Refactor and simplify the computation of implicit conversion sequences
for reference binding. The code attempted to handle both the
computation of the ICS and the actual conversion, but the latter is an
anachronism: we now use InitializationSequence for that. 

Sema::CheckReferenceInit is now a static function TryReferenceInit
that's only use within overload resolution, and has been simplified
slightly. It still needs to be updated per C++ [over.ics.ref], by
eliminating more of the lvalue/rvalue checks.

llvm-svn: 101136
2010-04-13 16:31:36 +00:00
Douglas Gregor e5e775bc8e When returning the result of a call to an object of class type, do not
return a NULL expression; return either an error or a proper
expression. Fixes PR6078.

llvm-svn: 101133
2010-04-13 15:50:39 +00:00
Douglas Gregor 538be4622c During referencing binding, only consider conversion functions for
direct reference binding when the source and target types are not
reference-related. Fixes PR6066.

llvm-svn: 101132
2010-04-13 15:07:45 +00:00
Zhongxing Xu 17b33ed0cf Make all cases that we don't handle explicit.
llvm-svn: 101129
2010-04-13 13:15:19 +00:00
Zhongxing Xu b6f02c3d67 Dispatch all C++ cast expr to VisitCast().
llvm-svn: 101128
2010-04-13 12:38:32 +00:00
Zhongxing Xu 7e61217d86 CFGBuilder: always add C++ member call expr as block-level expr.
llvm-svn: 101127
2010-04-13 09:38:01 +00:00
John McCall 43314ab3ae Allow classes to befriend implicitly-declared members. Fixes PR6207 for
members of non-templated classes.

llvm-svn: 101122
2010-04-13 07:45:41 +00:00
Zhongxing Xu 7d4bc9a106 Add a cc1 option to specify the max number of nodes the analyzer can explore.
llvm-svn: 101120
2010-04-13 06:44:31 +00:00
John McCall 84821e7143 Parse constructor names in friend declarations. Part of the fix for
PR6207.

llvm-svn: 101119
2010-04-13 06:39:49 +00:00
Fariborz Jahanian 33eb59a61b Remove this test for now until I can figure out
why it keeps failing on buildbot (but not for me).

llvm-svn: 101115
2010-04-13 02:16:35 +00:00
John McCall 77e41c1cc6 Don't try to find a scope corresponding to the search DC for an unfound
friend declaration;  this used to be important but is now just a waste of time
plus an unreasonable assertion.  Fixes PR6174.

llvm-svn: 101112
2010-04-13 01:44:10 +00:00
Fariborz Jahanian cb21e38dc5 Modify test to be darwin specific.
llvm-svn: 101109
2010-04-13 01:10:57 +00:00
Chris Lattner dc6040b357 add frontend support for -fdata-sections and -ffunction-sections,
patch by Sylvere Teissier!

llvm-svn: 101108
2010-04-13 00:38:24 +00:00
Fariborz Jahanian 08b0f66d2e Add support for objc_copyStruct to enforce
atomicity of aggregate properties in setter/getter
methods. wip.

llvm-svn: 101107
2010-04-13 00:38:05 +00:00
Devang Patel 74c10507a6 Fix debug info for cleanup block.
llvm-svn: 101100
2010-04-13 00:08:43 +00:00
Chris Lattner 9d94f04f27 cache the PP's SourceManager.
llvm-svn: 101099
2010-04-13 00:06:42 +00:00
John McCall 212fa2efb7 Diagnose declarations of conversion functions with declarators other than '()'.
llvm-svn: 101098
2010-04-13 00:04:31 +00:00
Chris Lattner 5dbefc6697 make the preprocessor listen to linemarker directives in -E mode,
PR6101.  This is based on a patch and testcase by Jordy Rose!

llvm-svn: 101097
2010-04-13 00:01:41 +00:00
Douglas Gregor b3cdaee190 Remove some dead FIXMEs
llvm-svn: 101092
2010-04-12 23:52:24 +00:00
Douglas Gregor 2c326bce38 Implement C++ [over.ics.user]p3, which restricts the final conversion
from a conversion function template specialization to one of exact
match rank. We only know how to test this in C++0x with default
function template arguments, but it's also in the C++03 spec. Fixes
PR6285.

llvm-svn: 101089
2010-04-12 23:42:09 +00:00
Douglas Gregor 5c0066f1cf Improve source-location information for C++ conversion functions, by
copying the type location information from the conversion-type-id into
the type location information for the function type. Do something
similar for constructors and destructors, by giving their "void"
return type source-location information.

In all of these cases, we previously left this type-source information
uninitialized, which led to various unfortunate crashes.

We still aren't tracking good source-location information for the
actual names. That's PR6357.

John, please check my sanity on this.

llvm-svn: 101088
2010-04-12 23:19:01 +00:00
Chris Lattner 1a9e873bf9 fix a minor bug I noticed while work with Jordy's patch for PR6101,
in an input file like this:

# 42
int x;

we were emitting:

# <something>
 int x;

(with a space before the int) because we weren't clearing the leading 
whitespace flag properly after the \n from the directive was handled.

llvm-svn: 101084
2010-04-12 23:04:41 +00:00
Ted Kremenek e601365de9 Add fixit hint for missing ':' in ternary expressions.
llvm-svn: 101073
2010-04-12 22:10:35 +00:00
Chris Lattner 97a8e43a02 fix PR6814 - Only print [-pedantic] on a diagnostic if -pedantic
actually turned it on.  If a diag is produced by a warning which
is an extension but defaults to on, and has no warning group, don't
print any option info.

llvm-svn: 101071
2010-04-12 21:53:11 +00:00
Ted Kremenek 4ed2925b91 Add 'clang_getCursorLanguage' to return the "language" of the AST element (e.g., distinguish between C and Objective-C language features). Currently this only returns results for declarations.
llvm-svn: 101070
2010-04-12 21:22:16 +00:00
Ted Kremenek 601f6d5b59 Sort exports file.
llvm-svn: 101069
2010-04-12 21:22:10 +00:00
Chris Lattner 933f67887f fix PR6660/6168: emit padding as zeros instead of undef. Because
trailing fields may not be represented in initializer lists, they
are being handled as padding and those fields *must* be zero 
initialized.

llvm-svn: 101067
2010-04-12 21:10:05 +00:00
Daniel Dunbar f9c24f8403 IRgen: Factor out ComputeBitFieldInfo.
llvm-svn: 101066
2010-04-12 21:01:28 +00:00
Douglas Gregor 41f9030fb8 Implement C++ [temp.local]p4, which specifies how we eliminate
name-lookup ambiguities when there are multiple base classes that are
all specializations of the same class template. This is part of a
general cleanup for ambiguities in template-name lookup. Fixes
PR6717.

llvm-svn: 101065
2010-04-12 20:54:26 +00:00
Ted Kremenek 39a7665832 Fix null dereference in 'WriteSourceLocation' when the FileEntry is null.
llvm-svn: 101060
2010-04-12 19:54:17 +00:00
Benjamin Kramer 0644145373 Prune includes.
llvm-svn: 101059
2010-04-12 19:45:50 +00:00
Ted Kremenek de24a940a7 Update doxygen comments about lifetime requirements of CXUnsaveFile data arguments.
llvm-svn: 101054
2010-04-12 18:47:26 +00:00
Fariborz Jahanian 5a8c2034a4 Add some API code for future work.
llvm-svn: 101052
2010-04-12 18:18:10 +00:00
Daniel Dunbar b97bff9aa9 IRgen: Add CGRecordLayout::dump, and dump (irgen) record layouts as part of -fdump-record-layouts.
llvm-svn: 101051
2010-04-12 18:14:18 +00:00
Chris Lattner 509a32da75 fix PR6819
llvm-svn: 101050
2010-04-12 17:25:51 +00:00
Chris Lattner 5ff40fc7ab tighten the check for cast of super to avoid rejecting valid code,
rdar://7853261

llvm-svn: 101048
2010-04-12 17:09:27 +00:00
Douglas Gregor b93b606759 When creating the implicitly-declared special member functions, be
sure to introduce them into the current Scope (when we have one) in
addition to the DeclContext for the class, so that they can be found
by name lookup for inline members of the class. Fixes PR6570.

llvm-svn: 101047
2010-04-12 17:09:20 +00:00
Chris Lattner 08e774b7ef fix rdar://7852959 - Use of super within a block is actually ok.
(aka, Fariborz was right ;-)

llvm-svn: 101046
2010-04-12 17:03:29 +00:00
Fariborz Jahanian 5ea6bdd0ea Issue warning when 'weak_import' attribute is applied on a class only
when it is not supported in versions of MacOs.

llvm-svn: 101044
2010-04-12 16:57:31 +00:00
Douglas Gregor 61c1ac2e5c Remove the blanket statement about Clang not supporting access control. It does now
llvm-svn: 101041
2010-04-12 16:01:38 +00:00
Douglas Gregor ce40e2ef8a Fix a crash-on-invalid involving name lookup of tag names, where we
ended up finding a function template that we didn't expect. Recover
more gracefully, and fix a similar issue for class templates.

llvm-svn: 101040
2010-04-12 16:00:01 +00:00
Douglas Gregor 7531ca96f7 Add another test case for r101029, which verifies that we now
correctly diagnose instantiation of a function parameter with Objective-C
class type (since Objective-C classes can't be passed by value).

llvm-svn: 101031
2010-04-12 07:51:13 +00:00
Douglas Gregor 940bca7b93 Be sure to instantiate the parameters of a function, even when the
function's type is (strictly speaking) non-dependent. This ensures
that, e.g., default function arguments get instantiated properly.

And, since I couldn't resist, collapse the two implementations of
function-parameter instantiation into calls to a single, new function
(Sema::SubstParmVarDecl), since the two had nearly identical code (and
each had bugs the other didn't!). More importantly, factored out the
semantic analysis of a parameter declaration into
Sema::CheckParameter, which is called both by
Sema::ActOnParamDeclarator (when parameters are parsed) and when a
parameter is instantiated. Previously, we were missing some
Objective-C and address-space checks on instantiated function
parameters.

Fixes PR6733.

llvm-svn: 101029
2010-04-12 07:48:19 +00:00
Chris Lattner 3adb17d44f fix a bug I noticed by inspection, correcting two reject-valid bugs.
llvm-svn: 101026
2010-04-12 06:36:00 +00:00
Chris Lattner 3ab8ca2894 fix a rejects-valid bug that I introduced, pointed out
by David Chisnall

llvm-svn: 101024
2010-04-12 06:27:57 +00:00
Chris Lattner 1447136553 use pointer comparison instead of isStr
llvm-svn: 101022
2010-04-12 06:22:50 +00:00
Chris Lattner cd963185f0 fix a rejects-valid testcase involving super that I dreamt up.
This also fixes cases where super is used in a block in a
method which isn't valid.

llvm-svn: 101021
2010-04-12 06:20:33 +00:00
Chris Lattner df74264787 change Scope::WithinElse to be a normal scope flag, widen the
fields to two 16-bit values instead of using bitfields.

llvm-svn: 101020
2010-04-12 06:12:50 +00:00
Chris Lattner 7974fb130f fix this test.
llvm-svn: 101019
2010-04-12 05:47:20 +00:00
Chris Lattner c263f43ffd xfail this test for now.
llvm-svn: 101018
2010-04-12 05:44:13 +00:00
Chris Lattner 4806f7eb1f fix an invalid use of super, you can't use super like this in a block!
llvm-svn: 101017
2010-04-12 05:43:31 +00:00
Chris Lattner c2ebb03297 Have the parser decide whether a message to super is a variable or
type, instead of having sema do it.

llvm-svn: 101016
2010-04-12 05:38:43 +00:00
Nick Lewycky 7ff88f8b00 Typo.
llvm-svn: 101015
2010-04-12 05:32:01 +00:00
Chris Lattner 8731366c8b fix a fixme, stop evaluating getCurMethodDecl() repeatedly
in "LookupInObjCMethod".

llvm-svn: 101014
2010-04-12 05:10:17 +00:00
Chris Lattner a9396af5f2 other half of r101005
llvm-svn: 101006
2010-04-12 02:18:49 +00:00
Chris Lattner 37c75af0f8 fix PR6287 by accepting and ignoring the returns_twice attribute.
llvm-svn: 101005
2010-04-12 02:18:38 +00:00
Anders Carlsson 1c0f8bb4ce Have the CXXBaseOrMemberInitializer keep track of whether an initializer initializes a virtual base or not.
llvm-svn: 101004
2010-04-12 00:51:03 +00:00
Ted Kremenek cb13408f12 Unbreak test on windows.
llvm-svn: 100999
2010-04-11 22:25:18 +00:00
Anders Carlsson 3383e2ad74 Fix another bug where we wouldn't generate secondary vtables for construction vtables in some cases.
llvm-svn: 100998
2010-04-11 22:20:36 +00:00
Ted Kremenek 2908a20d86 Add initial USR support for macro definitions.
llvm-svn: 100997
2010-04-11 22:20:34 +00:00
Ted Kremenek 74c4389ea6 Augment clang_getCursorUSR() to not always expect that clang_getCursorDecl() does the right
thing if the cursor is not a decl (such as in the case of macros).

llvm-svn: 100996
2010-04-11 22:20:26 +00:00
Anders Carlsson d78b224e91 More renames.
llvm-svn: 100991
2010-04-11 22:07:06 +00:00