Commit Graph

12553 Commits

Author SHA1 Message Date
Devang Patel 93f274c161 Fix file reference for derived and composite types. Now, dwarf writer uses strict verifier that ignores debug info for such types if their file info is unknown.
llvm-svn: 98096
2010-03-09 22:49:11 +00:00
Devang Patel 4f26205ba8 More then one anonymous aggregates on one line creates chaos when MDNode uniquness is combined with RAUW operation. Right solution is to avoid using RAUW.
This fixes PR 6554.

llvm-svn: 98083
2010-03-09 21:32:27 +00:00
Devang Patel f2aa707895 Use getLast() instead of getBasename().
llvm-svn: 98072
2010-03-09 19:14:07 +00:00
Fariborz Jahanian c4813e8d02 Don't error when a block pointer is passed to a
vararg functions/methods. Fixes radar 7725203.

llvm-svn: 98070
2010-03-09 18:34:52 +00:00
Benjamin Kramer bbf5c262ab Replace copy loops with memcpy.
llvm-svn: 98055
2010-03-09 12:53:38 +00:00
Devang Patel 408dcf60aa Start using DIFile. Corresponding llvm patch is r98020.
llvm-svn: 98021
2010-03-09 00:44:50 +00:00
Ted Kremenek 0a4a8326c1 Add preprocessor guards to the definitions of size_t and wchar_t, and #undef NULL before defining it.
This addresses potential issues with system headers reported in <rdar://problem/7727159>.

llvm-svn: 98006
2010-03-08 23:23:45 +00:00
Ted Kremenek 4c9862ca1d Place the definition of 'va_list' within a preprocessor guard. This matches the behavior of GCC, and avoids potential conflicts with system headers (e.g., stdio.h). Fixes <rdar://problem/7727145>.
llvm-svn: 98003
2010-03-08 23:13:05 +00:00
Chris Lattner e18aaf2c4b add a codegen hack to work around an AST bug, allowing us to compile the
code in PR6537.  This should be reverted when the ast bug is fixed.

llvm-svn: 97981
2010-03-08 21:08:07 +00:00
Ted Kremenek c3015a914f Allocate ASTRecordLayout objects using the allocator associated with ASTContext.
This allows them to be allocated using a BumpPtrAllocated
in the common case.

llvm-svn: 97978
2010-03-08 20:56:29 +00:00
Devang Patel d3cbaa1ddf Avoid using DIDescriptor.isNull().
llvm-svn: 97976
2010-03-08 20:53:17 +00:00
Devang Patel 9cf2705a5d Revert r97949.
llvm-svn: 97964
2010-03-08 19:20:58 +00:00
Douglas Gregor 8a16769b61 Improve XML output for C++ classes, from Olaf Krzikalla!
llvm-svn: 97954
2010-03-08 18:51:03 +00:00
Devang Patel 4ce8ebb087 Avoid DIDescriptor.isNull() checks.
llvm-svn: 97949
2010-03-08 18:26:57 +00:00
Douglas Gregor de4827dd34 Extend ObjCMessageExpr for class method sends with the source location
of the class name.

llvm-svn: 97943
2010-03-08 16:40:19 +00:00
Douglas Gregor 12852d9521 Keep track of type source information in the return type of an
Objective-C method declaration, e.g., for 

  - (Foo *)myMethod;

we now have TypeSourceInfo for the Foo*.

llvm-svn: 97942
2010-03-08 14:59:44 +00:00
Duncan Sands 7a9ba76825 Remove unused headers.
llvm-svn: 97941
2010-03-08 11:29:03 +00:00
Douglas Gregor b1489c67f0 Remove redundant semicolon
llvm-svn: 97930
2010-03-08 02:49:35 +00:00
Douglas Gregor 0aad774232 Make a note for the C++0x future, when we'll have to revisit the jump-diagnostics handling for variables without initializers
llvm-svn: 97929
2010-03-08 02:49:08 +00:00
Douglas Gregor 589973b097 In C++98/03, an uninitialized variable that has POD class type will be
uninitialized. This seems not to be the case in C++0x, where we still
call the (trivial) default constructor for a POD class
(!). Previously, we had implemented only the C++0x rules; now we
implement both. Fixes PR6536.

llvm-svn: 97928
2010-03-08 02:45:10 +00:00
Douglas Gregor 104ee00181 Downgrade errors when trying to catch a pointer or reference to
incomplete type to warnings; GCC (and EDG in GCC compatibility mode)
permit such handles. Fixes PR6527.

(For real this time)

llvm-svn: 97927
2010-03-08 01:47:36 +00:00
Douglas Gregor 281c486e1b Robustify callers that rebuild typename type nodes again NULL return
types. Fixes PR6463.

llvm-svn: 97924
2010-03-07 23:26:22 +00:00
Douglas Gregor c934bc840c Perform overload resolution when static_cast'ing from a
pointer-to-member-to-derived to a pointer-to-member-to-base. Fixes
PR6072.

llvm-svn: 97923
2010-03-07 23:24:59 +00:00
Douglas Gregor 1ce52caf0d Reference binding via user-defined conversion can compute a binding
that is not reference-related (because it requires another implicit
conversion to which we can find). Fixes PR6483.

llvm-svn: 97922
2010-03-07 23:17:44 +00:00
Kovarththanan Rajaratnam 39f2fbd129 Undefine correct macro
llvm-svn: 97920
2010-03-07 19:10:13 +00:00
Kovarththanan Rajaratnam 7a67f67823 Don't rely on implicit conversion
llvm-svn: 97916
2010-03-07 11:21:46 +00:00
Kovarththanan Rajaratnam 752a124aeb Rename to addPPCallbacks since we're effectively adding a callback and maybe chaining it to an existing one
llvm-svn: 97913
2010-03-07 07:30:06 +00:00
Kovarththanan Rajaratnam 981a6a110e Don't assert if PP already contains a valid PP callback. The PP can handle multiple callbacks (using PPChainedCallbacks)
llvm-svn: 97910
2010-03-07 07:18:58 +00:00
Eric Christopher 4c70358296 Add sse4.1 packed min and max intrinsics.
llvm-svn: 97907
2010-03-07 07:00:42 +00:00
Eric Christopher 7288890b51 Add load hint instruction intrinsic.
llvm-svn: 97904
2010-03-07 06:29:09 +00:00
Eric Christopher 87990fe5df Add in support for dword multiply and fp dot product intrinsics.
llvm-svn: 97902
2010-03-07 06:17:19 +00:00
Eli Friedman b632e30e41 Fix for PR6294: we should only delay recording nested dynamic classes if they
are lexically nested.  Othewise, we never end up recording semantically nested
classes.

llvm-svn: 97900
2010-03-07 05:49:51 +00:00
Douglas Gregor 577cf97cf3 Don't turn off mangling in implicitly extern "C" system headers. GCC
doesn't do this on any of the major platforms, and we don't really
support any of the platforms that do (nor will we actually handle
those headers well). Fixes PR6217; see PR6530 for details on what we
would need to do to support these platforms.

