]> granicus.if.org Git - clang/log
clang
15 years agoMake sure we have a code in the node:-)
Steve Naroff [Sun, 26 Apr 2009 14:11:39 +0000 (14:11 +0000)]
Make sure we have a code in the node:-)

This fixes all the -emit-pch problems discovered by utils/pch-test.pl.

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

15 years agoUpdate StmtNodes.def with the new base class of CXXTemporaryObjectExpr
Sebastian Redl [Sun, 26 Apr 2009 11:30:47 +0000 (11:30 +0000)]
Update StmtNodes.def with the new base class of CXXTemporaryObjectExpr

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

15 years agoMake reference class unification in conditional expressions check for validity of...
Sebastian Redl [Sun, 26 Apr 2009 11:21:02 +0000 (11:21 +0000)]
Make reference class unification in conditional expressions check for validity of the conversion.

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

15 years agoAdd missing include. This fixes the build with gcc 4.3.3.
Torok Edwin [Sun, 26 Apr 2009 07:50:14 +0000 (07:50 +0000)]
Add missing include. This fixes the build with gcc 4.3.3.

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

15 years agochange TargetInfo::ConstraintInfo to be a struct that contains
Chris Lattner [Sun, 26 Apr 2009 07:16:29 +0000 (07:16 +0000)]
change TargetInfo::ConstraintInfo to be a struct that contains
the enum along with some other data.

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

15 years agoTurn off PCH by default, again
Douglas Gregor [Sun, 26 Apr 2009 05:09:50 +0000 (05:09 +0000)]
Turn off PCH by default, again

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

15 years agoOne more crazy try with PCH-by-default
Douglas Gregor [Sun, 26 Apr 2009 03:59:49 +0000 (03:59 +0000)]
One more crazy try with PCH-by-default

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

15 years agoMake sure to pull in the target builtin records when initialize the AST context,...
Douglas Gregor [Sun, 26 Apr 2009 03:57:37 +0000 (03:57 +0000)]
Make sure to pull in the target builtin records when initialize the AST context, even if we're not going to initialize the __builin_* identifiers

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

15 years agoSimple little smoke-test script that tries to build PCH files and then
Douglas Gregor [Sun, 26 Apr 2009 03:52:11 +0000 (03:52 +0000)]
Simple little smoke-test script that tries to build PCH files and then
dump their contents for all of the compilable tests in Clang's
testsuite. All of the tests pass for C, but there are still many
failures for Objective-C.

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

15 years agoWhen writing a PCH file, write multiple type and declaration blocks as
Douglas Gregor [Sun, 26 Apr 2009 03:49:13 +0000 (03:49 +0000)]
When writing a PCH file, write multiple type and declaration blocks as
necessary and iterate until all types and declarations have been
written. This reduces the Cocoa.h PCH file size by about 4% (since we
don't write types we don't need), and fixes problems where writing a
declaration generates a new type.

This doesn't seem to have any impact on performance either way.

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

15 years agoAdd a new -ast-dump-full option that traverses the translation unit
Douglas Gregor [Sun, 26 Apr 2009 02:02:08 +0000 (02:02 +0000)]
Add a new -ast-dump-full option that traverses the translation unit
declaration rather than printing through the HandleTopLevelDecl
action. Using this, one can deserialize an entire PCH file and dump
it.

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

15 years agoSplit C++ statements out to their own file.
Chris Lattner [Sun, 26 Apr 2009 01:42:41 +0000 (01:42 +0000)]
Split C++ statements out to their own file.

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

15 years agoTurn of PCH by default. I got the info I was looking for
Douglas Gregor [Sun, 26 Apr 2009 01:34:47 +0000 (01:34 +0000)]
Turn of PCH by default. I got the info I was looking for

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

15 years agosplit ObjC and C++ Statements out into their own headers.
Chris Lattner [Sun, 26 Apr 2009 01:32:48 +0000 (01:32 +0000)]
split ObjC and C++ Statements out into their own headers.

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

15 years agoCorrect the order of the parameters to CheckAssignmentConstraints in
Eli Friedman [Sun, 26 Apr 2009 01:30:08 +0000 (01:30 +0000)]
Correct the order of the parameters to CheckAssignmentConstraints in
cleanup attribute checking.  The difference isn't normally visible, but it
can make a difference...

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

