]> granicus.if.org Git - clang/log
clang
14 years agoStart working on handling wide bitfields in C++
Anders Carlsson [Fri, 16 Apr 2010 15:16:32 +0000 (15:16 +0000)]
Start working on handling wide bitfields in C++

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

14 years agoRename the ASTContext member 'Context'.
Anders Carlsson [Fri, 16 Apr 2010 15:07:51 +0000 (15:07 +0000)]
Rename the ASTContext member 'Context'.

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

14 years agoOnly predefine the macro _GNU_SOURCE in C++ mode when we're on a
Douglas Gregor [Fri, 16 Apr 2010 06:31:05 +0000 (06:31 +0000)]
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.

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

14 years agotidy up
Chris Lattner [Fri, 16 Apr 2010 06:12:51 +0000 (06:12 +0000)]
tidy up

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

14 years agoExpand the argument diagnostics for too many arguments and give
Eric Christopher [Fri, 16 Apr 2010 04:56:46 +0000 (04:56 +0000)]
Expand the argument diagnostics for too many arguments and give
both number seen and number expected.

Finishes fixing PR6501.

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

14 years agoExpand argument diagnostic for too few arguments to give the number
Eric Christopher [Fri, 16 Apr 2010 04:48:22 +0000 (04:48 +0000)]
Expand argument diagnostic for too few arguments to give the number
of arguments both seen and expected.

Fixes PR6501.

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

14 years agoConvert libCIndex to use the new native EXPORTED_SYMBOL_FILE mechanism.
Dan Gohman [Fri, 16 Apr 2010 04:45:02 +0000 (04:45 +0000)]
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.

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

14 years agoFix a bug in caret-line-pruning logic that only happens when we have a
Douglas Gregor [Fri, 16 Apr 2010 00:23:51 +0000 (00:23 +0000)]
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>.

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

14 years agoAudit uses of Sema::LookupSingleName for those lookups that are
Douglas Gregor [Thu, 15 Apr 2010 23:40:53 +0000 (23:40 +0000)]
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).

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

14 years agoFeed proper source-location information into Sema::LookupSingleResult,
Douglas Gregor [Thu, 15 Apr 2010 22:33:43 +0000 (22:33 +0000)]
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.

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

14 years agoBetter support USRs for anonymous enums, structs, by including the location where
Ted Kremenek [Thu, 15 Apr 2010 21:51:13 +0000 (21:51 +0000)]
Better support USRs for anonymous enums, structs, by including the location where
the tag was declared.  WIP.

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

14 years agoSpecify temporary file for -emit-llvm output in test case so that we don't deposit...
Ted Kremenek [Thu, 15 Apr 2010 21:11:33 +0000 (21:11 +0000)]
Specify temporary file for -emit-llvm output in test case so that we don't deposit the file
in the original source directory.

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

14 years agoDo not generate USRs for declarations with 'no linkage' except for enums, structs...
Ted Kremenek [Thu, 15 Apr 2010 21:04:25 +0000 (21:04 +0000)]
Do not generate USRs for declarations with 'no linkage' except for enums, structs, typedefs.
Those still need work to disambiguate them across translation units.

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

14 years agoImprove the bit-field too wide error message.
Anders Carlsson [Thu, 15 Apr 2010 18:47:32 +0000 (18:47 +0000)]
Improve the bit-field too wide error message.

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

14 years agoDiagnose attempts to throw an abstract class type.
Douglas Gregor [Thu, 15 Apr 2010 18:05:39 +0000 (18:05 +0000)]
Diagnose attempts to throw an abstract class type.

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

14 years agoFix PR 6844, a regression caused by the introduction of llvm_unreachable for the...
Ted Kremenek [Thu, 15 Apr 2010 17:33:31 +0000 (17:33 +0000)]
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.

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