llvm-svn: 97899
2010-03-07 05:10:40 +00:00
Tanya Lattner 5cb196e14b Fix 80 col violation.
llvm-svn: 97898
2010-03-07 04:47:12 +00:00
Rafael Espindola 08a692aba4 Don't produce debug info when given -g. Fixes PR6529.
llvm-svn: 97897
2010-03-07 04:46:18 +00:00
Tanya Lattner 5cbff48b01 Fix indentation, use string directly instead of StringRef.
llvm-svn: 97896
2010-03-07 04:40:06 +00:00
Tanya Lattner 351e4393f1 Fix some weird patch issue.
llvm-svn: 97894
2010-03-07 04:27:11 +00:00
Tanya Lattner 5029d56cc1 Implement missing-braces warning and add a test case.
llvm-svn: 97893
2010-03-07 04:17:15 +00:00
Chris Lattner 5178f56255 add mblaze target support, patch by Wesley Peck!
llvm-svn: 97890
2010-03-06 21:21:27 +00:00
Chris Lattner 8341c390aa on both the mac and linux, /usr/local/include is treated
as a "C++ Friendly" system header directory.  This fixes
PR6523.

llvm-svn: 97885
2010-03-06 19:38:10 +00:00
Kovarththanan Rajaratnam 1c558cd773 Lowercase for consistency
llvm-svn: 97878
2010-03-06 12:07:48 +00:00
Eric Christopher b0759be4d0 Fix _MM_FROUND_NEARBYINT and move rounding intrinsics to macros.
llvm-svn: 97874
2010-03-06 10:31:44 +00:00
Benjamin Kramer f0a0f68c79 Add a message to these asserts.
llvm-svn: 97873
2010-03-06 09:07:19 +00:00
Rafael Espindola d51c9b9a9f Use static method in GlobalValue
llvm-svn: 97872
2010-03-06 07:35:18 +00:00
Eli Friedman 99d20f83ba PR6515: Implement __builtin_signbit and friends.
I'm reasonably sure my implementation is correct, but it would be nice if
someone could double-check.

llvm-svn: 97864
2010-03-06 02:17:52 +00:00
Fariborz Jahanian af9553a23a Allow use of byref (__block attributed) arrays inside
the block. Fixes radar 7671883.

llvm-svn: 97863
2010-03-06 01:58:53 +00:00
John McCall beec5a080f Implement __builtin_dwarf_sp_column for i386 (Darwin and not), x86-64 (all),
and ARM.  Implement __builtin_init_dwarf_reg_size_table for i386 (both) and
x86-64 (all).

llvm-svn: 97859
2010-03-06 00:35:14 +00:00
Douglas Gregor 6de584c2d2 When declaring a catch block in C++, make sure that the type being
caught can be copy-initialized and destructed. Fixes PR6518.

llvm-svn: 97853
2010-03-05 23:38:39 +00:00
Ted Kremenek a00c5db1a8 Augment __has_feature to report that Clang supports adding attribute 'unused'
to an Objective-C instance variable.

llvm-svn: 97850
2010-03-05 22:43:32 +00:00
Fariborz Jahanian d2bccafe82 Patch to build qualifier on objective-c
pointer types. Fixes radar 7626768.

llvm-svn: 97847
2010-03-05 22:42:55 +00:00
Douglas Gregor 7829362620 The Windows build is just too weird; there's no real cost to doing the concurrency checks for ASTUnit in all builds
llvm-svn: 97840
2010-03-05 22:19:41 +00:00
Douglas Gregor 1e1973c0eb Switch from NDEBUG to _DEBUG, since our Windows build is funny
llvm-svn: 97835
2010-03-05 21:48:53 +00:00
Douglas Gregor 0c7c2f8b4d A little hack to identify unwanted concurrency in CIndex
llvm-svn: 97831
2010-03-05 21:16:25 +00:00
Kovarththanan Rajaratnam 3c36a6669a Use clang::io::Emit8
llvm-svn: 97810
2010-03-05 15:40:54 +00:00
Benjamin Kramer d4870700ad Make sure the raw_string_ostream gets flushed so we don't accidentally return an empty string.
llvm-svn: 97809
2010-03-05 15:39:20 +00:00
Zhongxing Xu e73584384a Remove reference to AnalysisContext in Environment. We already have LocationContext
information in ExplodedNode.

llvm-svn: 97785
2010-03-05 04:45:36 +00:00
Blaine Garst f27ab71d9f add support for a 1<<29 bit in the block flags field to mark blocks using alternate struct return ABI
llvm-svn: 97775
2010-03-05 01:29:59 +00:00
Rafael Espindola 4c489c7030 Don't produce an alias for a destructor if the target is weak.
This fixes bootstrap on ELF systems :-)

llvm-svn: 97773
2010-03-05 01:21:10 +00:00
Douglas Gregor 90d4717767 When we invalidate a declaration, make it public, so that it doesn't
trigger access control or one of the many assertions we have for valid
access specifiers.

llvm-svn: 97767
2010-03-05 00:26:45 +00:00
Fariborz Jahanian 535c9c0ba2 Patch to get around a rewriter bug rewriting storage class
on a block API struct definition.

llvm-svn: 97754
2010-03-04 21:35:37 +00:00
Rafael Espindola bef98689ad really fix 6473 by handling weakref in constant expressions.
llvm-svn: 97750
2010-03-04 21:26:03 +00:00
Chris Lattner 09797543bd add TCE target support, patch by Pekka J!
llvm-svn: 97746
2010-03-04 21:07:38 +00:00
Fariborz Jahanian 8bb35c4d7c Fixes a bug whereby static const block var has static
moved incorrectly. (radar 7714443).

llvm-svn: 97734
2010-03-04 18:54:29 +00:00
Rafael Espindola 2e42fec3a0 Fix PR6473.
Clang's support for weakref is now better than llvm-gcc's :-)

We don't introduce a new symbol and we correctly mark undefined references weak only if there is no
definition or regular undefined references in the same file.

llvm-svn: 97733
2010-03-04 18:17:24 +00:00
Zhongxing Xu 5cb8d9d40f When profiling Environment, also profile with AnalysisContext*, bacause
we now may have identical states with different analysis context.

Set the right AnalysisContext in state when entering and leaving a callee.

With both of the above changes, we can pass the test case.

llvm-svn: 97724
2010-03-04 09:04:52 +00:00
John McCall 731be6620c Revert changes r97693, r97700, and r97718.
Our testing framework can't deal with disabled targets yet.

llvm-svn: 97719
2010-03-04 04:29:44 +00:00
Eric Christopher 94567c04bb First start on smmintrin.h, rounding and blending.
llvm-svn: 97717
2010-03-04 02:56:19 +00:00
Eric Christopher cfeceffa27 Add in disabled case as well.
llvm-svn: 97716
2010-03-04 02:31:44 +00:00
Eric Christopher 399ffa55d2 Add in -msse4.1 and -msse4.2 options and continuing a rather
hacky solution for translating.  Expanded on comment explaining
the hack a bit.

llvm-svn: 97714
2010-03-04 02:26:37 +00:00
Fariborz Jahanian 9eba9dfb0c Refactor local class name mangling and make it
ABI conforming.

llvm-svn: 97702
2010-03-04 01:02:03 +00:00
John McCall 81d4d12504 Implement __builtin_dwarf_sp_column().
llvm-svn: 97700
2010-03-04 00:44:01 +00:00
John McCall 6abe39c61e Create a TargetMachine whenever we create a CodeGenAction. The codegen of
some builtins will rely on target knowledge.

