]> granicus.if.org Git - clang/log
clang
16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 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

16 years agoDon't run dsymutil when making a fat executable direct source.
Daniel Dunbar [Fri, 24 Apr 2009 03:03:52 +0000 (03:03 +0000)]
Don't run dsymutil when making a fat executable direct source.
 - Otherwise, we will end up with stray .dSYM files which don't get
   lipo'ed or removed.

 - Ideally we would run dsymutil on the result, but we don't have the
   infrastructure for that yet. Note that gcc doesn't handle this case
   either.

 - <rdar://problem/6809621> [driver] clang leaves .dSYM files lying
   around in tmp.

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

16 years agoEliminate Sema::ObjCAliasDecls. This is based on Steve's fix, but also
Douglas Gregor [Fri, 24 Apr 2009 02:57:34 +0000 (02:57 +0000)]
Eliminate Sema::ObjCAliasDecls. This is based on Steve's fix, but also
updates name lookup so that we see through @compatibility_alias
declarations to their underlying interfaces.

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

16 years agoClang part of r69947. Reverting back 69574 as it is no longer needed.
Sanjiv Gupta [Fri, 24 Apr 2009 02:40:57 +0000 (02:40 +0000)]
Clang part of r69947. Reverting back 69574 as it is no longer needed.

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

16 years agoAdd a test case for a somewhat obscure scenario.
Daniel Dunbar [Fri, 24 Apr 2009 02:38:10 +0000 (02:38 +0000)]
Add a test case for a somewhat obscure scenario.

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

16 years agoFix Objective-C crashes
Douglas Gregor [Fri, 24 Apr 2009 02:15:36 +0000 (02:15 +0000)]
Fix Objective-C crashes

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

16 years agoWe don't accept this test anymore in a non-fragile ABI.
Daniel Dunbar [Fri, 24 Apr 2009 02:11:35 +0000 (02:11 +0000)]
We don't accept this test anymore in a non-fragile ABI.

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

16 years agoFix rdar://6821047 - clang crashes on subscript of interface in 64-bit mode
Chris Lattner [Fri, 24 Apr 2009 00:30:45 +0000 (00:30 +0000)]
Fix rdar://6821047 - clang crashes on subscript of interface in 64-bit mode

Several changes here:
1. We change Type::isIncompleteType to realize that forward declared
   interfaces are incomplete.  This eliminate special case code for this
   from the sizeof path, and starts us rejecting P[4] when P is a pointer
   to an incomplete interface.
2. Explicitly reject P[4] when P points to an interface in non-fragile ABI
   mode.
3. Switch the sizeof(interface) diagnostic back to an error instead of a
   warning in non-fragile abi mode.

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

16 years agoEliminate Sema::ObjCInterfaceDecls
Douglas Gregor [Fri, 24 Apr 2009 00:16:12 +0000 (00:16 +0000)]
Eliminate Sema::ObjCInterfaceDecls

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

16 years agoEliminate Sema::ObjCImplementations, relying instead on name lookup. What's good...
Douglas Gregor [Fri, 24 Apr 2009 00:11:27 +0000 (00:11 +0000)]
Eliminate Sema::ObjCImplementations, relying instead on name lookup. What's good for uniformity is good for PCH (or is it the other way around?).

As part of this, make ObjCImplDecl inherit from NamedDecl (since
ObjCImplementationDecls now need to have names so that they can be
found). This brings ObjCImplDecl very, very close to
ObjCContainerDecl; we may be able to merge them soon.

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

16 years agoUpdate checker build.
Ted Kremenek [Thu, 23 Apr 2009 23:42:21 +0000 (23:42 +0000)]
Update checker build.

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

16 years agoEliminate Sema::ObjCProtocols. Instead, we place ObjCProtocolDecls in
Douglas Gregor [Thu, 23 Apr 2009 23:18:26 +0000 (23:18 +0000)]
Eliminate Sema::ObjCProtocols. Instead, we place ObjCProtocolDecls in
their own namespace (IDNS_Protocol) and use the normal name-lookup
routines to find them. Aside from the simplification this provides
(one less DenseMap!), it means that protocols will be lazily
deserialized from PCH files.

Make the code size of the selector table block match the code size of
the type and decl blocks.

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