14 years agoSplit adding the primary virtual base offsets out into a separate pass. This fixes...
Anders Carlsson [Thu, 15 Apr 2010 16:12:58 +0000 (16:12 +0000)]
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.

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

14 years agoFix a few cases where enum constant handling was using
Douglas Gregor [Thu, 15 Apr 2010 15:53:31 +0000 (15:53 +0000)]
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.

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

14 years agoclang -cc1: Add a -fno-bitfield-type-align option, for my own testing purposes.
Daniel Dunbar [Thu, 15 Apr 2010 15:06:22 +0000 (15:06 +0000)]
clang -cc1: Add a -fno-bitfield-type-align option, for my own testing purposes.

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

14 years agoTweak spelling (Bitfield -> BitField)
Daniel Dunbar [Thu, 15 Apr 2010 15:06:18 +0000 (15:06 +0000)]
Tweak spelling (Bitfield -> BitField)

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

14 years agoTeach -fixit to modify all of its inputs instead of just the main file, unless
Nick Lewycky [Thu, 15 Apr 2010 06:46:58 +0000 (06:46 +0000)]
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.

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

14 years agoInclude sender address in completion log.
Ted Kremenek [Thu, 15 Apr 2010 06:32:15 +0000 (06:32 +0000)]
Include sender address in completion log.

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

14 years agoTidy up comment.
Daniel Dunbar [Thu, 15 Apr 2010 06:18:42 +0000 (06:18 +0000)]
Tidy up comment.

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

14 years agoAdd TargetInfo::useBitfieldTypeAlignment().
Daniel Dunbar [Thu, 15 Apr 2010 06:18:39 +0000 (06:18 +0000)]
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).

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

14 years agoDriver/Frontend: Add support for -mllvm, which forwards options to the LLVM option...
Daniel Dunbar [Thu, 15 Apr 2010 06:09:03 +0000 (06:09 +0000)]
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.

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

14 years agoIRgen: Change CGBitFieldInfo to take the AccessInfo as constructor arguments, it...
Daniel Dunbar [Thu, 15 Apr 2010 05:09:32 +0000 (05:09 +0000)]
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.

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

14 years agoIRgen: Eliminate now unused fields from CGBitFieldInfo.
Daniel Dunbar [Thu, 15 Apr 2010 05:09:28 +0000 (05:09 +0000)]
IRgen: Eliminate now unused fields from CGBitFieldInfo.

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

14 years agoIRgen: (Reapply 101222, with fixes) Move EmitStoreThroughBitfieldLValue to use new...
Daniel Dunbar [Thu, 15 Apr 2010 03:47:33 +0000 (03:47 +0000)]
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.

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

14 years agoRewrite handling of 64-bit palignr intrinsics to be vector shuffles.
Eric Christopher [Thu, 15 Apr 2010 01:43:08 +0000 (01:43 +0000)]
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.

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

14 years agoTeach ASTVector::append() about the case where 'NumInputs' is 0. This hopefully...
Ted Kremenek [Thu, 15 Apr 2010 01:14:12 +0000 (01:14 +0000)]
Teach ASTVector::append() about the case where 'NumInputs' is 0.  This hopefully fixes
a crash in InitListExpr's ctor.

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

14 years agoAdd simple python server for recording code completion timings.
Ted Kremenek [Thu, 15 Apr 2010 01:02:31 +0000 (01:02 +0000)]
Add simple python server for recording code completion timings.

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

14 years agoAdd optional timing logging for code completion results. This causes a UDP packet
Ted Kremenek [Thu, 15 Apr 2010 01:02:28 +0000 (01:02 +0000)]
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).

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

14 years agoWarn about non-aggregate classes with no user-declared constructors
Douglas Gregor [Thu, 15 Apr 2010 00:00:53 +0000 (00:00 +0000)]
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>.

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

14 years agoAlways diagnose and complain about problems in
Douglas Gregor [Wed, 14 Apr 2010 23:11:21 +0000 (23:11 +0000)]
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>.

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