llvm-svn: 97693
2010-03-04 00:23:29 +00:00
Douglas Gregor cc3f325fa6 Reinstate r97674 with a fix for the assertion that was firing in <list>
llvm-svn: 97686
2010-03-03 23:55:11 +00:00
Eric Christopher 6197c1cd8c Remove the linux c includes part of my last patch.
llvm-svn: 97679
2010-03-03 23:27:49 +00:00
Douglas Gregor 979302e14a Revert r97674; it's causing failures
llvm-svn: 97677
2010-03-03 23:26:56 +00:00
Douglas Gregor f2a42a66e2 Implement disambiguation of base class members via a
nested-name-specifier. For example, this allows member access in
diamond-shaped hierarchies like:

  struct Base {
    void Foo();
    int Member;
  };

  struct D1 : public Base {};
  struct D2 : public Base {};

  struct Derived : public D1, public D2 { }

  void Test(Derived d) {
    d.Member = 17; // error: ambiguous cast from Derived to Base
    d.D1::Member = 17; // error: okay, modify D1's Base's Member
  }

Fixes PR5820 and <rdar://problem/7535045>. Also, eliminate some
redundancy between Sema::PerformObjectMemberConversion() and
Sema::PerformObjectArgumentInitialization() -- the latter now calls
the former.

llvm-svn: 97674
2010-03-03 22:53:40 +00:00
Fariborz Jahanian 281aae6328 Fix code gen bug generating code for
((id)cat)->isa. Fixes radar 7709015.

llvm-svn: 97672
2010-03-03 22:09:47 +00:00
Chris Lattner 576def7fbe fix PR6475, we were doing side-effecting stuff in an assert.
llvm-svn: 97669
2010-03-03 21:52:23 +00:00
Eric Christopher 114a85381a Add in more c++ header paths for later gccs under gentoo linux.
Add in c header path for various linuxes as well.

Partial patch from Christian Adåker!

llvm-svn: 97666
2010-03-03 21:41:50 +00:00
Fariborz Jahanian a529c25555 Implements mangling of local class names to
fix a code gen crash. This is WIP as not
all ABI cases are covered (there is a FIXME to 
this effect). Fixes radar 7696748.

llvm-svn: 97658
2010-03-03 19:41:08 +00:00
Chris Lattner 5cc15e058b add framework for ARM builtins, Patch by Edmund Grimley Evans!
llvm-svn: 97656
2010-03-03 19:03:45 +00:00
Benjamin Kramer a3b13411fa Simplify code a bit and remove unneeded semicolons.
llvm-svn: 97654
2010-03-03 16:28:47 +00:00
John McCall 515c3c548c Sketch out an implementation for __builtin_dwarf_cfa. I have no idea
why the front-end is calculating the argument to llvm.eh.dwarf.cfa().

llvm-svn: 97653
2010-03-03 10:30:05 +00:00
John McCall 66769f8544 Implement __builtin_eh_return.
llvm-svn: 97643
2010-03-03 05:38:58 +00:00
Anders Carlsson 5b0057c05b Fix a bug with base offset merging that Devang noticed.
llvm-svn: 97641
2010-03-03 04:58:02 +00:00
Douglas Gregor 3e637467d7 Implement name hiding for names found through virtual base subobjects
that are hidden by other derived base subobjects reached along a
lookup path that does *not* pass through the hiding subobject (C++
[class.member.lookup]p6). Fixes PR6462.

llvm-svn: 97640
2010-03-03 04:38:46 +00:00
John McCall d4f4b7f5ee Add proper target hooks for __builtin_extract_return_address and
__builtin_frob_return_address.  The implementations for both are
still trivial in the default case.

llvm-svn: 97638
2010-03-03 04:15:11 +00:00
John McCall 1950a11939 Don't emit derived-to-base destructor aliases if we don't have a definition
for the base destructor, because aliases to declarations aren't legal.

Fixes PR 6471.

llvm-svn: 97637
2010-03-03 03:40:11 +00:00
Douglas Gregor 0555f7eefa Refactor CXXRecordDecl::lookupInBases() to push the recursion down a
level. No functionality change, and it obeys access control this
time.

llvm-svn: 97634
2010-03-03 02:18:00 +00:00
Ted Kremenek c9ef64ff67 Use SVN_REVISION, not SVN_VERSION.
llvm-svn: 97625
2010-03-03 01:30:39 +00:00
Ted Kremenek 0f0883b918 Fix an algorithmic bug in LiveVariables pointed out by Zhongxing.
If an initializer in a DeclStmt references the declared variable, that
extends the liveness of that variable.

llvm-svn: 97624
2010-03-03 01:17:41 +00:00
Douglas Gregor 77709906a4 Revert r97618. Access control sucks
llvm-svn: 97621
2010-03-03 01:13:25 +00:00
Ted Kremenek 47307292f1 Make getClangRevision() check that SVN_VERSION is an empty string
(even if it is defined).  This fixes the issue of this function
returning '0' when SVN_VERSION is defined to be "".

Fixes: <rdar://problem/7663667>
llvm-svn: 97620
2010-03-03 01:02:48 +00:00
Douglas Gregor a62a5237fc Factor out the recursive lookup into C++ base classes into a separate,
static function. No functionality change.

llvm-svn: 97618
2010-03-03 01:02:31 +00:00
Douglas Gregor 832940b321 Eliminate the static map of overridden C++ methods, which was going to
come back to bite us at some point. 

llvm-svn: 97607
2010-03-02 23:58:15 +00:00
John McCall 6b21eb5c59 Suppress implicit member redeclarations arising from explicit instantiation
declarations after the member has been explicitly specialized.  We already
did this after explicit instantiation definitions;  not doing it for
declarations meant that subsequent definitions would see a previous
member declaration with specialization kind "explicit instantiation decl",
which would then happily get overridden.

Fixes PR 6458.

llvm-svn: 97605
2010-03-02 23:09:38 +00:00
Ted Kremenek 5d2bb1b9b3 [CFG]
After discussion with Zhongxing, don't force the initializer of DeclStmts to be
block-level expressions.

This led to some interesting fallout:

[UninitializedValues]

Always visit the initializer of DeclStmts (do not assume they are block-level expressions).

[BasicStore]

With initializers of DeclStmts no longer block-level expressions, this causes self-referencing initializers (e.g. 'int x = x') to no longer cause the initialized variable to be live before the DeclStmt.  While this is correct, it caused BasicStore::RemoveDeadBindings() to prune off the values of these variables from the initial store (where they are set to uninitialized).  The fix is to back-port some (and only some) of the lazy-binding logic from RegionStore to
BasicStore.  Now the default values of local variables are determined lazily as opposed
to explicitly initialized.

llvm-svn: 97591
2010-03-02 21:43:54 +00:00
Ted Kremenek c3c1b10243 Don't conjure a symbol for DeclStmts when the variable is a C++ reference.
llvm-svn: 97590
2010-03-02 21:43:52 +00:00
Rafael Espindola 70e040d552 During codegen assert that any copy assignment, destructor or constructor that
we need to synthesize has been marked as used by Sema.

Change Sema to avoid these asserts.

llvm-svn: 97589
2010-03-02 21:28:26 +00:00
Douglas Gregor dc70c3abc0 Diagnose the declaration of enum templates. Also, be a bit more
careful about value-dependent enumerators. Fixes PR5786.

llvm-svn: 97570
2010-03-02 17:53:14 +00:00
Kovarththanan Rajaratnam daca645655 Move Emit24 to clang::io
llvm-svn: 97569
2010-03-02 17:41:26 +00:00
Douglas Gregor 9bc6b7fc53 Use CXXTemporaryObjectExpr for explicitly-constructed temporaries. We
used to do this, but it got lost when we switched functional-style
cast syntax over to using the new initialization code. Fixes PR6457.