15 years agoMake this code a little more generic.
Daniel Dunbar [Sun, 26 Apr 2009 01:28:51 +0000 (01:28 +0000)]
Make this code a little more generic.

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

15 years agoDriver: Add -std-default= option.
Daniel Dunbar [Sun, 26 Apr 2009 01:10:38 +0000 (01:10 +0000)]
Driver: Add -std-default= option.
 - This can be used to supply a default value for -std=; the idea is
   that this can be used in conjunction with CCC_ADD_ARGS or
   QA_OVERRIDE_GCC3_OPTIONS to change the default without having to
   modify the build system.

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

15 years agoAdd option for AddAllArgsTranslated to control whether output argument
Daniel Dunbar [Sun, 26 Apr 2009 01:07:52 +0000 (01:07 +0000)]
Add option for AddAllArgsTranslated to control whether output argument
should be joined or separate.

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

15 years agoimplement PCH support for the rest of ExprObjC.h, including
Chris Lattner [Sun, 26 Apr 2009 00:44:05 +0000 (00:44 +0000)]
implement PCH support for the rest of ExprObjC.h, including
the missing bits of ObjCMessageExpr.

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

15 years agoAnother shot at switching PCH on by default, now that we've cleaned up some bugs...
Douglas Gregor [Sun, 26 Apr 2009 00:37:38 +0000 (00:37 +0000)]
Another shot at switching PCH on by default, now that we've cleaned up some bugs and improved performance. Will be reverted after Mr. Speedy gets done with it

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

15 years agoWhen calling the cleanup function specified by __attribute__((cleanup)), make sure...
Anders Carlsson [Sun, 26 Apr 2009 00:34:20 +0000 (00:34 +0000)]
When calling the cleanup function specified by __attribute__((cleanup)), make sure to bitcast the argument so it has the same type as the first argument of the cleanup function. Fixes <rdar://problem/6827047>.

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

15 years agoDon't read all of the records in the PCH file's preprocessor block,
Douglas Gregor [Sun, 26 Apr 2009 00:07:37 +0000 (00:07 +0000)]
Don't read all of the records in the PCH file's preprocessor block,
most of which are ignored. Instead, move the __COUNTER__ value out to
a PCH-level record (since it is handled eagerly) and move the header
file information into the SourceManager block (which is also,
currently, loaded eagerly).

This results in another 17% performance improvement in the
Cocoa-prefixed "Hello, World" with PCH.

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

15 years agoFix for PR4074: allow subscripting non-lvalue arrays in C90 mode.
Eli Friedman [Sat, 25 Apr 2009 23:46:54 +0000 (23:46 +0000)]
Fix for PR4074: allow subscripting non-lvalue arrays in C90 mode.

I wasn't originally going to use this approach, but cases like
test/Sema/expr-comma.c make things difficult.

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

15 years agominor cleanups to ast-dump, use getBody(context).
Chris Lattner [Sat, 25 Apr 2009 23:31:28 +0000 (23:31 +0000)]
minor cleanups to ast-dump, use getBody(context).

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

15 years agoLazily load the controlling macros for all of the headers known in the
Douglas Gregor [Sat, 25 Apr 2009 23:30:02 +0000 (23:30 +0000)]
Lazily load the controlling macros for all of the headers known in the
PCH file. In the Cocoa-prefixed "Hello, World" benchmark, this takes
us from reading 503 identifiers down to 37 and from 470 macros down to
4. It also results in an 8% performance improvement.

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

15 years ago"This fixes message sends to super in a way that both works with real code and passes...
Chris Lattner [Sat, 25 Apr 2009 23:19:45 +0000 (23:19 +0000)]
"This fixes message sends to super in a way that both works with real code and passes the test in the test suite.  It also fixes a crash when using recent versions of GNU libobjc and compiling modules that do not contain any constant strings but do contain a declaration of the constant string class and possible some other corner cases (thanks to Pete French for providing me with a test case for that one)."

Patch by David Chisnall!

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

15 years agominor diagnostics improvements.
Chris Lattner [Sat, 25 Apr 2009 22:50:55 +0000 (22:50 +0000)]
minor diagnostics improvements.

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

15 years agoMinor simplification.
Eli Friedman [Sat, 25 Apr 2009 22:44:54 +0000 (22:44 +0000)]
Minor simplification.

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