14 years agoFix 80-cols violtaions
Sean Hunt [Wed, 14 Apr 2010 23:07:37 +0000 (23:07 +0000)]
Fix 80-cols violtaions

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

14 years agoOnce we've emitted a fatal diagnostic, keep counting errors but with a
Douglas Gregor [Wed, 14 Apr 2010 22:19:45 +0000 (22:19 +0000)]
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>.

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

14 years agoMake CXLanguage_Invalid the first enum value (with '0' as its value) in CXLanguageKind.
Ted Kremenek [Wed, 14 Apr 2010 20:58:32 +0000 (20:58 +0000)]
Make CXLanguage_Invalid the first enum value (with '0' as its value) in CXLanguageKind.

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

14 years agoFix a -pedantic spurious warning involving @dynamic.
Fariborz Jahanian [Wed, 14 Apr 2010 20:52:42 +0000 (20:52 +0000)]
Fix a -pedantic spurious warning involving @dynamic.

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

14 years agoimprove altivec c++ support by adding casts, patch by
Chris Lattner [Wed, 14 Apr 2010 20:35:39 +0000 (20:35 +0000)]
improve altivec c++ support by adding casts, patch by
Anton Yartsev!

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

14 years agoThread a Scope pointer into BuildRecoveryCallExpr to help typo
Douglas Gregor [Wed, 14 Apr 2010 20:27:54 +0000 (20:27 +0000)]
Thread a Scope pointer into BuildRecoveryCallExpr to help typo
correction find names when a call failed. Fixes
<rdar://problem/7853795>.

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

14 years agoTeach typo correction about various language keywords. We can't
Douglas Gregor [Wed, 14 Apr 2010 20:04:41 +0000 (20:04 +0000)]
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.

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

14 years agoReturn the corrected DeclarationName from Sema::CorrectTypo rather
Douglas Gregor [Wed, 14 Apr 2010 17:09:22 +0000 (17:09 +0000)]
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.

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

14 years agoIRgen/NeXT: Simplify to use AST record layout for getting offsets instead of the
Daniel Dunbar [Wed, 14 Apr 2010 17:02:21 +0000 (17:02 +0000)]
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.

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