llvm-svn: 97568
2010-03-02 17:18:33 +00:00
Zhongxing Xu d497e126cb Register all parameters even if they didn't occur in the function body.
We may query their liveness because they are added to store when passing
argument values.

llvm-svn: 97562
2010-03-02 10:08:30 +00:00
Douglas Gregor b30f22b911 Unify initializer-instantiation code for variable declarations and
base/member initializers.

llvm-svn: 97560
2010-03-02 07:38:39 +00:00
Anders Carlsson 93b1b49082 Simplify code.
llvm-svn: 97551
2010-03-02 05:40:45 +00:00
John McCall b6cc2c0439 Inspired by seeing "MIPS" go by in the commits, I've gone ahead and
implemented a (codegen) target hook for __builtin_extend_pointer.
I'm also making it return a uint64_t instead of an unsigned word;  this
comports with typical usage (i.e. the one use I know of).

I don't know if any of the existing targets requires this hook to be
set (other than x86 and x86_64, which I know do not).

llvm-svn: 97547
2010-03-02 03:50:12 +00:00
Anders Carlsson 6f1f002651 Rename BaseOffset to Offset and make it signed in preparation of more construction vtable work.
llvm-svn: 97546
2010-03-02 03:44:06 +00:00
Eric Christopher 0b26a616eb Add in some more MIPS command line options.
Patch by Oleksandr Tymoshenko!

llvm-svn: 97544
2010-03-02 02:41:08 +00:00
John McCall 4b613fae35 After much consultation aimed at figuring out what this builtin actually
does, document the results and then implement __builtin_extend_pointer for
platforms where it's a no-op.

llvm-svn: 97540
2010-03-02 02:31:24 +00:00
Douglas Gregor 1d85d2903b Fix an amusing typo that completely the re-introduction of parameters
for the purposes of parsing default arguments. In effect, we would
re-introduce the parameter with a default argument N times (where N is
the number of parameters preceding the parameter with a default
argument). This showed up when a defaulted parameter of a member
function of a local class shadowed a parameter of the enclosing
function. Fixes PR6383.

llvm-svn: 97534
2010-03-02 01:29:43 +00:00
Fariborz Jahanian db217c4bad Cast a pointer to 'long long' to satisfy all compilation models.
Satisfies radar 7703202.

llvm-svn: 97532
2010-03-02 01:19:04 +00:00
Douglas Gregor 53db22c7aa Add comment
llvm-svn: 97528
2010-03-02 00:25:00 +00:00
Douglas Gregor d29f2799b7 When we're parsing template names as part of base-specifiers, we are
*not* entering the context of the nested-name-specifier. This was
causing us to look into an uninstantiated template that we shouldn't
look into. Fixes PR6376.

llvm-svn: 97524
2010-03-01 23:49:23 +00:00
John McCall bd8d9bd39c Split out types that are non-canonical unless dependent as their own
category.  Use this in a few places to eliminate unnecessary TST cases and
do some future-proofing.  Provide terrible manglings for typeof.  Mangle
decltype with some hope of accuracy.

Our manglings for some of the cases covered in the testcase are different
from gcc's, which I've raised as an issue with the ABI list.

llvm-svn: 97523
2010-03-01 23:49:17 +00:00
Fariborz Jahanian f4609d431f More rewriter of nested blocks fun stuff.
Radar 7696893.

llvm-svn: 97520
2010-03-01 23:36:21 +00:00
Douglas Gregor ea99b5d736 Unbreak the build
llvm-svn: 97519
2010-03-01 23:31:19 +00:00
Douglas Gregor 9a28e84b32 Keep an explicit stack of function and block scopes, each element of
which has the label map, switch statement stack, etc. Previously, we
had a single set of maps in Sema (for the function) along with a stack
of block scopes. However, this lead to funky behavior with nested
functions, e.g., in the member functions of local classes.

The explicit-stack approach is far cleaner, and we retain a 1-element
cache so that we're not malloc/free'ing every time we enter a
function. Fixes PR6382.

Also, tweaked the unused-variable warning suppression logic to look at
errors within a given Scope rather than within a given function. The
prior code wasn't looking at the right number-of-errors count when
dealing with blocks, since the block's count would be deallocated
before we got to ActOnPopScope. This approach works with nested
blocks/functions, and gives tighter error recovery.

llvm-svn: 97518
2010-03-01 23:15:13 +00:00
Chandler Carruth a419dbb5ea Fix the lookup of names used in a friend declaration to not attempt to
re-declare them. This fixes PR6317. Also add the beginnings of an interesting
test case for p1 of [class.friend] which also covers PR6317.

llvm-svn: 97499
2010-03-01 21:17:36 +00:00
Chris Lattner efc83e60d3 fix PR5933: don't warn about unused variables if a function has other errors in it.
llvm-svn: 97498
2010-03-01 21:06:03 +00:00
Chris Lattner 30d0cfda35 Implement jump checking for initialized c++ variables, implementing
a fixme and PR6451.

Only perform jump checking if the containing function has no errors,
and add the infrastructure needed to do this.

On the testcase in the PR, we produce:

t.cc:6:3: error: illegal goto into protected scope
  goto later;
  ^
t.cc:7:5: note: jump bypasses variable initialization
  X x;
    ^

llvm-svn: 97497
2010-03-01 20:59:53 +00:00
Douglas Gregor 4f13beb8b6 Start detangling the BlockSemaInfo/Sema mess. No functionality change.
llvm-svn: 97494
2010-03-01 20:44:28 +00:00
Ted Kremenek 80263e5905 Allow a '0' precision in format strings (as the man page says it is okay).
Fixes <rdar://problem/7700339>.

llvm-svn: 97482
2010-03-01 19:22:33 +00:00
John McCall de9607bc6f The latest draft uses 'dt' to mangle member expressions, and now so do we.
llvm-svn: 97479
2010-03-01 19:12:25 +00:00
Douglas Gregor 79e31db9a9 When looking for a redeclaration of a static variable, only look for redeclarations. Fixes PR6449
llvm-svn: 97478
2010-03-01 19:11:54 +00:00
Douglas Gregor aff9c1a033 When instantiating a function-scoped enum, make sure that it and its
enumeration constants get placed into the local instantiation hash
table. Fixes PR6375.

llvm-svn: 97471
2010-03-01 19:00:07 +00:00
Douglas Gregor 604c30299d Robustify instantiation of templates when there are errors in the
template definition. Do this both by being more tolerant of errors in
our asserts and by not dropping a variable declaration completely when
its initializer is ill-formed. Fixes the crash-on-invalid in PR6375,
but not the original issue.

llvm-svn: 97463
2010-03-01 18:27:54 +00:00
John McCall 8bc2a70dfe Don't infinite-loop if TryAnnotateCXXScopeToken fails to annotate but doesn't
signal an error.  This can happen even when the current token is '::' if
this is a ::new or ::delete expression.

This was an oversight in my recent parser refactor;  fixes PR 5825.

llvm-svn: 97462
2010-03-01 18:20:46 +00:00
Douglas Gregor 2528936379 Finish pushing source-location information though TreeTransform's
TransformDefinition.

llvm-svn: 97445
2010-03-01 17:25:41 +00:00
Douglas Gregor a04f2ca19a When looking for the instantiated declaration that corresponds to a
given declaration in a template, make sure that the context we're
searching through is complete. Fixes PR6376.