15 years agoChange isNullPointerConstant to be strict; hopefully this won't cause
Eli Friedman [Sat, 25 Apr 2009 22:37:12 +0000 (22:37 +0000)]
Change isNullPointerConstant to be strict; hopefully this won't cause
any issues now that we have our own tgmath.h.

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

15 years agoMake VerifyIntegerConstantExpr print extension warnings for non-ICEs.
Eli Friedman [Sat, 25 Apr 2009 22:26:58 +0000 (22:26 +0000)]
Make VerifyIntegerConstantExpr print extension warnings for non-ICEs.

Overall, I'm not particularly happy with the current situation regarding
constant expression diagnostics, but I plan to improve it at some point.

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

15 years agoSilence gcc warnings.
Eli Friedman [Sat, 25 Apr 2009 22:20:56 +0000 (22:20 +0000)]
Silence gcc warnings.

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

15 years agofix PR4073 by making designated initializer checking code use
Chris Lattner [Sat, 25 Apr 2009 21:59:05 +0000 (21:59 +0000)]
fix PR4073 by making designated initializer checking code use
VerifyIntegerConstantExpression instead of isIntegerConstantExpr.
This makes it ext-warn but tolerate things that fold to a constant
but that are not valid i-c-e's.

There must be a bug in the i-c-e computation though, because it
doesn't catch this case even with pedantic.

This also switches the later code to use EvaluateAsInt which is
simpler and handles everything that evaluate does.

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

15 years agoOptimize the loading of an identifier from a PCH file when given the
Douglas Gregor [Sat, 25 Apr 2009 21:21:38 +0000 (21:21 +0000)]
Optimize the loading of an identifier from a PCH file when given the
identifier's ID. In this case, we know where the identifier's entry is
located in the hash table (it starts right before the identifier
string itself), so skip the hash table lookup and read the entry
directly. The performance improvement here is, gain, hard to quantify,
but it's the right thing to do.

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

15 years agoPCH optimization for the identifier table, where we separate
Douglas Gregor [Sat, 25 Apr 2009 21:04:17 +0000 (21:04 +0000)]
PCH optimization for the identifier table, where we separate
"interesting" identifiers (e.g., those where the IdentifierInfo has
some useful information) from "uninteresting" identifiers (where the
IdentifierInfo is just a name). This makes the hash table smaller (so
searching in it should be faster) and, when loading "uninteresting"
identifiers, we skip the lookup in the hash table.

PCH file size is slightly smaller than before (since we don't emit the
contents of the uninteresting IdentifierInfo structures). The
Cocoa.h-prefixed "Hello, World" doesn't show any speedup, although
we're getting to the point where system noise is a bit issue.

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

15 years agoRevert my changes that try to avoid creating StringMap entries for
Douglas Gregor [Sat, 25 Apr 2009 20:26:24 +0000 (20:26 +0000)]
Revert my changes that try to avoid creating StringMap entries for
identifiers. They don't yet work, but will inhibit future
optimizations.

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

15 years agoStart implementing the PTH IdentifierInfo-saving trick in PCH,
Douglas Gregor [Sat, 25 Apr 2009 20:21:25 +0000 (20:21 +0000)]
Start implementing the PTH IdentifierInfo-saving trick in PCH,
allocating IdentifierInfos with a pointer into the string data stored
in the PCH file rather than having an entry in the identifier table's
string map. However, we don't actually get these savings at the
moment, because we go through the IdentifierTable when loading
identifiers from the on-disk hash table.

This commit is for record-keeping purposes only. I'll be reverting
this change (and the PCH layout tweak that preceded it) because it
appears that implementing this optimization will collide with another,
future optimization to reduce the size of the on-disk hash table for
identifiers. That optimization is likely to provide more benefit (with
less voodoo).

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

15 years agofix PR4067: [Linux kernel] cannot aggregate codegen stmtexpr as lvalue
Chris Lattner [Sat, 25 Apr 2009 19:35:26 +0000 (19:35 +0000)]
fix PR4067: [Linux kernel] cannot aggregate codegen stmtexpr as lvalue

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