14 years agoWhen diagnosing suspicious precedence or assignments, move the fix-it
Douglas Gregor [Wed, 14 Apr 2010 16:09:52 +0000 (16:09 +0000)]
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) {
        ^
          (     )

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

14 years agoMove GRStmtNodeBuilder::MakeNode() out of line. No functionality change.
Zhongxing Xu [Wed, 14 Apr 2010 06:35:09 +0000 (06:35 +0000)]
Move GRStmtNodeBuilder::MakeNode() out of line. No functionality change.

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

14 years agoAdd support for CXXBoolLiteralExpr.
Zhongxing Xu [Wed, 14 Apr 2010 06:29:29 +0000 (06:29 +0000)]
Add support for CXXBoolLiteralExpr.

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

14 years agoUse direct assignment instead of user defined conversion.
Zhongxing Xu [Wed, 14 Apr 2010 05:50:04 +0000 (05:50 +0000)]
Use direct assignment instead of user defined conversion.

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

14 years agoSpeculatively revert "IRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfiel...
Daniel Dunbar [Wed, 14 Apr 2010 05:48:35 +0000 (05:48 +0000)]
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.

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

14 years agoImprove line marker directive locations, patch by Jordy Rose
Chris Lattner [Wed, 14 Apr 2010 04:28:50 +0000 (04:28 +0000)]
Improve line marker directive locations, patch by Jordy Rose

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

14 years agoadd builtin for __builtin_vsprintf, patch by Paul Davey
Chris Lattner [Wed, 14 Apr 2010 04:25:45 +0000 (04:25 +0000)]
add builtin for __builtin_vsprintf, patch by Paul Davey

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

14 years agoIRgen: Move EmitStoreThroughBitfieldLValue to use new CGBitfieldInfo::AccessInfo...
Daniel Dunbar [Wed, 14 Apr 2010 04:08:03 +0000 (04:08 +0000)]
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.

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

14 years agoIRgen: Tweak CGBitFieldInfo doxyments & add an accessor.
Daniel Dunbar [Wed, 14 Apr 2010 04:07:59 +0000 (04:07 +0000)]
IRgen: Tweak CGBitFieldInfo doxyments & add an accessor.

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

14 years agomake the token paste avoidance logic turn "..." into ".. ." instead of ". . ."
Chris Lattner [Wed, 14 Apr 2010 03:57:19 +0000 (03:57 +0000)]
make the token paste avoidance logic turn "..." into ".. ." instead of ". . ."
when avoiding paste.  Patch by David Peixotto!

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

14 years agoimplement altivec.h and a bunch of support code, patch by Anton Yartsev!
Chris Lattner [Wed, 14 Apr 2010 03:54:58 +0000 (03:54 +0000)]
implement altivec.h and a bunch of support code, patch by Anton Yartsev!

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

14 years agoremove some obsolete super-handling code that I forgot to zap.
Chris Lattner [Wed, 14 Apr 2010 03:16:52 +0000 (03:16 +0000)]
remove some obsolete super-handling code that I forgot to zap.

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

14 years agoImplement typo correction for Objective-C message sends when the
Douglas Gregor [Wed, 14 Apr 2010 02:46:37 +0000 (02:46 +0000)]
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".

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

14 years agoIntroduce a parsing action to distinguish between class, instance, and
Douglas Gregor [Wed, 14 Apr 2010 02:22:16 +0000 (02:22 +0000)]
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.

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

14 years agoMark a function declaration invalid if any of its parameter declarations
John McCall [Wed, 14 Apr 2010 01:27:20 +0000 (01:27 +0000)]
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.

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

14 years agoParse friend template ids as types instead of ending up in
John McCall [Wed, 14 Apr 2010 00:24:33 +0000 (00:24 +0000)]
Parse friend template ids as types instead of ending up in
ActOnClassTemplateSpecialization and being very confused.
Fixes PR6514 (for non-templated-scope friends).

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

14 years agoAdd encoding of reference types like gcc does for objc methods and
Fariborz Jahanian [Tue, 13 Apr 2010 23:45:47 +0000 (23:45 +0000)]
Add encoding of reference types like gcc does for objc methods and
blocks. Fixes PR6468.

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

14 years agoUse ASTVector instead of std::vector for the Exprs in InitListExpr. Performance
Ted Kremenek [Tue, 13 Apr 2010 23:39:13 +0000 (23:39 +0000)]
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.

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

14 years agoIntroduce ASTVector, which is a std::vector-like class that allocates all memory
Ted Kremenek [Tue, 13 Apr 2010 23:39:09 +0000 (23:39 +0000)]
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.

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

14 years agoAdd cursor kind for C++ methods.
Ted Kremenek [Tue, 13 Apr 2010 23:39:06 +0000 (23:39 +0000)]
Add cursor kind for C++ methods.

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

14 years agoIRgen: Move EmitLoadOfBitfieldLValue to use new CGBitfieldInfo::AccessInfo decomposit...
Daniel Dunbar [Tue, 13 Apr 2010 23:34:15 +0000 (23:34 +0000)]
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.

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

14 years agoFix an embarrasing memory error. I was apparently very tired when I wrote this
John McCall [Tue, 13 Apr 2010 22:18:28 +0000 (22:18 +0000)]
Fix an embarrasing memory error.  I was apparently very tired when I wrote this
code the first time.

Fixes PR6827.

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

14 years agoIRgen: Enhance CGBitFieldInfo with enough information to fully describe the "policy...
Daniel Dunbar [Tue, 13 Apr 2010 20:58:55 +0000 (20:58 +0000)]
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.

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

14 years agoRemove unnecessary cast.
Daniel Dunbar [Tue, 13 Apr 2010 20:52:05 +0000 (20:52 +0000)]
Remove unnecessary cast.

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

14 years agoSupport befriending members of class template specializations.
John McCall [Tue, 13 Apr 2010 20:37:33 +0000 (20:37 +0000)]
Support befriending members of class template specializations.

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

14 years agoTwik to radar 7839485. Do not attach weak_import attribute to class
Fariborz Jahanian [Tue, 13 Apr 2010 20:22:35 +0000 (20:22 +0000)]
Twik to radar 7839485. Do not attach weak_import attribute to class
for non-fragile abi on darwin.

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

14 years agoTurn off warning about weak_import attribute
Fariborz Jahanian [Tue, 13 Apr 2010 19:02:07 +0000 (19:02 +0000)]
Turn off warning about weak_import attribute
on objc classes for Darwin. Radar 7839485.

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

14 years agoRemoves a FIXME.
Fariborz Jahanian [Tue, 13 Apr 2010 18:43:37 +0000 (18:43 +0000)]
Removes a FIXME.

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

14 years agoVariation of objc_copyStruct API generation when
Fariborz Jahanian [Tue, 13 Apr 2010 18:32:24 +0000 (18:32 +0000)]
Variation of objc_copyStruct API generation when
property (atomic/nonatomic) is of aggregate type with
gc'able member objects) (NeXT runtime).

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

14 years agoRework the ConstStructBuilder code to emit missing initializer
Chris Lattner [Tue, 13 Apr 2010 18:16:19 +0000 (18:16 +0000)]
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.

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

14 years agounbreak tests.
Chris Lattner [Tue, 13 Apr 2010 17:57:11 +0000 (17:57 +0000)]
unbreak tests.

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

14 years agomove a bunch of ConstStructBuilder methods out of line.
Chris Lattner [Tue, 13 Apr 2010 17:45:57 +0000 (17:45 +0000)]
move a bunch of ConstStructBuilder methods out of line.

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

14 years agominor cleanups
Chris Lattner [Tue, 13 Apr 2010 17:39:09 +0000 (17:39 +0000)]
minor cleanups

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

14 years agoTeach HasSideEffect about InitListExprs. Not having
Chris Lattner [Tue, 13 Apr 2010 17:34:23 +0000 (17:34 +0000)]
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},
};

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