llvm-svn: 97444
2010-03-01 15:56:25 +00:00
Zhongxing Xu 6d3cc382df Since now we store the cast type with an ElementRegion, there is
no need to store a type with SymbolRegionValue.

llvm-svn: 97437
2010-03-01 06:56:52 +00:00
Zhongxing Xu b0e5c27113 Assert when loading from a code text region instead of returning an unknown silently.
llvm-svn: 97436
2010-03-01 05:29:02 +00:00
Douglas Gregor a070ffa7b8 Don't warn about case-value conversions from a negative value to a
larger unsigned value, since this is implementation-defined
behavior. (We previously suppressed this warning when converting from
a signed value to an unsigned value of the same size).

llvm-svn: 97430
2010-03-01 01:04:55 +00:00
Douglas Gregor a51c67424e Improve name mangling for dependently-scoped declaration references.
llvm-svn: 97422
2010-02-28 22:05:49 +00:00
Douglas Gregor 5610db6923 Add name mangling for DeclRefExprs that refer to external names
llvm-svn: 97418
2010-02-28 21:40:32 +00:00
Anders Carlsson 5b79c31471 Remove debug output.
llvm-svn: 97407
2010-02-28 18:39:30 +00:00
Anders Carlsson 7162ab947b Handle unused functions in construction vtables correctly.
llvm-svn: 97406
2010-02-28 18:37:33 +00:00
Chris Lattner 73a9c7d891 pull some altivec stuff out of line.
llvm-svn: 97405
2010-02-28 18:33:55 +00:00
Douglas Gregor e489a7d3d3 Warn about the deprecated string literal -> char* conversion. Fixes PR6428.
llvm-svn: 97404
2010-02-28 18:30:25 +00:00
Chris Lattner fd48afe412 Implement PR6423 by using one token of lookahead to disambiguate
an *almost* always incorrect case.  This only does the lookahead
in the insanely unlikely case, so it shouldn't impact performance.

On this testcase:

struct foo {
}
typedef int x;

Before:

t.c:3:9: error: cannot combine with previous 'struct' declaration specifier
typedef int x;
        ^

After:

t.c:2:2: error: expected ';' after struct
}
 ^
 ;

llvm-svn: 97403
2010-02-28 18:18:36 +00:00
Anders Carlsson 8b37bb7c48 When laying out vtables for virtual bases in construction vtables, we need to check if the vtable is a primary base in the layout class.
llvm-svn: 97402
2010-02-28 18:08:38 +00:00
John McCall 1629149103 Support constant-evaluation of __builtin_nans* as well as the correct constant
evaluation of __builtin_nan*.  Most of the work to make this work is in LLVM.

Fixes <rdar://problem/7696712> and part of PR 5255.

llvm-svn: 97383
2010-02-28 13:00:19 +00:00
Zhongxing Xu 7ba9e99015 Use getBody() to get the function definition when the decl referenced is not
definition.

llvm-svn: 97373
2010-02-28 06:39:11 +00:00
Anders Carlsson e3385f566b More improvements to construction vtables; we know handle vbase offsets correctly (I hope).
llvm-svn: 97361
2010-02-28 01:43:58 +00:00
Dan Gohman 357421ea12 Opt into the Verifier now that it's an opt-in feature of
addPassesToEmitFile.

llvm-svn: 97358
2010-02-28 00:55:40 +00:00
Anders Carlsson 62c6c72bab Pass information about whether a base is virtual or not down to getCtorVtable, we need this information in the vtable builder.
llvm-svn: 97356
2010-02-28 00:36:23 +00:00
Anders Carlsson 31f595f5ef Add new function.
llvm-svn: 97353
2010-02-28 00:10:58 +00:00
Anders Carlsson f98b47d3b9 Fix to dumpLayout; we want to be able to dump address points even if the vtable doesn't have any methods.
llvm-svn: 97350
2010-02-27 23:58:01 +00:00
Nick Lewycky 48f74d2c9a Debian sid moved these headers into /4.4 and left /4.4.3 as a symlink. Update.
Also, add support for 32-bit x86 Debian sid.

llvm-svn: 97347
2010-02-27 22:35:43 +00:00
Anders Carlsson c3f92a16f2 Add a simple construction vtable test.
llvm-svn: 97344
2010-02-27 21:09:00 +00:00
Anders Carlsson 9391375d95 Start fleshing out construction vtable support.
llvm-svn: 97342
2010-02-27 20:39:05 +00:00
Anders Carlsson 603d7d1910 Enable the new vtable layout code for vtables that aren't construction vtables. (This doesn't mean that we emit LLVM IR using it yet, it just means that it's running and hopefully not crashing or asserting).
llvm-svn: 97341
2010-02-27 20:02:53 +00:00
Anders Carlsson 9f19aaaa3a Move ComputeThisAdjustmentBaseOffset to VtableBuilder.
llvm-svn: 97340
2010-02-27 19:57:44 +00:00
Anders Carlsson b26c2abac7 Make sure to insert the primary base in the set :)
llvm-svn: 97339
2010-02-27 19:51:04 +00:00
Anders Carlsson e02a926a1c Use the real base offset when calculating vbase offsets.
llvm-svn: 97338
2010-02-27 19:21:58 +00:00
Anders Carlsson 4d0729a7cc Figured out why the test was failing, this will hopefully fix it.
llvm-svn: 97336
2010-02-27 19:00:53 +00:00
Anders Carlsson 2b381bbb5c Don't add this adjustments for pure virtual member functions.
llvm-svn: 97334
2010-02-27 18:16:50 +00:00
Anders Carlsson 01d3c7da60 We want to store method info for unused functions.
llvm-svn: 97333
2010-02-27 18:09:40 +00:00
Benjamin Kramer 718f722271 Revert 97324. Chris says this cleanup could hurt -E performance.
llvm-svn: 97331
2010-02-27 18:02:51 +00:00
Benjamin Kramer a197fb6731 Move method out-of-line. I thought this would be a candidate for inlining but I was wrong.
llvm-svn: 97330
2010-02-27 17:05:45 +00:00
Anders Carlsson 4068798cbc Finish up the changes to this adjustments.
llvm-svn: 97328
2010-02-27 16:52:49 +00:00
Benjamin Kramer 53fa347ee6 Another trivial getSpelling simplification.
llvm-svn: 97327
2010-02-27 16:29:36 +00:00
Anders Carlsson d46ed89d79 Stub out more of the 'this' pointer adjustment fixes I've been planning. Start using a set vector for primary bases so they will be ordered.
llvm-svn: 97326
2010-02-27 16:18:19 +00:00
Benjamin Kramer b14e0b637a Simplify code.
llvm-svn: 97324
2010-02-27 14:22:08 +00:00
Benjamin Kramer 0a1abd4088 Add an overload of Preprocessor::getSpelling which takes a SmallVector and
returns a StringRef. Use it to simplify some repetitive code.

llvm-svn: 97322
2010-02-27 13:44:12 +00:00
Ted Kremenek 09597b461d Fix crasher caused by setting a bit in a possibly empty bitvector while
doing printf format string checking.  This is a recent regression.

