Commit Graph

5750 Commits

Author SHA1 Message Date
Douglas Gregor 721fb2b6e4 Diagnose the use of incomplete types in C++ typeid expressions
llvm-svn: 92045
2009-12-23 21:06:06 +00:00
Ted Kremenek b8e6dc88bb Rename test file.
llvm-svn: 92044
2009-12-23 20:59:39 +00:00
Ted Kremenek 778231cb18 Change test case to use 'clang -cc1' (without --disable-free) instead of c-index-test (whose memory management behavior may change in the future).
llvm-svn: 92043
2009-12-23 20:58:27 +00:00
Douglas Gregor f45f6828c6 Remove cv-qualifiers from the argument to typeid
llvm-svn: 92041
2009-12-23 20:51:04 +00:00
Anders Carlsson 910847c149 Mangle template template parameters. Fixes PR5861.
llvm-svn: 92030
2009-12-23 19:30:55 +00:00
Chris Lattner 3859c74b32 fix the microsoft "charify" extension to return the charified token
as a character literal, not a string literal.  This might fix
rdar://7486575

llvm-svn: 92025
2009-12-23 19:15:27 +00:00
Eli Friedman 38b9ad88e2 Fix the overflow calculation in Sema::CheckTemplateArgument to be a bit more
accurate.

llvm-svn: 92018
2009-12-23 18:44:58 +00:00
Douglas Gregor 25ab25f39d When using a default function argument for a function template (or
member function thereof), perform the template instantiation each time
the default argument is needed. This ensures that
  (1) We get different CXXTemporary objects for each instantiation, and
  (2) Any other instantiations or definitions triggered by the
  instantiation of the default argument expression are guaranteed to
  happen; previously, they might have been suppressed, e.g., because
  they happened in an unevaluated context.

This fixes the majority of PR5810. However, it does not address the
problem where we may have multiple uses of the same CXXTemporary
within an expression when the temporary came from a non-instantiated
default argument expression.

llvm-svn: 92015
2009-12-23 18:19:08 +00:00
Kovarththanan Rajaratnam 55e74a1a6a Remove RewriteBlocks. It has been superseded by RewriteObjC
llvm-svn: 92014
2009-12-23 18:03:34 +00:00
Ted Kremenek 00d19ee130 Add 'DeclStmt::DoDestroy()' which doesn't actually recurse over its child expressions (via StmtIterator), as those expressions are owned by the Decls and Types (which are destroyed elsewhere). This fixes a crasher reported in <rdar://problem/7487294>.
llvm-svn: 91990
2009-12-23 08:56:00 +00:00
Ted Kremenek a7bcbde814 Add CFG support for the condition variable that can appear in IfStmts in C++ mode.
Add transfer function support in GRExprEngine for IfStmts with initialized condition variables.

llvm-svn: 91987
2009-12-23 04:49:01 +00:00
Ted Kremenek 857f41c650 Suppress dead store warnings involving objects initialized with CXXExprTemporaries.
llvm-svn: 91986
2009-12-23 04:11:44 +00:00
Eric Christopher c87915629b Update for the intrinsic changes in llvm: the object size intrinsic
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.

llvm-svn: 91983
2009-12-23 03:49:37 +00:00
Ted Kremenek 25e280bf02 Fix PR 5857. When casting from a symbolic region to an integer back to a pointer value, we were not correctly layering the correct ElementRegion on the original SymbolicRegion.
llvm-svn: 91981
2009-12-23 02:52:14 +00:00
Ted Kremenek 343b51271d Also treat the type of the subexpression as a pointer in GRExprEngine::VisitCast when the expression is handled as an lvalue.
llvm-svn: 91969
2009-12-23 01:19:20 +00:00
John McCall b50c443df2 Test case for PR5134.
llvm-svn: 91965
2009-12-23 01:09:14 +00:00
Daniel Dunbar e0d2691b88 Driver: Fix '... -O4 -O0 ...', which was generating bitcode.
llvm-svn: 91962
2009-12-23 00:47:42 +00:00
John McCall db3062cd4e Test case from PR5476.
llvm-svn: 91957
2009-12-23 00:44:38 +00:00
John McCall 0a4bb26ed0 Set a member's access specifier even if it doesn't match the previous specifier.
Prevents an assert on successive redeclarations.