15 years agoTweak the data layout for the on-disk hash table of identifiers in the PCH file so...
Douglas Gregor [Sat, 25 Apr 2009 19:25:49 +0000 (19:25 +0000)]
Tweak the data layout for the on-disk hash table of identifiers in the PCH file so that the key layout matches that of the PTH key layout

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

15 years agoUpdated checker build.
Ted Kremenek [Sat, 25 Apr 2009 19:12:36 +0000 (19:12 +0000)]
Updated checker build.

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

15 years agoremove a fixme that is already done.
Chris Lattner [Sat, 25 Apr 2009 19:11:05 +0000 (19:11 +0000)]
remove a fixme that is already done.

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

15 years agoWrite the identifier offsets array into the PCH file as a blob, so
Douglas Gregor [Sat, 25 Apr 2009 19:10:14 +0000 (19:10 +0000)]
Write the identifier offsets array into the PCH file as a blob, so
that the PCH reader does not have to decode the VBR encoding at PCH
load time.

Also, reduce the size of the identifier offsets from 64 bits down to
32 bits. The identifier table itself isn't going to grow to more than
4GB :)

Overall, this results in a 13% speedup in the Cocoa-prefixed "Hello,
World" benchmark.

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

15 years agoimprove a diagnostic to make more sense.
Chris Lattner [Sat, 25 Apr 2009 18:52:45 +0000 (18:52 +0000)]
improve a diagnostic to make more sense.

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

15 years agoaccept an ignore the no_instrument_function attribute. Since we don't
Chris Lattner [Sat, 25 Apr 2009 18:44:54 +0000 (18:44 +0000)]
accept an ignore the no_instrument_function attribute.  Since we don't
support -pg, we never instrument :)

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

15 years agowith the fixes for better invalid decl/type propagation, this code
Chris Lattner [Sat, 25 Apr 2009 18:38:18 +0000 (18:38 +0000)]
with the fixes for better invalid decl/type propagation, this code
is no longer needed: a function type and a function declarator are
always known to line up.

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

15 years agoWrite the declaration and type offset arrays into the bitstream as
Douglas Gregor [Sat, 25 Apr 2009 18:35:21 +0000 (18:35 +0000)]
Write the declaration and type offset arrays into the bitstream as
blobs, so that we don't need to do any work to get these arrays into
memory at PCH load time.

This gives another 19% performance improvement to the Cocoa-prefixed
"Hello, World!".

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

15 years agoLoad the selector table lazily from the PCH file.
Douglas Gregor [Sat, 25 Apr 2009 17:48:32 +0000 (17:48 +0000)]
Load the selector table lazily from the PCH file.

This results in a 10% speedup on the Cocoa-prefixed "Hello, World!",
all of which is (not surprisingly) user time. There was a tiny
reduction in the size of the PCH file for Cocoa.h, because certain
selectors aren't being written twice.

I'm using two new tricks here that I'd like to replicate elsewhere:
  (1) The selectors not used in the global method pool are packed into
  the blob after the global method pool's on-disk hash table and
  stored as keys, so that all selectors are in the same blob.
  (2) We record the offsets of each selector key when we write it into
  the global method pool (or after it, in the same blob). The offset
  table is written as a blob, so that we don't need to pack/unpack a
  SmallVector with its contents.

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

15 years agoFix indexing error in PCHStmtReader::VisitArraySubscriptExpr().
Steve Naroff [Sat, 25 Apr 2009 15:19:54 +0000 (15:19 +0000)]
Fix indexing error in PCHStmtReader::VisitArraySubscriptExpr().

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

15 years agoAdd PCH support for ObjCMessageExpr (needed to build Mail).
Steve Naroff [Sat, 25 Apr 2009 14:04:28 +0000 (14:04 +0000)]
Add PCH support for ObjCMessageExpr (needed to build Mail).

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

15 years agoFixup comment.
Steve Naroff [Sat, 25 Apr 2009 12:18:35 +0000 (12:18 +0000)]
Fixup comment.

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

15 years agoFix a major bug in PCHReader::ReadSelectorBlock().
Steve Naroff [Sat, 25 Apr 2009 12:07:12 +0000 (12:07 +0000)]
Fix a major bug in PCHReader::ReadSelectorBlock().

Also simplify some syntax in PCHWriter::WritePreprocessor(), suggested by Chris.

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