16 years agoCall ld, not collect2.
Daniel Dunbar [Thu, 23 Apr 2009 23:17:23 +0000 (23:17 +0000)]
Call ld, not collect2.
 - <rdar://problem/6517382> [driver] call ld directly

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

16 years agoRefactor common logic in getMethodSummary() and getClassMethodSummary(). No
Ted Kremenek [Thu, 23 Apr 2009 23:08:22 +0000 (23:08 +0000)]
Refactor common logic in getMethodSummary() and getClassMethodSummary(). No
functionality change.

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

16 years agoPCH support for categories in Objective-C interfaces.
Douglas Gregor [Thu, 23 Apr 2009 22:34:55 +0000 (22:34 +0000)]
PCH support for categories in Objective-C interfaces.

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

16 years agoPCH support for all of the predefined Objective-C types, such as id,
Douglas Gregor [Thu, 23 Apr 2009 22:29:11 +0000 (22:29 +0000)]
PCH support for all of the predefined Objective-C types, such as id,
SEL, Class, Protocol, CFConstantString, and
__objcFastEnumerationState. With this, we can now run the Objective-C
methods and properties PCH tests.

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

16 years agoFurther cleanups to isTrackedObjectType().
Ted Kremenek [Thu, 23 Apr 2009 22:11:07 +0000 (22:11 +0000)]
Further cleanups to isTrackedObjectType().

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

16 years agoDiagnose if an implementation implements a forward class
Fariborz Jahanian [Thu, 23 Apr 2009 21:49:04 +0000 (21:49 +0000)]
Diagnose if an implementation implements a forward class
declaration (and avoid issuing bogus error later on).

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

16 years agoretain/release checker: Don't call isTrackedObject() with the canonical type.
Ted Kremenek [Thu, 23 Apr 2009 21:25:57 +0000 (21:25 +0000)]
retain/release checker: Don't call isTrackedObject() with the canonical type.
This was preventing the checker from tracking return objects referenced by 'id'.

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

16 years agoTemporarily remove expected warnings.
Ted Kremenek [Thu, 23 Apr 2009 20:03:52 +0000 (20:03 +0000)]
Temporarily remove expected warnings.

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

16 years agoretain/release checker: For class methods, only treat return values that are
Ted Kremenek [Thu, 23 Apr 2009 20:02:30 +0000 (20:02 +0000)]
retain/release checker: For class methods, only treat return values that are
object references as tracked objects.

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

16 years agoaccept and ignore -Wconversion
Chris Lattner [Thu, 23 Apr 2009 19:54:39 +0000 (19:54 +0000)]
accept and ignore -Wconversion

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

16 years agoPer discussions with Ken Ferry and Paul Marks (<rdar://problem/6815234>) greatly
Ted Kremenek [Thu, 23 Apr 2009 19:11:35 +0000 (19:11 +0000)]
Per discussions with Ken Ferry and Paul Marks (<rdar://problem/6815234>) greatly
extend the number of objects tracked by the retain/release checker by assuming
that all class and instance methods should follow Cocoa object "getter" and
"alloc/new" conventions.

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

16 years agoFix handling of C99 "extern inline" semantics when dealing with
Douglas Gregor [Thu, 23 Apr 2009 18:22:55 +0000 (18:22 +0000)]
Fix handling of C99 "extern inline" semantics when dealing with
multiple declarations of the function. Should fix PR3989 and
<rdar://problem/6818429>.

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

16 years agoHandle corner case where clang-cc is invoked directly to compile preprocessed source...
Devang Patel [Thu, 23 Apr 2009 18:09:16 +0000 (18:09 +0000)]
Handle corner case where clang-cc is invoked directly to compile preprocessed source file without -main-file-name. In this case, CDDebugInfo is not able identify correct main source file becase SM.isFromMainFile() returns true for locations from header files as well as locations from main source file.
This patch takes conservative approach by not emitting more then one compile unit with isMain bit set.

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

16 years agoFix PR 4033: the analyzer shouldn't crash on computed gotos involving symbolic
Ted Kremenek [Thu, 23 Apr 2009 17:49:43 +0000 (17:49 +0000)]
Fix PR 4033: the analyzer shouldn't crash on computed gotos involving symbolic
target addresses.

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

16 years agoRemove @compatibility_alias regression.
Steve Naroff [Thu, 23 Apr 2009 17:46:47 +0000 (17:46 +0000)]
Remove @compatibility_alias regression.

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