llvm-svn: 97318
2010-02-27 08:34:51 +00:00
Anders Carlsson d2025417ef Fix another vtable layout bug; we weren't looking hard enough for overriden functions when determining if an overrider will ever be used.
llvm-svn: 97306
2010-02-27 06:38:03 +00:00
Anders Carlsson d69b2f93ea Handle vcall offset sharing between destructors.
llvm-svn: 97304
2010-02-27 04:12:52 +00:00
Anders Carlsson b08aaa3e10 Fix a bug where we were generating an unnecessary vtable for a virtual base that's already a primary virtual base.
llvm-svn: 97303
2010-02-27 04:05:52 +00:00
Douglas Gregor b8b9f28e24 Robustify SourceManager::getLocation(), so that it returns an
end-of-line source location when given a column number beyond the
length of the line, or an end-of-file source location when given a
line number beyond the length of the file. Previously, we would return
an invalid location.

llvm-svn: 97299
2010-02-27 02:42:25 +00:00
Ted Kremenek d166819c26 For printf format string checking, add support for positional format strings.
Along the way, coelesce some of the diagnostics.

llvm-svn: 97297
2010-02-27 01:41:03 +00:00
Douglas Gregor 89a56c561f When given unsaved files in clang_createTranslationUnitFromSourceFile,
copy the source buffers provided rather than referencing them
directly, so that the caller can free those buffers immediately after
calling clang_createTranslationUnitFromSourceFile(). Otherwise, we
risk hitting those buffers later (when building source ranges, forming
diagnostics, etc.). 

llvm-svn: 97296
2010-02-27 01:32:48 +00:00
Douglas Gregor beab56e923 Skip dependent virtual base classes; fixes PR6413.
llvm-svn: 97291
2010-02-27 00:25:28 +00:00
John McCall 62abc944d6 At sabre's request, drop the FP bounds diagnostics down to warnings and file
them under -Wbad-literal.  They're still on by default.

llvm-svn: 97284
2010-02-26 23:35:57 +00:00
Fariborz Jahanian 6005bd821c Prevent rewriter crash when variable type is missing.
Fixes radar 7692183.

llvm-svn: 97281
2010-02-26 22:49:11 +00:00
Fariborz Jahanian be730c9e34 Minor cleanup of the rewriter.
llvm-svn: 97280
2010-02-26 22:36:30 +00:00
Fariborz Jahanian 9bbc148e16 Removed some unused code in rewriter.
llvm-svn: 97274
2010-02-26 21:46:27 +00:00
John McCall 43c6ffbeec Sundry fixes to the new vtable builder.
llvm-svn: 97258
2010-02-26 20:22:44 +00:00
Fariborz Jahanian ce2ea59d2c Fix rewriting of byref variables in nested blocks.
Fixes radar 7692350.

llvm-svn: 97254
2010-02-26 19:55:31 +00:00
Chris Lattner 9c56ec86b2 fix rdar://7683173, rejecting an invalid conditional
llvm-svn: 97253
2010-02-26 19:42:53 +00:00
Ted Kremenek 4a49d9818b For printf format string checking, move the tracking of the data argument index out of
Sema and into analyze_printf::ParseFormatString().  Also use a bitvector to determine
what arguments have been covered (instead of just checking to see if the last argument consumed is the max argument).  This is prep. for support positional arguments (an IEEE extension).

llvm-svn: 97248
2010-02-26 19:18:41 +00:00
Fariborz Jahanian 5743d4d280 Rewriting of imported variable from outer
blocks's argument in the inner block requires special treatment.
Fixes radar 7692419.

llvm-svn: 97244
2010-02-26 19:05:20 +00:00
Zhongxing Xu 5c07584f44 Use a GDM to record the returned expression in the state when VisitReturnStmt.
Use this information to find the returned value and bind it to CallExpr in
ProcessCallExit.
And there is no need to remove dead bindings in ProcessCallExit, because
a. it would clean up the return value bound to CallExpr
b. we still would do it in the next ProcessStmt(), where we would not misclean
   up the return value.

llvm-svn: 97225
2010-02-26 15:43:34 +00:00
John McCall 1f476a1783 Fix an assertion-on-error during tentative constructor parsing by
propagating error conditions out of the various annotate-me-a-snowflake
routines.  Generally (but not universally) removes redundant diagnostics
as well as, you know, not crashing on bad code.  On the other hand,
I have just signed myself up to fix fiddly parser errors for the next
week.  Again.

llvm-svn: 97221
2010-02-26 08:45:28 +00:00
Douglas Gregor c854c66557 An explicit specialization is allowed following an explicit
instantiation so long as that explicit specialization was declared
previously. Fixes PR6160.

llvm-svn: 97210
2010-02-26 06:03:23 +00:00
Douglas Gregor 6642ca217e Implement semantic analysis for C++ [expr.new]p18-20, which describe
how we find the operator delete that matches withe operator new we
found in a C++ new-expression.

This will also need CodeGen support. On a happy note, we're now a
"nans" away from building tramp3d-v4.

llvm-svn: 97209
2010-02-26 05:06:18 +00:00
Zhongxing Xu d041bc6ff4 Remove derelict GRStmtNodeBuilder::LastNode.
llvm-svn: 97207
2010-02-26 02:38:09 +00:00
Fariborz Jahanian ec201dc3c6 Support rewriting of property synthesis with retain/copy
attributes. Fixes radar 7214439.

llvm-svn: 97203
2010-02-26 01:42:20 +00:00
Douglas Gregor e6d276a559 Commit Eli's fix for implicit conversions to array type. Fixes PR6264.
llvm-svn: 97202
2010-02-26 01:17:27 +00:00
David Chisnall 36c6320d78 Don't generate method metadata for @dynamic properties. Fixes PR6354.
llvm-svn: 97199
2010-02-26 01:11:38 +00:00
John McCall 2da83a3a38 Use the power of types to track down another canonicalization bug in
the ABI-computation interface.  Fixes <rdar://problem/7691046>.

llvm-svn: 97197
2010-02-26 00:48:12 +00:00
Douglas Gregor d2d9da08f3 Make sure to mark constructors, operator new, and operator delete as
used when we instantiate C++ new expressions, delete expressions, and
object-construction expressions. Fixes PR6424, although we can't test
all of it until we finish implementing lookup of "operator delete" for
new expressions (!).

llvm-svn: 97195
2010-02-26 00:38:10 +00:00
Douglas Gregor de550355c1 When we decide to re-use an existing CXXConstructExpr node, make sure
to mark the constructor as referenced. Fixes the narrow issue reported
in PR6424, but there are a few other places that I'll fix before
closing out that PR.

llvm-svn: 97185
2010-02-26 00:01:57 +00:00
Douglas Gregor 6f5f642ca2 When computing the composite pointer type for relational comparisons,
equality comparisons, and conditional operators, produce a composite
pointer type with the appropriate additional "const" qualifiers if the
pointer types would otherwise be incompatible. This is a small
extension (also present in GCC and EDG in a slightly different form)
that permits code like:

  void** i; void const** j; 
  i == j; 

with the following extwarn:

t.cpp:5:5: warning: comparison of distinct pointer types ('void **' and
      'void const **') uses non-standard composite pointer type
      'void const *const *' [-pedantic]
  i == j; 
  ~ ^  ~

Fixes PR6346, and I'll be filing a core issue about this with the C++
committee.

llvm-svn: 97177
2010-02-25 22:29:57 +00:00
Anders Carlsson 9e3b3a3bbe Improve vcall offset handling.
llvm-svn: 97174
2010-02-25 22:23:13 +00:00
Anders Carlsson ed7d0e8be8 Fux a bug where we were trying to add overriders for non-virtual bases of virtual bases more than once.
llvm-svn: 97173
2010-02-25 22:18:35 +00:00
Daniel Dunbar e8ecf9a0db Move ~CodeGenAction out-of-line.
llvm-svn: 97166
2010-02-25 20:37:44 +00:00
Douglas Gregor a2fbc94458 Restore Zhongxing's commits r97122 r97127 r97129 r97131 which were reverted due to a Clang-on-Clang failure
llvm-svn: 97162
2010-02-25 19:01:53 +00:00
Douglas Gregor 83af86a6bc Allow us to compare derived-to-base conversions between a reference
binding and a copy-construction. Fixes an overloading problem in the
Clang-on-Clang build.