14 years agomake the rewriter add a #ifndef around the #define of __attribute__.
Chris Lattner [Tue, 13 Apr 2010 17:33:56 +0000 (17:33 +0000)]
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).

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

14 years agoRefactor and simplify the computation of implicit conversion sequences
Douglas Gregor [Tue, 13 Apr 2010 16:31:36 +0000 (16:31 +0000)]
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.

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

14 years agoWhen returning the result of a call to an object of class type, do not
Douglas Gregor [Tue, 13 Apr 2010 15:50:39 +0000 (15:50 +0000)]
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.

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

14 years agoDuring referencing binding, only consider conversion functions for
Douglas Gregor [Tue, 13 Apr 2010 15:07:45 +0000 (15:07 +0000)]
During referencing binding, only consider conversion functions for
direct reference binding when the source and target types are not
reference-related. Fixes PR6066.

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

14 years agoMake all cases that we don't handle explicit.
Zhongxing Xu [Tue, 13 Apr 2010 13:15:19 +0000 (13:15 +0000)]
Make all cases that we don't handle explicit.

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

14 years agoDispatch all C++ cast expr to VisitCast().
Zhongxing Xu [Tue, 13 Apr 2010 12:38:32 +0000 (12:38 +0000)]
Dispatch all C++ cast expr to VisitCast().

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