Fixed PR5573.

llvm-svn: 91956
2009-12-23 00:37:40 +00:00
Ted Kremenek 22cc1a8438 Add basic support for analyzing CastExprs as lvalues.
llvm-svn: 91952
2009-12-23 00:26:16 +00:00
Douglas Gregor 04c5f973ee Objective-C methods can be variadic, too. Who knew.
llvm-svn: 91951
2009-12-23 00:21:46 +00:00
Nuno Lopes 56abcbdb47 warn when attribute warn_unused_result is applied to void functions.
while at it, remove an outdated FIXME

llvm-svn: 91946
2009-12-22 23:59:52 +00:00
Douglas Gregor 684d7bdc43 Allow the first parameter of operator new to be a cv-qualified
size_t. Also, fix an issue with initialization of parameters in calls,
where we weren't removing the cv-qualifiers on the parameter type
itself. Fixes PR5823.

llvm-svn: 91941
2009-12-22 23:42:49 +00:00
Douglas Gregor 19fc0b753a Make sure that reinterpret_cast gets a CastKind on all successful
paths. Fixes "cannot compile this unexpected cast lvalue yet" error in
llvm/lib/Analysis/IPA/GlobalsModRef.cpp.

llvm-svn: 91932
2009-12-22 22:47:22 +00:00
John McCall a1d8550778 Add using shadow decls to the "instantiated locals" map, fixing PR5847.
llvm-svn: 91928
2009-12-22 22:26:37 +00:00
Douglas Gregor b6ea60872d Switch Sema::AddCXXDirectInitializerToDecl over to InitializationSequence
llvm-svn: 91927
2009-12-22 22:17:25 +00:00
Ted Kremenek e19711d223 Add transfer functions support for visiting an Objective-C message expression as an lvalue when the return type is a C++ reference.
llvm-svn: 91926
2009-12-22 22:13:46 +00:00
Douglas Gregor dc72875d25 Serialize the NoReturn bit on FunctionTypes for precompiled headers
llvm-svn: 91911
2009-12-22 18:11:50 +00:00
Douglas Gregor 613bf10470 Enter the scope of an initializer for direct-initialization as well as
for copy-initialization.

llvm-svn: 91909
2009-12-22 17:47:17 +00:00
Douglas Gregor 2e9c795df0 When transforming a C++ "new" expression that was not explicitly given
a size, check whether the transformed type is itself an array type. If
so, take the major array bound as the size to allocate. Fixes PR5833.

llvm-svn: 91907
2009-12-22 17:13:37 +00:00
Douglas Gregor 96596c98fb Switch initialization of parameters in a call over to
InitializationSequence (when a FunctionDecl is present). This required
a few small fixes to initialization sequences:

  - Make sure to use the adjusted parameter type for initialization of
  function parameters.
  - Implement transparent union calling semantics in C

llvm-svn: 91902
2009-12-22 07:24:36 +00:00
Anders Carlsson 8a35c7982c Make sure that we mangle overloaded operators that are member functions correctly, giving them the correct arity.
With this seemingly insignificant fix, we are now able to build and link clang using clang itself! (LLVM still has to be built with gcc for the time being).

llvm-svn: 91893
2009-12-22 06:36:32 +00:00
Chris Lattner d806cbc98d fix a bug handling the gnu ?: extension. Patch by Storlek on IRC,
who prefers to be stealthy and mysterious.