llvm-svn: 97161
2010-02-25 19:01:05 +00:00
Fariborz Jahanian 8e3b9db27f Forgot to include nested protocols in collection, resulting in
bogus warning. Fixes radar 7682116.

llvm-svn: 97157
2010-02-25 18:24:33 +00:00
Douglas Gregor 422f155ca3 Don't try to finalize an ill-formed variable or one whose class type is ill-formed. Fixes PR6421
llvm-svn: 97152
2010-02-25 18:11:54 +00:00
Jakob Stoklund Olesen 5a8f9acaa8 Revert patches r97122 r97127 r97129 r97131.
They were breaking clang-x86_64-darwin10-selfhost

llvm-svn: 97138
2010-02-25 15:47:53 +00:00
Gabor Greif 5c07926d44 Add "template" keyword at strategic position to fix
compilation using g++ v3.4.

I'll watch the buildbots and back out if necessary.
Feel free to do the same if something breaks.

Without this patch I get (on g++ 3.4.6) following error:

In file included from clang/lib/Sema/SemaTemplate.cpp:14:
clang/lib/Sema/TreeTransform.h: In member function `clang::ASTOwningResult<&clang::ActionBase::DeleteExpr> clang::TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(clang::ASTOwningResult<&clang::ActionBase::DeleteExpr>, clang::SourceLocation, bool, clang::NestedNameSpecifier*, clang::SourceRange, clang::TypeSourceInfo*, clang::SourceLocation, clang::SourceLocation, clang::PseudoDestructorTypeStorage)':
clang/lib/Sema/TreeTransform.h:5784: error: expected primary-expression before '>' token
clang/lib/Sema/TreeTransform.h:5784: error: expected primary-expression before ')' token
make[4]: *** [clang/lib/Sema/Release/SemaTemplate.o] Error 1

llvm-svn: 97136
2010-02-25 13:04:33 +00:00
John McCall 21b57fa4e5 When comparing two method overload candidates during overload diagnostics,
skip the object argument conversion if either of the candidates didn't
initialize it.

Fixes PR6421, which is such a very straightforward extension of PR6398 that I
should have worked it into the last test case (and therefore caught it then).
Ah well.

llvm-svn: 97135
2010-02-25 10:46:05 +00:00
Chandler Carruth b306bcc266 Fix a really trivial crasher and begin fleshing out one of the namespace test
cases.

llvm-svn: 97134
2010-02-25 09:32:59 +00:00
Zhongxing Xu ee29cc3b66 Move the GenerateCallExitNode logic completely into GREndPathNodeBuilder.
llvm-svn: 97131
2010-02-25 07:57:35 +00:00
Zhongxing Xu 9516feac36 Move the dead bindings removal logic from CallInliner to GRExprEngine::ProcessCallExit().
llvm-svn: 97129
2010-02-25 07:36:34 +00:00
Chandler Carruth 8fa1e7eec4 Add a new conversion rank to classify conversions between complex and scalar
types. Rank these conversions below other conversions. This allows overload
resolution when the only distinction is between a complex and scalar type. It
also brings the complex overload resolutin in line with GCC's.

llvm-svn: 97128
2010-02-25 07:20:54 +00:00
Zhongxing Xu 2fa52b06d0 Add comments.
llvm-svn: 97127
2010-02-25 07:03:08 +00:00
Zhongxing Xu 14863610f9 Call inliner improvements:
This patch implements the CallEnter/CallExit idea of Ted.

Add two interfaces to GRSubEngine: ProcessCallEnter, ProcessCallExit.

The CallEnter program point uses caller's location context. The
CallExit program point uses callee's location context.

CallEnter is built by GRStmtNodeBuilder. CallExit is built by
GREndPathNodeBuilder.

llvm-svn: 97122
2010-02-25 06:46:30 +00:00
Ted Kremenek b663ffe5f8 Add MacOSXAPIChecker, a meta checker to include various precondition checks for calls
to various MacOS X functions.  The checks in BasicObjCFoundationChecks.cpp will
gradually be migrated here.

As a first check, check that when 'dispatch_once()' is passed a predicate value
that has non-local storage.

llvm-svn: 97116
2010-02-25 05:44:09 +00:00
Ted Kremenek 5563dea713 When generating error node, check to see if we already cached out.
llvm-svn: 97115
2010-02-25 05:44:05 +00:00
Sanjiv Gupta 9ac3092d34 Targets (like pic16) may have mangled the name of global variables,
so get the name from Var rather than the original decl.

llvm-svn: 97114
2010-02-25 05:20:44 +00:00
Douglas Gregor 5a6872400b Update CMake makefiles
llvm-svn: 97113
2010-02-25 04:52:01 +00:00
Douglas Gregor cd3f49fc88 Restore the invariant that a nested-name-specifier can only contain
class types, dependent types, and namespaces. I had previously
weakened this invariant while working on parsing pseudo-destructor
expressions, but recent work in that area has made these changes
unnecessary.

llvm-svn: 97112
2010-02-25 04:46:04 +00:00
Daniel Dunbar 400a6939a8 Frontend: Add CodeGenAction::takeModule().
llvm-svn: 97111
2010-02-25 04:37:50 +00:00
Daniel Dunbar cea0c70f12 Frontend: Pull CodeGenAction out more, and eliminate CreateBackendConsumer.
This is the way I would like to move the frontend function towards -- distinct
pieces of functionality should be exposed only via FrontendAction
implementations which have clean and relatively-stable APIs.

This also isolates the surface area in clang which depends on LLVM CodeGen.

llvm-svn: 97110
2010-02-25 04:37:45 +00:00
Anders Carlsson 01bbef516e Remove dead code.
llvm-svn: 97109
2010-02-25 03:57:50 +00:00
Anders Carlsson 422f778ba1 Move the vcall and vbase offset layout code out into its own class.
llvm-svn: 97107
2010-02-25 03:45:56 +00:00
Daniel Dunbar 3babf5df64 Driver: Allow driver title (for --help) to be overridden by clients.
llvm-svn: 97106
2010-02-25 03:31:53 +00:00
Ted Kremenek d98d22b9af Enhance the unused ivar checker to not consider an ivar to be accidentally unused
when it is explicitly marked as unused via __attribute__((unused)).

llvm-svn: 97104
2010-02-25 03:26:55 +00:00
Ted Kremenek 6bf658abef Allow __attribute__((unused)) to be applied to ObjC ivars.
llvm-svn: 97103
2010-02-25 03:26:51 +00:00
Daniel Dunbar aa7d55a3fe Add TextDiagnosticPrinter::setPrefix, for adding a string to prefix diagnostic
messages with.

llvm-svn: 97101
2010-02-25 03:23:40 +00:00
Douglas Gregor 6aade28fd3 Remove some oogly code made dead by the pseudo-destructor
instantiation changes.

llvm-svn: 97095
2010-02-25 02:00:27 +00:00
Douglas Gregor 678f90df09 Use CXXPseudoDestructorExpr as the stored representation for dependent
expressions that look like pseudo-destructors, e.g.,

  p->T::~T()

where p has dependent type.

At template instantiate time, we determine whether we actually have a
pseudo-destructor or a member access, and funnel down to the
appropriate routine in Sema.

Fixes PR6380.

llvm-svn: 97092
2010-02-25 01:56:36 +00:00
John McCall 65eb879d22 Catch more uses of uninitialized implicit conversion sequences.
When diagnosing bad conversions, skip the conversion for ignored object
arguments.  Fixes PR 6398.

llvm-svn: 97090
2010-02-25 01:37:24 +00:00
Ted Kremenek d55522f02e Add UnixAPIChecker, a meta checker to include various precondition checks for calls
to various unix/posix functions, e.g. 'open()'.

As a first check, check that when 'open()' is passed 'O_CREAT' that it has
a third argument.

llvm-svn: 97086
2010-02-25 00:20:35 +00:00
Ted Kremenek bfe9f5f4db Remove stray #include.
llvm-svn: 97085
2010-02-25 00:20:31 +00:00
Ted Kremenek ad744f4b88 Remove #include.
llvm-svn: 97084
2010-02-25 00:20:28 +00:00
Ted Kremenek 11e899c199 Divide list of registration functions in API and foundational checks. Also trim whitespace.
llvm-svn: 97083
2010-02-25 00:20:25 +00:00
Ted Kremenek 43fddf77a4 Sort list of checker registration functions.
llvm-svn: 97082
2010-02-25 00:20:22 +00:00
Douglas Gregor cdbd51551b Keep track of the location of the '~' in a pseudo-destructor expression.
llvm-svn: 97080
2010-02-24 23:50:37 +00:00
Douglas Gregor 651fe5ec20 Retain complete source information for the type after the '~' in a
CXXPseudoDestructorExpr. 

Update template instantiation for pseudo-destructor expressions to use
this source information and to make use of
Sema::BuildPseudoDestructorExpr when the base expression is dependent
or refers to a scalar type.

llvm-svn: 97079
2010-02-24 23:40:28 +00:00
Douglas Gregor 40d732fee7 Make sure that we finish the DeclSpec when parsing a C++
type-specifier-seq. Fixes some conditional-jump-on-unitialized-value
errors in valgrind. Also counts as attempt #2 at making the MSVC
buildbot happy.

llvm-svn: 97077
2010-02-24 23:13:13 +00:00
Douglas Gregor 90ad922a73 Make sure that we have type source information for the scope type of a
pseudo-destructor expression. Attempt #1 at fixing the MSVC buildbot.

llvm-svn: 97076
2010-02-24 23:02:30 +00:00
Fariborz Jahanian 8652be05b7 Implement nasty rewriting of nested blocks when inner
blocks use variables not used in any of the outer blocks.
(Fixes radar 7682149).

llvm-svn: 97073
2010-02-24 22:48:18 +00:00
Douglas Gregor b1dd23fbc4 Split ActOnPseudoDestructorExpr into the part that interprets the
parser's data structures and the part that performs semantic analysis
and AST building, in preparation for improved template instantiation
of pseudo-destructor expressions.

llvm-svn: 97070
2010-02-24 22:38:50 +00:00
Anders Carlsson 3c1ec97a28 Get rid of 'this' adjustments from the FinalOverriders class since they can be different for the same overrider in different parts of the vtable.
llvm-svn: 97068
2010-02-24 22:32:18 +00:00
Anders Carlsson d8d698da60 Improve this adjustment pointer calculation.
llvm-svn: 97067
2010-02-24 22:27:12 +00:00
Anders Carlsson 8025e7b1b9 Make ComputeThisAdjustmentBaseOffset public for now.
llvm-svn: 97066
2010-02-24 22:18:01 +00:00
Douglas Gregor 75d8ec1fbe Retain source information for the "type-name ::" in a
pseudo-destructor expression such as

  p->T::~T()

llvm-svn: 97060
2010-02-24 21:52:20 +00:00
Douglas Gregor 0d5b0a1e5e ActOnPseudoDestructorExpr now performs all semantic analysis for
pseudo-destructor expressions, and builds the CXXPseudoDestructorExpr
node directly. Currently, this only affects pseudo-destructor
expressions when they are parsed, but not after template
instantiation. That's coming next...

Improve parsing of pseudo-destructor-names. When parsing the
nested-name-specifier and we hit the sequence of tokens X :: ~, query
the actual module to determine whether X is a type-name (in which case
the X :: is part of the pseudo-destructor-name but not the
nested-name-specifier) or not (in which case the X :: is part of the
nested-name-specifier). 

llvm-svn: 97058
2010-02-24 21:29:12 +00:00
John McCall aea181de04 Fix an iterator-invalidation bug that was causing selfhost errors
on non-darwin platforms.  Fixes PR6411. Test case doesn't reduce,
unfortunately.

llvm-svn: 97055
2010-02-24 20:32:01 +00:00
Douglas Gregor e610adae17 Rework parsing of pseudo-destructor expressions and explicit
destructor calls, e.g., 

  p->T::~T

We now detect when the member access that we've parsed, e.g.,

  p-> or x.

may be a pseudo-destructor expression, either because the type of p or
x is a scalar or because it is dependent (and, therefore, may become a
scalar at template instantiation time). 

We then parse the pseudo-destructor grammar specifically:

  ::[opt] nested-name-specifier[opt] type-name :: ∼ type-name

and hand those results to a new action, ActOnPseudoDestructorExpr,
which will cope with both dependent member accesses of destructors and
with pseudo-destructor expressions.

This commit affects the parsing of pseudo-destructors, only; the
semantic actions still go through the semantic actions for member
access expressions. That will change soon.

llvm-svn: 97045
2010-02-24 18:44:31 +00:00
Anders Carlsson a9f633b060 Generate correct vcall offsets when we have a primary virtual base that is not a primary base in the complete class hierarchy.
llvm-svn: 97039
2010-02-24 16:43:12 +00:00
John McCall 6dee473780 References to const int parameters with ICE default arguments are not ICEs.
Fixes PR6373.

llvm-svn: 97037
2010-02-24 09:03:18 +00:00
John McCall 8ee376f08a Canonicalize parameter and return types before computing ABI info. Eliminates
a common source of oddities and, in theory, removes some redundant ABI
computations.  Also fixes a miscompile I introduced yesterday by refactoring
some code and causing a slightly different code path to be taken that
didn't perform *parameter* type canonicalization, just normal type
canonicalization;  this in turn caused a bit of ABI code to misfire because
it was looking for 'double' or 'float' but received 'const float'.

llvm-svn: 97030
2010-02-24 07:14:12 +00:00
Charles Davis 2996796972 When we encounter a function-specific attribute in a declaration specifier,
apply it only to the function itself, and never to the return type. Fixes part
of PR6408.

llvm-svn: 97015
2010-02-24 02:27:18 +00:00
Zhongxing Xu a396e617b5 Always add CallExpr as block-level expression. Inline-based interprocedural
analysis needs this.

llvm-svn: 97014
2010-02-24 02:19:28 +00:00
Fariborz Jahanian f89eb2b9c2 Fix rewriting of a method when return type is
a block pointer type. Fixes radar 7682149.

llvm-svn: 97008
2010-02-24 01:25:40 +00:00
Ted Kremenek 74a4ce7f1e Add support for '%C' and '%S' printf conversion specifiers.
llvm-svn: 97005
2010-02-24 00:05:54 +00:00