14 years agoCFGBuilder: always add C++ member call expr as block-level expr.
Zhongxing Xu [Tue, 13 Apr 2010 09:38:01 +0000 (09:38 +0000)]
CFGBuilder: always add C++ member call expr as block-level expr.

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

14 years agoAllow classes to befriend implicitly-declared members. Fixes PR6207 for
John McCall [Tue, 13 Apr 2010 07:45:41 +0000 (07:45 +0000)]
Allow classes to befriend implicitly-declared members.  Fixes PR6207 for
members of non-templated classes.

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

14 years agoAdd a cc1 option to specify the max number of nodes the analyzer can explore.
Zhongxing Xu [Tue, 13 Apr 2010 06:44:31 +0000 (06:44 +0000)]
Add a cc1 option to specify the max number of nodes the analyzer can explore.

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

14 years agoParse constructor names in friend declarations. Part of the fix for
John McCall [Tue, 13 Apr 2010 06:39:49 +0000 (06:39 +0000)]
Parse constructor names in friend declarations.  Part of the fix for
PR6207.

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

14 years agoRemove this test for now until I can figure out
Fariborz Jahanian [Tue, 13 Apr 2010 02:16:35 +0000 (02:16 +0000)]
Remove this test for now until I can figure out
why it keeps failing on buildbot (but not for me).

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

14 years agoDon't try to find a scope corresponding to the search DC for an unfound
John McCall [Tue, 13 Apr 2010 01:44:10 +0000 (01:44 +0000)]
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.

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

14 years agoModify test to be darwin specific.
Fariborz Jahanian [Tue, 13 Apr 2010 01:10:57 +0000 (01:10 +0000)]
Modify test to be darwin specific.

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

14 years agoadd frontend support for -fdata-sections and -ffunction-sections,
Chris Lattner [Tue, 13 Apr 2010 00:38:24 +0000 (00:38 +0000)]
add frontend support for -fdata-sections and -ffunction-sections,
patch by Sylvere Teissier!

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

14 years agoAdd support for objc_copyStruct to enforce
Fariborz Jahanian [Tue, 13 Apr 2010 00:38:05 +0000 (00:38 +0000)]
Add support for objc_copyStruct to enforce
atomicity of aggregate properties in setter/getter
methods. wip.

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

14 years agoFix debug info for cleanup block.
Devang Patel [Tue, 13 Apr 2010 00:08:43 +0000 (00:08 +0000)]
Fix debug info for cleanup block.

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

14 years agocache the PP's SourceManager.
Chris Lattner [Tue, 13 Apr 2010 00:06:42 +0000 (00:06 +0000)]
cache the PP's SourceManager.

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

14 years agoDiagnose declarations of conversion functions with declarators other than '()'.
John McCall [Tue, 13 Apr 2010 00:04:31 +0000 (00:04 +0000)]
Diagnose declarations of conversion functions with declarators other than '()'.

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

14 years agomake the preprocessor listen to linemarker directives in -E mode,
Chris Lattner [Tue, 13 Apr 2010 00:01:41 +0000 (00:01 +0000)]
make the preprocessor listen to linemarker directives in -E mode,
PR6101.  This is based on a patch and testcase by Jordy Rose!

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

14 years agoRemove some dead FIXMEs
Douglas Gregor [Mon, 12 Apr 2010 23:52:24 +0000 (23:52 +0000)]
Remove some dead FIXMEs

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

14 years agoImplement C++ [over.ics.user]p3, which restricts the final conversion
Douglas Gregor [Mon, 12 Apr 2010 23:42:09 +0000 (23:42 +0000)]
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.

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

14 years agoImprove source-location information for C++ conversion functions, by
Douglas Gregor [Mon, 12 Apr 2010 23:19:01 +0000 (23:19 +0000)]
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.

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

14 years agofix a minor bug I noticed while work with Jordy's patch for PR6101,
Chris Lattner [Mon, 12 Apr 2010 23:04:41 +0000 (23:04 +0000)]
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.

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