llvm-svn: 91888
2009-12-22 06:00:13 +00:00
Anders Carlsson 9c45ad7a1b When we simply return a retained member expression when instantiating, we must also mark the member decl as referenced.
llvm-svn: 91887
2009-12-22 05:24:09 +00:00
Eli Friedman 5f101b95c6 Switch default arguments over to InitializationSequence.
llvm-svn: 91883
2009-12-22 02:46:13 +00:00
Eli Friedman 463e523ad8 Switch file-scope assignment initialization over to InitializationSequence.
llvm-svn: 91881
2009-12-22 02:10:53 +00:00
Daniel Dunbar 3780f0b680 x86_64: Structures with no fields but which have padding should be classified as
integer.
 - This is consistent, but may not be correct. I will revisit x86_64 ABI handling for C++ as a whole at some point.
 - PR5831.

llvm-svn: 91874
2009-12-22 01:19:25 +00:00
Douglas Gregor 4141d5bea2 When converting from a type to itself or one of its base classes via a
constructor call, the conversion is only a standard conversion
sequence if that constructor is a copy constructor. This fixes PR5834
in a semi-lame way, because the "real" fix will be to move over to
InitializationSequence. That will happen "soonish", but not now.

llvm-svn: 91861
2009-12-22 00:21:20 +00:00
Douglas Gregor 2bb0765bb4 When filling in value initializations within an initializer list, be
sure to fill in the initialized member of a union when a member was
explicitly designated. Fixes PR5843.

llvm-svn: 91858
2009-12-22 00:05:34 +00:00
Daniel Dunbar 0def3d17cb ARM: Honor -mfpu= and set __VFP_FP__ and __ARM_NEON__ "correctly".
- Correctly is in quotes, because we are following what I interpreted as GCC's
   intent (which diverges from practice, naturally).
 - Also, fix the arch define for arm1136jf-s.

llvm-svn: 91855
2009-12-21 23:28:17 +00:00
Douglas Gregor 8364e6b568 When a template-id refers to a single function template, and the
explicitly-specified template arguments are enough to determine the
instantiation, and either template argument deduction fails or is not
performed in that context, we can resolve the template-id down to a
function template specialization (so sayeth C++0x
[temp.arg.explicit]p3). Fixes PR5811.

llvm-svn: 91852
2009-12-21 23:17:24 +00:00
Fariborz Jahanian ffc420cb51 Allow comparison of 'void *' with function pointer
as a g++ extension (fixes radar 7481987).

llvm-svn: 91827
2009-12-21 18:19:17 +00:00
Eli Friedman 9025ec2ee5 Fix for PR5840: fix the kind of name lookup used for classes in
Sema::getTypeName.

"LookupNestedNameSpecifierName" isn't quite the right kind of lookup, though; 
it doesn't ignore namespaces.  Someone more familiar with the lookup code
should fix this properly.

llvm-svn: 91809
2009-12-21 01:42:38 +00:00
Anders Carlsson 9a98ac993f Add tests for structs inside anonymous namespaces.
llvm-svn: 91806
2009-12-21 00:57:38 +00:00
Anders Carlsson 2b7f444366 Incomplete structs should also have internal linkage.
llvm-svn: 91805
2009-12-21 00:41:42 +00:00
Anders Carlsson 18e6ee1b20 Correcly handle pointers to member pointer types where the class or the pointee is incomplete.
llvm-svn: 91804
2009-12-20 23:37:55 +00:00
Nuno Lopes 518e370719 fix PR4010: add support for the warn_unused_result for function pointers
llvm-svn: 91803
2009-12-20 23:11:08 +00:00
Chris Lattner 1576850a76 fix PR5500: clang fails to parse inline asm with :: in C++ mode
llvm-svn: 91802
2009-12-20 23:08:04 +00:00
Chris Lattner 2fe080c83e a really old testcase I apparently forgot to 'svn add'.
llvm-svn: 91800
2009-12-20 23:00:15 +00:00
Anders Carlsson d008129f34 Rework the way pointer types are handled by the RTTI builder. We now get the right linkage for indirect pointers to incomplete structs.
llvm-svn: 91799
2009-12-20 22:30:54 +00:00