15 years agoChange SemaType's "GetTypeForDeclarator" and "ConvertDeclSpecToType" to
Chris Lattner [Sat, 25 Apr 2009 08:47:54 +0000 (08:47 +0000)]
Change SemaType's "GetTypeForDeclarator" and "ConvertDeclSpecToType" to
always return a non-null QualType + error bit.  This fixes a bunch of
cases that didn't check for null result (and could thus crash) and eliminates
some crappy code scattered throughout sema.

This also improves the diagnostics in the recursive struct case to eliminate
a bogus second error.  It also cleans up the case added to function.c by forming
a proper function type even though the declarator is erroneous, allowing the
parameter to be added to the function.  Before:

t.c:2:1: error: unknown type name 'unknown_type'
unknown_type f(void*P)
^
t.c:4:3: error: use of undeclared identifier 'P'
  P+1;
  ^

After:
t.c:2:1: error: unknown type name 'unknown_type'
unknown_type f(void*P)
^

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

15 years agochange a couple more c++ sema methods to be based on isinvalid bits.
Chris Lattner [Sat, 25 Apr 2009 08:35:12 +0000 (08:35 +0000)]
change a couple more c++ sema methods to be based on isinvalid bits.

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

15 years agovarious "is invalid" cleanups for C++ ctors/dtors.
Chris Lattner [Sat, 25 Apr 2009 08:28:21 +0000 (08:28 +0000)]
various "is invalid" cleanups for C++ ctors/dtors.

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

15 years agoThis is a pretty big cleanup for how invalid decl/type are handle.
Chris Lattner [Sat, 25 Apr 2009 08:06:05 +0000 (08:06 +0000)]
This is a pretty big cleanup for how invalid decl/type are handle.
This gets rid of a bunch of random InvalidDecl bools in sema, changing
us to use the following approach:

1. When analyzing a declspec or declarator, if an error is found, we
   set a bit in Declarator saying that it is invalid.
2. Once the Decl is created by sema, we immediately set the isInvalid
   bit on it from what is in the declarator.  From this point on, sema
   consistently looks at and sets the bit on the decl.

This gives a very clear separation of concerns and simplifies a bunch
of code.  In addition to this, this patch makes these changes:

1. it renames DeclSpec::getInvalidType() -> isInvalidType().
2. various "merge" functions no longer return bools: they just set the
   invalid bit on the dest decl if invalid.
3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator
   methods now set invalid on the decl returned instead of returning an
   invalid bit byref.
4. In SemaType, refering to a typedef that was invalid now propagates the
   bit into the resultant type.  Stuff declared with the invalid typedef
   will now be marked invalid.
5. Various methods like CheckVariableDeclaration now return void and set the
   invalid bit on the decl they check.

There are a few minor changes to tests with this, but the only major bad
result is test/SemaCXX/constructor-recovery.cpp.  I'll take a look at this
next.

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

15 years agoRevert my PCH change. I'm happy now
Douglas Gregor [Sat, 25 Apr 2009 07:18:06 +0000 (07:18 +0000)]
Revert my PCH change. I'm happy now

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

15 years agoTemporarily try to build with PCH by default. Revert this change once
Douglas Gregor [Sat, 25 Apr 2009 06:28:32 +0000 (06:28 +0000)]
Temporarily try to build with PCH by default. Revert this change once
we see what trouble it causes.

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

15 years agofix PR4049, a crash on invalid, by making sema install the right number of
Chris Lattner [Sat, 25 Apr 2009 06:12:16 +0000 (06:12 +0000)]
fix PR4049, a crash on invalid, by making sema install the right number of
parameters in a functiondecl, even if the decl is invalid and has a confusing
Declarator.  On the testcase, we now emit one beautiful diagnostic:

t.c:2:1: error: unknown type name 'unknown_type'
unknown_type f(void*)
^

GCC 4.0 produces:

t.c:2: error: syntax error before ‘f’
t.c: In function ‘f’:
t.c:2: error: parameter name omitted

and GCC 4.2:

t.c:2: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘f’

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

15 years agorename getNumParmVarDeclsFromType back to getNumParams(),
Chris Lattner [Sat, 25 Apr 2009 06:03:53 +0000 (06:03 +0000)]
rename getNumParmVarDeclsFromType back to getNumParams(),
remove a special case that was apparently for typeof() and
generalize the code in SemaDecl that handles typedefs to
handle any sugar type (including typedef, typeof, etc).
Improve comment to make it more clear what is going on.

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

15 years agoadd a new helper function to FunctionDecl instead of it being
Chris Lattner [Sat, 25 Apr 2009 05:56:45 +0000 (05:56 +0000)]
add a new helper function to FunctionDecl instead of it being
static in Decl.cpp.

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

15 years agoin:
Chris Lattner [Sat, 25 Apr 2009 05:51:56 +0000 (05:51 +0000)]
in:
typedef void foo(void);

We get a typedef for a functiontypeproto with no arguments, not
one with one argument and type void.  This means the code being
removed in SemaDecl is dead.

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

15 years agoDriver: -mkernel disables default use of unwind tables (although I
Daniel Dunbar [Sat, 25 Apr 2009 05:49:54 +0000 (05:49 +0000)]
Driver: -mkernel disables default use of unwind tables (although I
don't yet understand where this is happening in llvm-gcc).

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

15 years agoset NewFD->setInvalidDecl() in one place, sharing code and ensuring that
Chris Lattner [Sat, 25 Apr 2009 05:44:12 +0000 (05:44 +0000)]
set NewFD->setInvalidDecl() in one place, sharing code and ensuring that
functions with prototypes get the bit.

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

15 years agoDriver: -mkernel and -fapple-kext imply -mno-red-zone.
Daniel Dunbar [Sat, 25 Apr 2009 05:33:23 +0000 (05:33 +0000)]
Driver: -mkernel and -fapple-kext imply -mno-red-zone.

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

15 years agoFix pointer addressing and array subscripting of Objective-C interface
Daniel Dunbar [Sat, 25 Apr 2009 05:08:32 +0000 (05:08 +0000)]
Fix pointer addressing and array subscripting of Objective-C interface
types.
 - I broke this in the switch to representing interfaces with opaque
   types.

 - <rdar://problem/6822660> clang crashes on subscript of interface in
   32-bit mode

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

15 years agoHook up attribute 'objc_ownership_retain' to the analyzer. This attribute allows
Ted Kremenek [Sat, 25 Apr 2009 01:21:50 +0000 (01:21 +0000)]
Hook up attribute 'objc_ownership_retain' to the analyzer. This attribute allows
users to specify that a method's argument is visibly retained (reference count
incremented).

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

15 years agoMake sure that the consumer sees all interested decls. This fixes Preview
Douglas Gregor [Sat, 25 Apr 2009 00:41:30 +0000 (00:41 +0000)]
Make sure that the consumer sees all interested decls. This fixes Preview

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

15 years agoAdd new checker-specific attribute 'objc_ownership_retain'. This isn't hooked up
Ted Kremenek [Sat, 25 Apr 2009 00:17:17 +0000 (00:17 +0000)]
Add new checker-specific attribute 'objc_ownership_retain'. This isn't hooked up
to the checker yet, but essentially it allows a user to specify that an
Objective-C method or C function increments the reference count of a passed
object.

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

15 years agoreject explicit pointer arithmetic on interface pointers in 64-bit objc ABI
Chris Lattner [Fri, 24 Apr 2009 23:50:08 +0000 (23:50 +0000)]
reject explicit pointer arithmetic on interface pointers in 64-bit objc ABI

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

15 years agoWhen we de-serialize an Objective-C protocol, hand it to the AST consumer so that...
Douglas Gregor [Fri, 24 Apr 2009 23:42:14 +0000 (23:42 +0000)]
When we de-serialize an Objective-C protocol, hand it to the AST consumer so that we can create metadata

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

15 years agoHook up __attribute__((objc_ownership_returns)) to the retain/release checker.
Ted Kremenek [Fri, 24 Apr 2009 23:32:32 +0000 (23:32 +0000)]
Hook up __attribute__((objc_ownership_returns)) to the retain/release checker.

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

15 years agoAdd new checker-specific attribute 'objc_ownership_returns'. This isn't hooked
Ted Kremenek [Fri, 24 Apr 2009 23:09:54 +0000 (23:09 +0000)]
Add new checker-specific attribute 'objc_ownership_returns'. This isn't hooked
up to the checker yet, but essentially it allows a user to specify that an
Objective-C method or C function returns an owned an Objective-C object.

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

15 years agoAdd CXXExprWithCleanup
Anders Carlsson [Fri, 24 Apr 2009 22:47:04 +0000 (22:47 +0000)]
Add CXXExprWithCleanup

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

15 years agofix the sizeof error recovery issue (sizeof-interface.m:attributeRuns)
Chris Lattner [Fri, 24 Apr 2009 22:30:50 +0000 (22:30 +0000)]
fix the sizeof error recovery issue (sizeof-interface.m:attributeRuns)
by correctly propagating the fact that the type was invalid up to the
attributeRuns decl, then returning an ExprError when attributeRuns is
formed (like we do for normal declrefexprs).

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

15 years agoFix a pasto in the lookup of instance methods in the global pool
Douglas Gregor [Fri, 24 Apr 2009 22:23:41 +0000 (22:23 +0000)]
Fix a pasto in the lookup of instance methods in the global pool

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

15 years agoOnce the protocol list has been loaded from the PCH file, add it to
Douglas Gregor [Fri, 24 Apr 2009 22:01:00 +0000 (22:01 +0000)]
Once the protocol list has been loaded from the PCH file, add it to
the Objective-C interface.

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

15 years agoFix the same false positive reported in PR 2542 and <rdar://problem/6793409>
Ted Kremenek [Fri, 24 Apr 2009 21:56:17 +0000 (21:56 +0000)]
Fix the same false positive reported in PR 2542 and <rdar://problem/6793409>
involving an NSAnimation object delegating its release to a delegate method.

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

15 years agoFix two small but very nasty bugs in the PCH writer for method pools:
Douglas Gregor [Fri, 24 Apr 2009 21:49:02 +0000 (21:49 +0000)]
Fix two small but very nasty bugs in the PCH writer for method pools:
  (1) Make sure to pad on-disk hash tables with 4 bytes, not 2, since
  the reader assumes that bucket data is aligned on 4-byte
  boundaries.
  (2) Don't emit the number of factory methods twice. This was
  throwing off the data counts and therefore causing lookups to
  fail. I've added asserts so that this class of error cannot happen
  again.

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

15 years agoPCH support for the global method pool (= instance and factory method
Douglas Gregor [Fri, 24 Apr 2009 21:10:55 +0000 (21:10 +0000)]
PCH support for the global method pool (= instance and factory method
pools, combined). The methods in the global method pool are lazily
loaded from an on-disk hash table when Sema looks into its version of
the hash tables.

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

15 years agoMinor refactoring. No intended change in behavior.
Fariborz Jahanian [Fri, 24 Apr 2009 21:07:43 +0000 (21:07 +0000)]
Minor refactoring. No intended change in behavior.

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

15 years agoAdd PCH support for #import.
Steve Naroff [Fri, 24 Apr 2009 20:03:17 +0000 (20:03 +0000)]
Add PCH support for #import.

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

15 years agoMinor refactoring: pass selector to getCommonMethodSummary(). No functionality
Ted Kremenek [Fri, 24 Apr 2009 18:19:07 +0000 (18:19 +0000)]
Minor refactoring: pass selector to getCommonMethodSummary(). No functionality
change.

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

15 years agoretain/release checker: more hacks to workaround false positives cause by
Ted Kremenek [Fri, 24 Apr 2009 18:00:17 +0000 (18:00 +0000)]
retain/release checker: more hacks to workaround false positives cause by
delegates. When a reference counted object is passed as to a 'void*' argument to
a method stop tracking the reference count.

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

15 years agoSentence case bug name.
Ted Kremenek [Fri, 24 Apr 2009 17:51:19 +0000 (17:51 +0000)]
Sentence case bug name.

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

15 years agoretain/release checker:
Ted Kremenek [Fri, 24 Apr 2009 17:50:11 +0000 (17:50 +0000)]
retain/release checker:
- Fix summary lookup for class methods to now use the (optional)
  ObjCInterfaceDecl associated with a message expression. This removes a
  long-standing FIXME.
- Partial fix for <rdar://problem/6062730> by stop tracking objects that
  are passed to [NSObject performSelector].  These methods are often used
  for delegates, which the analyzer doesn't reason about well yet.

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

15 years agoMake CXXTemporaryObjectExpr inherit from CXXConstructExpr.
Anders Carlsson [Fri, 24 Apr 2009 17:34:38 +0000 (17:34 +0000)]
Make CXXTemporaryObjectExpr inherit from CXXConstructExpr.

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

15 years agoAvoid issuing spurious errors as side-effect of diagnosing
Fariborz Jahanian [Fri, 24 Apr 2009 17:34:33 +0000 (17:34 +0000)]
Avoid issuing spurious errors as side-effect of diagnosing
application of sizeof on an interface.

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

15 years agoMinor refactoring. No change in functionality.
Fariborz Jahanian [Fri, 24 Apr 2009 17:15:27 +0000 (17:15 +0000)]
Minor refactoring. No change in functionality.

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

15 years agoUse cast_or_null instead of ternary operator (suggested by Doug).
Steve Naroff [Fri, 24 Apr 2009 16:59:10 +0000 (16:59 +0000)]
Use cast_or_null instead of ternary operator (suggested by Doug).

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

15 years agoSome code clean up of objc2's bitmap layout.
Fariborz Jahanian [Fri, 24 Apr 2009 16:17:09 +0000 (16:17 +0000)]
Some code clean up of objc2's bitmap layout.

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

15 years agoAllow the next catoregory slot to be null.
Steve Naroff [Fri, 24 Apr 2009 16:08:42 +0000 (16:08 +0000)]
Allow the next catoregory slot to be null.

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

15 years agofix rdar://6816766 - Crash with function-like macro test at end of directive.
Chris Lattner [Fri, 24 Apr 2009 07:15:46 +0000 (07:15 +0000)]
fix rdar://6816766 - Crash with function-like macro test at end of directive.

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

15 years agosimplification and speedup
Chris Lattner [Fri, 24 Apr 2009 07:15:22 +0000 (07:15 +0000)]
simplification and speedup

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

15 years agoFix assert.
Anders Carlsson [Fri, 24 Apr 2009 06:06:07 +0000 (06:06 +0000)]
Fix assert.

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

15 years agoCXXTempVarDecls aren't looked up. Fixes tests.
Anders Carlsson [Fri, 24 Apr 2009 06:02:55 +0000 (06:02 +0000)]
CXXTempVarDecls aren't looked up. Fixes tests.

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

15 years agoAdd an ASTContext parameter to CXXTemporaryObjectExpr.
Anders Carlsson [Fri, 24 Apr 2009 05:44:25 +0000 (05:44 +0000)]
Add an ASTContext parameter to CXXTemporaryObjectExpr.

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

15 years agoAdd a VarDecl parameter to the CXXTemporaryObjectExpr constructor. It's unused for...
Anders Carlsson [Fri, 24 Apr 2009 05:23:13 +0000 (05:23 +0000)]
Add a VarDecl parameter to the CXXTemporaryObjectExpr constructor. It's unused for now, so no functionality change yet. Also, create CXXTempVarDecls to pass to the CXXTemporaryObjectExpr ctor.

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

15 years agoCreate a CXXConstructExpr instead of a CXXTemporaryObjectExpr in InitializeVarWithCon...
Anders Carlsson [Fri, 24 Apr 2009 05:16:06 +0000 (05:16 +0000)]
Create a CXXConstructExpr instead of a CXXTemporaryObjectExpr in InitializeVarWithConstructor.

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

15 years agoMake sure that ObjCCompatibleAlias and ObjCImplementation decls are considered NamedDecls
Douglas Gregor [Fri, 24 Apr 2009 05:15:35 +0000 (05:15 +0000)]
Make sure that ObjCCompatibleAlias and ObjCImplementation decls are considered NamedDecls

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

15 years agoMake the CXXConstructExpr public and add a StmtClass to it. No functionality change.
Anders Carlsson [Fri, 24 Apr 2009 05:04:04 +0000 (05:04 +0000)]
Make the CXXConstructExpr public and add a StmtClass to it. No functionality change.

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

15 years agoMove the CXXConstructExpr before the CXXTemporaryObjectExpr so that the temporary...
Anders Carlsson [Fri, 24 Apr 2009 04:57:02 +0000 (04:57 +0000)]
Move the CXXConstructExpr before the CXXTemporaryObjectExpr so that the temporary object expr can inherit from the construct expr. No functionality change.

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