Commit Graph

28254 Commits

Author SHA1 Message Date
John McCall 5143d646b9 When mangling a qualified array type, push the qualifiers down to the
element type.  Fixes rdar://problem/8913416.

llvm-svn: 124315
2011-01-26 20:05:40 +00:00
Douglas Gregor e1a47c1766 Rvalue references for *this: explicitly keep track of whether a
reference binding is for the implicit object parameter of a member
function with a ref-qualifier. My previous comment, that we didn't
need to track this explicitly, was wrong: we do in fact get
rvalue-references-prefer-rvalues overloading with ref-qualifiers.

llvm-svn: 124313
2011-01-26 19:41:18 +00:00
Douglas Gregor 0282432039 Rvalue references for *this: implement the implicit conversion rules
for the implicit object argument to a non-static member function with
a ref-qualifier (C++0x [over.match.funcs]p4).

llvm-svn: 124311
2011-01-26 19:30:28 +00:00
John McCall 0a6bf2ebe2 Un-nest the meat of this function.
llvm-svn: 124310
2011-01-26 19:21:13 +00:00
John McCall f256eb54a2 Fix some obvious bugs in the conditional-cleanup code and then make the
dtor cleanup use it.

llvm-svn: 124309
2011-01-26 19:15:39 +00:00
Peter Collingbourne 8bfb2f8ab5 Move InheritableAttr::isInherited to Attr
llvm-svn: 124299
2011-01-26 18:07:13 +00:00
Peter Collingbourne 7b0b89609f Remove Attr::isMerged; it is not used any more and redundant with
InheritableAttr

llvm-svn: 124298
2011-01-26 18:07:07 +00:00
Douglas Gregor b2f8aa9556 Rvalue references for *this: allow functions to be overloaded based on
the presence and form of a ref-qualifier. Note that we do *not* yet
implement the restriction in C++0x [over.load]p2 that requires either
all non-static functions with a given parameter-type-list to have a
ref-qualifier or none of them to have a ref-qualifier.

llvm-svn: 124297
2011-01-26 17:47:49 +00:00
Douglas Gregor f3ea1ed1ad Rvalue references for *this: add name mangling for ref-qualifiers,
using rules that I just made up this morning. This encoding has now
been proposed to the Itanium C++ ABI group for inclusion, but of
course it's still possible that the mangling will change.

llvm-svn: 124296
2011-01-26 17:36:28 +00:00
Douglas Gregor 54e462ac6e Rvalue references for *this: tentative parsing and template argument deduction.
llvm-svn: 124295
2011-01-26 16:50:54 +00:00
Douglas Gregor 1d042091d3 Reference qualifiers for *this: implement C++0x [expr.mptr.oper]p6,
the restrictions on .* and ->* for ref-qualified pointer-to-member
functions.

llvm-svn: 124294
2011-01-26 16:40:18 +00:00
Douglas Gregor c41d94eb1a Clean up the C++0x __has_feature tests. Specifically:
- Don't publicize a C++0x feature through __has_feature if we aren't
    in C++0x mode (even if the feature is available only with a
    warning). 
  - "auto" is not implemented well enough for its __has_feature to be
    turned on.
  - Fix the test of C++0x __has_feature to actually test what we're
  trying to test. Searching for the substring "foo" when our options
  are "foo" and "no_foo" doesn't work :)

llvm-svn: 124291
2011-01-26 15:36:03 +00:00
Douglas Gregor e696ebbd70 Reinstate r124236 (tweaking the rvalue-reference overload resolution
rules), now that we've actually have a clean build for me to sully.

llvm-svn: 124290
2011-01-26 14:52:12 +00:00
Douglas Gregor db9d664244 Rvalue references for *this:
- Add ref-qualifiers to the type system; they are part of the
  canonical type. Print & profile ref-qualifiers
  - Translate the ref-qualifier from the Declarator chunk for
    functions to the function type. 
  - Diagnose mis-uses of ref-qualifiers w.r.t. static member
  functions, free functions, constructors, destructors, etc.
  - Add serialization and deserialization of ref-qualifiers.

llvm-svn: 124281
2011-01-26 05:01:58 +00:00
Ted Kremenek 5d068499a7 Teach -Wreturn-type that destructors can appear
after a 'return' in a CFGBlock.  This accidentally
was working before, but the false assumption that
'return' always appeared at the end of the block
was uncovered by a recent change.

llvm-svn: 124280
2011-01-26 04:49:52 +00:00
Ted Kremenek e543be3531 Merge -Wuninitialized-experimental into -Wuninitialized.
llvm-svn: 124279
2011-01-26 04:49:48 +00:00
Ted Kremenek 33ddd9692d Tweak -Wuninitialized-experimental to not emit
a warning for uses of an uninitialized variable
when the use is a void cast, e.g. (void) x.

llvm-svn: 124278
2011-01-26 04:49:43 +00:00
John McCall ce1de6172c Better framework for conditional cleanups; untested as yet.
I'm separately committing this because it incidentally changes some
block orderings and minor IR issues, like using a phi instead of
an unnecessary alloca.

llvm-svn: 124277
2011-01-26 04:00:11 +00:00
Douglas Gregor 5499235d13 Rvalue references for *this: parse ref-qualifiers.
llvm-svn: 124276
2011-01-26 03:43:54 +00:00
Ken Dyck 02155cb8e8 Use RecordLayout::getBaseClassOffset() where CharUnits are needed instead of
converting getBaseClassOffsetInBits() to CharUnits.

llvm-svn: 124274
2011-01-26 02:17:08 +00:00
Argyrios Kyrtzidis c7ffd35cb7 [analyzer] Enable the self-init checker under command-line option '-analyzer-check-objc-self-init' which by default
is enabled by the driver for '--analyze'.

llvm-svn: 124266
2011-01-26 01:26:50 +00:00
Argyrios Kyrtzidis 7e71884ecb Correct r124242 making sure function chunk that gets diagnosed is really about the block.
Clairvoyance by John!

llvm-svn: 124264
2011-01-26 01:26:44 +00:00
Argyrios Kyrtzidis 8781b7dded [analyzer] Improve the diagnostic for the self-init checker. Suggestion by Ted!
llvm-svn: 124263
2011-01-26 01:26:41 +00:00
Fariborz Jahanian 9312fcc2d3 Tweak the rule for deciding if a provisional ivar is needed
in default ivar synthesis.  Fixes // rdar://8913053.

llvm-svn: 124258
2011-01-26 00:57:01 +00:00
Jeffrey Yasskin d5642d0bcd Remove CompilerInstance::getOutputFileList because it is unimplemented and unused.
llvm-svn: 124256
2011-01-26 00:18:08 +00:00
Argyrios Kyrtzidis 3ae681eb12 [analyzer] Do the self-init check only on NSObject subclasses. Patch by Jean-Daniel Dupas!
llvm-svn: 124249
2011-01-25 23:54:44 +00:00
Douglas Gregor 41e4e2c798 Speculatively revert r124236
llvm-svn: 124247
2011-01-25 23:49:36 +00:00
Argyrios Kyrtzidis 4e52cc7de4 Diagnose calling convention attribute incompatibilities. Fixes rdar://8876096.
llvm-svn: 124244
2011-01-25 23:16:40 +00:00
Argyrios Kyrtzidis cd81fe033c Fix infinite loop during error diagnostics. Fixes rdar://8875304.
llvm-svn: 124243
2011-01-25 23:16:36 +00:00
Argyrios Kyrtzidis 20ad245e3e Change error "function cannot return array type" -> "blocks cannot return array type" when blocks are involved.
Addresses rdar://8876238.

llvm-svn: 124242
2011-01-25 23:16:33 +00:00
Ted Kremenek 4fd3fda33b Tweak return-noreturn.cpp test to have its original
contents, with the additional warning flag (and still marked XFAIL).

llvm-svn: 124239
2011-01-25 22:57:41 +00:00
Ted Kremenek ebe6260137 Fix regression in -Wreturn-type caused by not
handling all CFGElement kinds.  While writing
the test case, it turned out that return-noreturn.cpp
wasn't actually testing anything since it has the wrong -W
flag.  That uncovered another regression with
the handling of destructors marked noreturn.  WIP.

llvm-svn: 124238
2011-01-25 22:50:47 +00:00
Douglas Gregor 407371a1e4 Speculatively implement a tweak to the C++0x overload resolution rules
for reference binding (C++ [over.rank.ics]p3b1sb4), so that we prefer
the binding of an lvalue reference to a function lvalue over the
binding of an rvalue reference. This change resolves the ambiguity
with std::forward and lvalue references to function types in a way
that seems consistent with the original rvalue references proposal.

My proposed wording for this change is shown in
isBetterReferenceBindingKind(); we'll try to get this change adopted
in the C++0x working paper as well.

llvm-svn: 124236
2011-01-25 22:19:32 +00:00
Ted Kremenek 7e1ec9ccd8 Unbreak CMake build.
llvm-svn: 124235
2011-01-25 22:10:37 +00:00
Ted Kremenek fedad3c668 Don't try and symbolicate unions; we don't reason
about them yet.  Fixes crash reported in PR 9049.

llvm-svn: 124228
2011-01-25 21:08:47 +00:00
Nico Weber 2992efa403 Add -add-plugin flag, which runs plugins in addition to codegen.
llvm-svn: 124227
2011-01-25 20:34:14 +00:00
Jeffrey Yasskin 08a4f8f197 Add an attribute to forbid temporary instances of a type. This allows class
authors to write 

  class __attribute__((forbid_temporaries)) Name { ... };

when they want to force users to name all variables of the type. This protects
people from doing things like creating a scoped_lock that only lives for a
single statement instead of an entire scope.

The warning produced by this attribute can be disabled by
-Wno-forbid-temporaries.

llvm-svn: 124217
2011-01-25 20:08:12 +00:00
Douglas Gregor 1c5a53e200 Fix the ranking of reference bindings during overload resolution
(C++0x [over.ics.rank]p3) when one binding is an lvalue reference and
the other is an rvalue reference that binds to an rvalue. In
particular, we were using the predict "is an rvalue reference" rather
than "is an rvalue reference that binds to an rvalue", which was
incorrect in the one case where an rvalue reference can bind to an
lvalue: function references.

This particular issue cropped up with std::forward, where Clang was
picking an std::forward overload while forwarding an (lvalue)
reference to a function. However (and unfortunately!), the right
answer for this code is that the call to std::forward is
ambiguous. Clang now gets that right, but we need to revisit the
std::forward implementation in libc++.

llvm-svn: 124216
2011-01-25 19:39:31 +00:00
Ted Kremenek ade45d9703 Recycle memory for GRStates that are never referenced
by ExplodedNodes.  This leads to about a 4-8%
reduction in memory footprint when analyzing
functions in sqlite3.

llvm-svn: 124214
2011-01-25 19:13:54 +00:00
Ted Kremenek bcf848f70a Teach -Wuninitialized-experimental to also warn
about uninitialized variables captured by blocks.

llvm-svn: 124213
2011-01-25 19:13:48 +00:00
Ted Kremenek 7fd987de23 Tweak wording of static analyzer diagnostic
for a block capturing the value of an uninitialized
variable.

llvm-svn: 124212
2011-01-25 19:13:42 +00:00
Douglas Gregor 2d525f08c2 Teach TemplateSpecializationTypeLoc::initializeArgLocs() to actually
generate meaningful [*] template argument location information.

[*] Well, as meaningful as possible, given that this entire code path
is a hack for when we've lost type-source information.

llvm-svn: 124211
2011-01-25 19:13:18 +00:00
Rafael Espindola 05842dabb8 Move unnamed_addr after the function arguments on Sabre's request.
llvm-svn: 124210
2011-01-25 19:10:24 +00:00
Douglas Gregor d0d7bf32e3 Add test for PR8629
llvm-svn: 124204
2011-01-25 18:11:52 +00:00
Anders Carlsson e771e76326 Don't insert class templates into the DynamicClasses vector.
llvm-svn: 124201
2011-01-25 18:08:22 +00:00
Douglas Gregor a518d5b3ac Be a bit more defensive about setting the temporary base location
during template instantiation. This code needs to eventually die, but
this little tweak fixes PR8629, where bad location information slipped
through to the location of a class template instantiation.

llvm-svn: 124199
2011-01-25 17:51:48 +00:00
Douglas Gregor 85f240c788 Implement the rvalue-reference deduction transformation (from T&& ->
T) when taking the address of an overloaded function or matching a
specialization to a template (C++0x [temp.deduct.type]p10). Fixes
PR9044.

llvm-svn: 124197
2011-01-25 17:19:08 +00:00
Douglas Gregor ba278e2e7d When performing a glvalue-to-xvalue static_cast that involves a
derived-to-base conversion, set the cast kind and base path
appropriately.

llvm-svn: 124189
2011-01-25 16:13:26 +00:00
John McCall 46669c0996 Document the ns_returns_retained, ns_consumed, etc. attributes.
llvm-svn: 124176
2011-01-25 04:26:21 +00:00
John McCall 4bb483629f Change the wording of the bad-decl-for-attribute warning and error
to make it clear that we're talking about the declarations and not the types.

llvm-svn: 124175
2011-01-25 03:51:08 +00:00
John McCall ed433937c2 Add the ns_consumes_self, ns_consumed, cf_consumed, and ns_returns_autoreleased
attributes for the benefit of the static analyzer.

llvm-svn: 124174
2011-01-25 03:31:58 +00:00
Douglas Gregor 0098499f7d Downgrade the error about rvalue references to an extension warning
and turn on __has_feature(cxx_rvalue_references). The core rvalue
references proposal seems to be fully implemented now, pending lots
more testing.

llvm-svn: 124169
2011-01-25 02:17:32 +00:00
Argyrios Kyrtzidis ffb08c46fa [analyzer] Handle the dot syntax for properties in the ExprEngine.
We translate property accesses to obj-c messages by simulating "loads" or "stores" to properties
using a pseudo-location SVal kind (ObjCPropRef).

Checkers can now reason about obj-c messages for both explicit message expressions and implicit
messages due to property accesses.

llvm-svn: 124161
2011-01-25 00:04:03 +00:00
Argyrios Kyrtzidis fdbcd54658 [analyzer] Introduce ExprEngine::VisitObjCMessage for handling general ObjCMessages (both message expressions and property access)
and use it in ExprEngine::VisitObjCMessageExpr.

llvm-svn: 124160
2011-01-25 00:03:57 +00:00
Argyrios Kyrtzidis 37ab726d63 [analyzer] Introduce ObjCMessage which represents both explicit ObjC message expressions and implicit
messages that are sent for handling properties in dot syntax.

Replace all direct uses of ObjCMessageExpr in the checkers and checker interface with ObjCMessage.

llvm-svn: 124159
2011-01-25 00:03:53 +00:00
Argyrios Kyrtzidis 1b9747fe2c In a ObjCMessageExpr with the super class as receiver, 'super' is actually a ObjCInterfaceType.
llvm-svn: 124158
2011-01-25 00:03:48 +00:00
Argyrios Kyrtzidis 8e169a5f18 [analyzer] Simplify GetReceiverType function in BasicObjCFoundationChecks.cpp; no functionality change.
llvm-svn: 124157
2011-01-25 00:03:45 +00:00
Eric Christopher 23ec82fa47 Revert r124146 for now. It appears to be failing on a few platforms.
llvm-svn: 124153
2011-01-24 23:07:03 +00:00
Anton Yartsev 3bad9afaba pre/post increase/decrease for AltiVec vectors
llvm-svn: 124146
2011-01-24 20:55:22 +00:00
Nick Lewycky 0c4380856b Enhance the diagnostic for referring to a typedef with an elaborated name to be
as useful in a templated context as it is without templates. Fixes PR8755!

llvm-svn: 124136
2011-01-24 19:01:04 +00:00
Douglas Gregor a5f6f9c7a1 Disallow function template partial specializations, from Hans
Wennborg! Fixes PR8295.

llvm-svn: 124135
2011-01-24 18:54:39 +00:00
Douglas Gregor 62c3134629 Eliminate the use of getTypeForDecl from clang_getCursorType() and
clang_getDeclObjCTypeEncoding(); use ASTContext's methods instead,
which will (lazily) create the type as needed. Otherwise, we can end
up with null QualTypes.

llvm-svn: 124133
2011-01-24 18:44:28 +00:00
Douglas Gregor 52552c8a32 Note the need for --param=build_config=whatever in the Hacking Clang document, from Yuri Gribov
llvm-svn: 124130
2011-01-24 18:04:58 +00:00
Douglas Gregor baba85dc34 Improve the printing of C++ construction expressions, from Yuri Gribov!
llvm-svn: 124123
2011-01-24 17:25:03 +00:00
Anders Carlsson 1eb95961d3 Use attributes for all the override control specifiers.
llvm-svn: 124122
2011-01-24 16:26:15 +00:00
Douglas Gregor f143cd5051 Re-instate r123977/r123978, my updates of the reference-binding
implementation used by overload resolution to support rvalue
references. The original commits caused PR9026 and some
hard-to-reproduce self-host breakage.

The only (crucial!) difference between this commit and the previous
commits is that we now properly check the SuppressUserConversions flag
before attempting to perform a second user-defined conversion in
reference binding, breaking the infinite recursion chain of
user-defined conversions.

Rvalue references should be working a bit better now.

llvm-svn: 124121
2011-01-24 16:14:37 +00:00
Axel Naumann 20b2786524 Check whether DependentScopeDeclRefExpr's NestedNameSpecifier exists before accessing it, both for consistency (see StmtPrinter::VisitDeclRefExpr()) and for other use cases of dependent types.
llvm-svn: 124119
2011-01-24 15:44:00 +00:00
Douglas Gregor fa69024463 Eliminate the last reference to concepts, from Jean-Daniel Dupas
llvm-svn: 124118
2011-01-24 15:22:41 +00:00
Anders Carlsson 3bbfb7f64b Fix the __has_attribute example; we don't have an override attribute anymore.
llvm-svn: 124106
2011-01-24 03:54:51 +00:00
Chris Lattner c2989b3718 fix some typos, patch by Jonathan Wakely!
llvm-svn: 124105
2011-01-24 03:47:59 +00:00
Chris Lattner 7d29d4503a fix a broken example, PR9005, patch by Jonathan Wakely!
llvm-svn: 124104
2011-01-24 03:47:34 +00:00
Chris Lattner d8d7543419 remove some crazy leftover thing.
llvm-svn: 124098
2011-01-24 02:53:58 +00:00
Anders Carlsson 75286a7470 When building a type info struct for EH, we always want it to have linkonce_odr linkage.
llvm-svn: 124096
2011-01-24 02:12:11 +00:00
Anders Carlsson 68d3424b8c Change CodeGenModule::getVTableLinkage to be a non-static member function.
llvm-svn: 124095
2011-01-24 02:04:33 +00:00
Anders Carlsson ba840fb73c "Name" a bool parameter.
llvm-svn: 124094
2011-01-24 01:59:49 +00:00
Ken Dyck c28614cec4 Use CharUnits for the offset amount of RegionRawOffset.
llvm-svn: 124093
2011-01-24 01:55:39 +00:00
Ken Dyck 7c4026bea7 Remove private toCharUnits() helper method, replacing with calls to
ASTContext::toCharUnitsFromBits().

llvm-svn: 124092
2011-01-24 01:28:50 +00:00
Anders Carlsson 571e2ad042 Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the exception of explicit template instantiations, which have to be weak_odr.
This fixes PR6996.

llvm-svn: 124089
2011-01-24 00:46:19 +00:00
Anders Carlsson e30621b626 Get rid of [[hiding]], [[override]] and [[base_check]].
llvm-svn: 124087
2011-01-23 21:33:18 +00:00
Anders Carlsson 19588aa40b Get rid of the [[final]] C++0x attribute.
llvm-svn: 124083
2011-01-23 21:07:30 +00:00
Rafael Espindola 148141c98f Add support for the --noexecstack option. Fixes PR8762.
llvm-svn: 124078
2011-01-23 17:58:26 +00:00
Ted Kremenek 8f01420d9d Teach -Wuninitialized-experimental about sizeof().
llvm-svn: 124076
2011-01-23 17:53:04 +00:00
Ted Kremenek 499897b463 Tweak diagnostic:
error: no super class declared in @interface for 'XXX'

to be:

  error: 'X' cannot use 'super' because it is a root class

The latter explains what the user actually did wrong.

Fixes: <rdar://problem/8904409>
llvm-svn: 124074
2011-01-23 17:21:34 +00:00
Ted Kremenek 582a0999fb Null initialize a few variables flagged by
clang's -Wuninitialized-experimental warning.
While these don't look like real bugs, clang's
-Wuninitialized-experimental analysis is stricter
than GCC's, and these fixes have the benefit
of being general nice cleanups.

llvm-svn: 124072
2011-01-23 17:04:59 +00:00
Anders Carlsson 5a72fdb05b Accept the C++0x override control keywords as an extension in C++98. This is OK since the new syntax is unambiguous and can't be confused with C++98 syntax. If anyone disagrees, please shout!
llvm-svn: 124048
2011-01-22 23:01:49 +00:00
Anders Carlsson 7d59a68330 Implement [class.derived]p8.
llvm-svn: 124047
2011-01-22 22:23:37 +00:00
Anders Carlsson 703d6e62d0 Serialize and deserialize IsMarkedFinal/IsMarkedExplicit.
llvm-svn: 124041
2011-01-22 18:11:02 +00:00
Anders Carlsson c4964a40ba Mark classes final and/or explicit during class template instantiation.
llvm-svn: 124040
2011-01-22 18:07:06 +00:00
Anders Carlsson fc1eef4898 Mark classes as final or explicit. Diagnose when a class marked 'final' is used as a base.
llvm-svn: 124039
2011-01-22 17:51:53 +00:00
Anders Carlsson 67f9e61127 Add final/explicit getters and setters to CXXRecordDecl.
llvm-svn: 124037
2011-01-22 17:22:48 +00:00
Anders Carlsson 4b63d0e0a7 Parse class-virt-specifier-seqs.
llvm-svn: 124036
2011-01-22 16:56:46 +00:00
Anders Carlsson f2ca389205 More work on ClassVirtSpecifiers.
llvm-svn: 124035
2011-01-22 15:58:16 +00:00
Rafael Espindola b53c03be8a Add test from PR9026.
llvm-svn: 124034
2011-01-22 15:34:07 +00:00
Rafael Espindola be468d9a2b revert r123977 and r123978 to fix PR9026.
llvm-svn: 124033
2011-01-22 15:32:35 +00:00
Anders Carlsson a6d35015c8 Start stubbing out a ClassVirtSpecifiers class.
llvm-svn: 124032
2011-01-22 15:11:37 +00:00
Anders Carlsson e973899f46 A member function template cannot be virtual.
llvm-svn: 124031
2011-01-22 14:43:56 +00:00
Benjamin Kramer 1e1888979b Use a FunctionType::get overload that doesn't require an empty vector.
llvm-svn: 124029
2011-01-22 12:15:57 +00:00
John McCall 0140bfeead Improve our parse recovery on 'case blah;' and 'default;'.
llvm-svn: 124025
2011-01-22 09:28:32 +00:00
Douglas Gregor 9c399a29fd Send code generation for xvalues down the same path as lvalues
llvm-svn: 124023
2011-01-22 02:44:21 +00:00
Douglas Gregor b8c7fe9dc9 Debug info generation for rvalue references
llvm-svn: 124020
2011-01-22 01:58:15 +00:00
Douglas Gregor c1ed20cfba Update const_cast semantics for rvalue references. Add tests for
reinterpret_cast and const_cast using rvalue references.

llvm-svn: 124007
2011-01-22 00:19:52 +00:00
Douglas Gregor 465184ae10 Teach static_cast and dynamic_cast about rvalue references.
llvm-svn: 124006
2011-01-22 00:06:57 +00:00
Douglas Gregor 3f9047e321 Add a test for "perfect" forwarding
llvm-svn: 124005
2011-01-21 22:52:47 +00:00
Ted Kremenek 33d4b5eb66 Provide -Wuninitialized-experimental fixits
for floats, and also check if 'nil' is declared
when suggesting it for initializing ObjC pointers.

llvm-svn: 124004
2011-01-21 22:49:49 +00:00
Douglas Gregor c74edc272e When throwing an elidable object, first try to treat the subexpression
as an rvalue per C++0x [class.copy]p33. If that fails, try again with
the original subexpression.

llvm-svn: 124002
2011-01-21 22:46:35 +00:00
Douglas Gregor 626fbeda90 Generalize the NRVO move-construction-based initialization routine. No functionality change
llvm-svn: 123996
2011-01-21 21:08:57 +00:00
Ted Kremenek 2959fdd087 Add basic fixits for -Wuninitialized-experimental
to suggest initializations for pointer and
ObjC pointer types.

llvm-svn: 123995
2011-01-21 19:41:46 +00:00
Ted Kremenek 39fa056342 Enhance -Wuninitialized-experimental diagnostics
to issue the warning at an uninitialized variable's
declaration, but to issue notes at possible
uninitialized uses (which could be multiple).

llvm-svn: 123994
2011-01-21 19:41:41 +00:00
Douglas Gregor f282a76fab Implement the preference for move-construction over copy-construction
when returning an NRVO candidate expression. For example, this
properly picks the move constructor when dealing with code such as

  MoveOnlyType f() { MoveOnlyType mot; return mot; }

The previously-XFAIL'd rvalue-references test case now works, and has
been moved into the appropriate paragraph-specific test case.

llvm-svn: 123992
2011-01-21 19:38:21 +00:00
Douglas Gregor 732abf1128 We love parentheses
llvm-svn: 123983
2011-01-21 18:20:49 +00:00
Douglas Gregor 5d36900d7a Promote the static getNRVOCandidate() function, which computed the
NRVO candidate for a return statement, to
Sema::getCopyElisionCandidate(), and teach it enough to also determine
the NRVO candidate for a throw expression. We still don't use the
latter information, however.

Along the way, implement core issue 1148, which eliminates copy
elision from catch parameters and clarifies that copy elision cannot
occur from function parameters (which we already implemented).

llvm-svn: 123982
2011-01-21 18:05:27 +00:00
Douglas Gregor 6381402fe1 Implement core issue 1164, which concerns the partial ordering of
f(T&) and f(T&&).

llvm-svn: 123981
2011-01-21 17:29:42 +00:00
Douglas Gregor bf2f961a35 Add unique_ptr example to test the use of rvalue references. I'll grow
this example further as more rvalue-reference features come online.

llvm-svn: 123980
2011-01-21 17:06:29 +00:00
Douglas Gregor cc73795cd8 Add test for overload resolution's preference for binding an rvalue
reference to an rvalue rather than binding a const-qualified lvalue
reference to that rvalue.

llvm-svn: 123979
2011-01-21 16:48:38 +00:00
Douglas Gregor e916d0508b Eliminate an unused variable
llvm-svn: 123978
2011-01-21 16:37:29 +00:00
Douglas Gregor 95273c3a22 Update the reference-binding implementation used for overload
resolution to match the latest C++0x working paper's semantics. The
implementation now matching up with the reference-binding
implementation used for initialization.

llvm-svn: 123977
2011-01-21 16:36:05 +00:00
Douglas Gregor 4edf1c8968 More testing to C++0x [temp.deduct.call]p3
llvm-svn: 123967
2011-01-21 05:24:25 +00:00
Douglas Gregor cba72b1f62 Implement the special template argument deduction rule for T&& in a
call (C++0x [temp.deduct.call]p3).

As part of this, start improving the reference-binding implementation
used in the computation of implicit conversion sequences (for overload
resolution) to reflect C++0x semantics. It still needs more work and
testing, of course.

llvm-svn: 123966
2011-01-21 05:18:22 +00:00
Peter Collingbourne 9f2a9909ae Sema: process non-inheritable attributes on function declarations early
This allows us to simplify the handling for the overloadable attribute,
removing a number of FIXMEs.

llvm-svn: 123961
2011-01-21 02:08:54 +00:00
Peter Collingbourne b331b267b1 Sema: support for processing non-inheritable declaration attributes early
llvm-svn: 123960
2011-01-21 02:08:45 +00:00
Peter Collingbourne ab8bc06373 Generalise support for non-inheritable attributes
Inheritable attributes on declarations may be inherited by any later
redeclaration at merge time.  By contrast, a non-inheritable attribute
will not be inherited by later redeclarations.  Non-inheritable
attributes may be semantically analysed early, allowing them to
influence the redeclaration/overloading process.

Before this change, the "overloadable" attribute received special
handling to be treated as non-inheritable, while all other attributes
were treated as inheritable.  This patch generalises the concept,
while removing a FIXME.  Some CUDA location attributes are also marked
as non-inheritable in order to support special overloading semantics
(to be introduced in a later patch).

The patch introduces a new Attr subclass, InheritableAttr, from
which all inheritable attributes derive.  Non-inheritable attributes
simply derive from Attr.

N.B. I did not review every attribute to determine whether it should
be marked non-inheritable.  This can be done later on an incremental
basis, as this change does not affect default functionality.

llvm-svn: 123959
2011-01-21 02:08:36 +00:00
Douglas Gregor 9b175e0512 Add more reference-binding examples from the C++0x working paper, all of which seem to be working fine
llvm-svn: 123955
2011-01-21 01:11:43 +00:00
Fariborz Jahanian 252a47f635 Move cheking of kext into canDevirtualizeMemberFunctionCalls().
Improve on test case. Per Doug's comment. wip.

llvm-svn: 123954
2011-01-21 01:04:41 +00:00
Douglas Gregor bed28f7629 Improve the diagnostic that complains about binding an rvalue
reference to an lvalue.

llvm-svn: 123953
2011-01-21 01:04:33 +00:00
Douglas Gregor 24f2e8ec00 More work to bring reference binding up to the latest C++0x
specification. In particular, an rvalue reference can bind to an
initializer expression that is an lvalue if the referent type and the
initializer expression type are not reference-related. This is a newer
formulation to the previous "rvalue references can never bind to
lvalues" rule.

llvm-svn: 123952
2011-01-21 00:52:42 +00:00
Douglas Gregor d412fe598b When performing reference binding via a conversion function, perform
type checking based on the actual reference type we're trying to bind
the result to, rather than stripping the reference.

llvm-svn: 123950
2011-01-21 00:27:08 +00:00
Fariborz Jahanian 4ad7afa019 Initialize a variable, found by Ted.
llvm-svn: 123948
2011-01-20 23:34:25 +00:00
Douglas Gregor 63dad4d83b Fix a use of uninitialized variables, found by Ted!
llvm-svn: 123947
2011-01-20 23:15:49 +00:00
Ted Kremenek 14cf0aba4d Removing debug printing logic from UninitializedValuesV2.
llvm-svn: 123944
2011-01-20 21:25:34 +00:00
Ted Kremenek cdca8fa97d Relax CFG assertions in UninitializedValuesV2 when
handling pseudo-path sensitivity, and instead
use those assertion conditions as dynamic checks.
These assertions would be violated when analyzing
a CFG where some branches where optimized away
during CFG construction because their branch
conditions could be trivially determined.

llvm-svn: 123943
2011-01-20 21:25:31 +00:00
Ted Kremenek 18f4a755a3 Add test case for <rdar://problem/8891119>. In
earlier revisions Clang was incorrectly warning
about an incomplete @implementation when a property
was getting synthesized.  This got fixed somewhere
down the line.

llvm-svn: 123939
2011-01-20 19:45:14 +00:00
Ted Kremenek b82ddd6ada Add rudimentary path-sensitivity to UnintializedValuesV2
analysis for short-circuited operations.  For branch written like "if (x && y)",
we maintain two sets of dataflow values for the outgoing
branches.  This suppresses some common false positives
for -Wuninitialized-experimental.

This change introduces some assertion failures
when running on the LLVM codebase.  WIP.

llvm-svn: 123923
2011-01-20 17:37:17 +00:00
Fariborz Jahanian 47609b088c apple kext abi requires all vf calls, including qualified
vf calls, be made indirect. This patch is towards that goal.

llvm-svn: 123922
2011-01-20 17:19:02 +00:00
Ted Kremenek a1ec4f39f4 Enhance AnalysisConsumer to also visit functions
and methods defined within 'namespace X { ... }'.

llvm-svn: 123921
2011-01-20 17:09:48 +00:00
Douglas Gregor 56d7eae857 More tests for reference binding in the presence of rvalue
references. Note that we're currently failing reference binding to a
function lvalue.

llvm-svn: 123920
2011-01-20 17:04:36 +00:00
Douglas Gregor 92e460e909 Start refactoring reference binding to more closely match the C++0x
working paper's structure. The only functional change here is that we
now handling binding to array rvalues, which we would previously reject.

llvm-svn: 123918
2011-01-20 16:44:54 +00:00
Anders Carlsson 3f610c75de Diagnose when a virtual member function marked final is overridden.
llvm-svn: 123916
2011-01-20 16:25:36 +00:00
Rafael Espindola ec4b30a1e8 Merge test.
llvm-svn: 123914
2011-01-20 16:11:21 +00:00
Douglas Gregor 7a2a116bab Add some tests for reference-collapsing and referencing binding
involving rvalue references, to start scoping out what is and what
isn't implemented. In the process, tweak some standards citations,
type desugaring, and teach the tentative parser about && in
ptr-operator.

llvm-svn: 123913
2011-01-20 16:08:06 +00:00
John McCall 4e81961a1e Fix the computation of alignment for fields of packed+aligned structs.
Part of the fix for PR8413.

llvm-svn: 123904
2011-01-20 07:57:12 +00:00
Anders Carlsson 7c812f5a99 When instantiating member functions, propagate whether the member function is marked 'final' and 'override'.
Also, call CheckOverrideControl when instantiating member functions.

llvm-svn: 123900
2011-01-20 06:52:44 +00:00
Anders Carlsson fa8e5d3d67 When checking for functions marked override, ignore dependent contexts.
llvm-svn: 123894
2011-01-20 06:33:26 +00:00
Anders Carlsson c87f861d0a Make CheckOverrideControl a member of Sema.
llvm-svn: 123893
2011-01-20 06:29:02 +00:00
Anders Carlsson fd83553733 Diagnose virtual member functions marked override but not overriding any virtual member functions.
llvm-svn: 123888
2011-01-20 05:57:14 +00:00
Anders Carlsson b4801436d1 Fix tests to be valid.
llvm-svn: 123887
2011-01-20 05:55:43 +00:00
Anders Carlsson dff1434d1e Add IsMarkedOverride and IsMarkedFinal flags to FunctionDecl (to be used by CXXRecordDecl).
llvm-svn: 123885
2011-01-20 05:36:44 +00:00
Anders Carlsson 725987b034 Change the parser error to reflect that virt-specifiers are allowed on any class member.
llvm-svn: 123883
2011-01-20 04:38:09 +00:00
Anders Carlsson 13a69102d7 Only allow virtual member functions to be marked 'override' and 'final'.
llvm-svn: 123882
2011-01-20 04:34:22 +00:00
Anders Carlsson 511315cc55 Add silly test case.
llvm-svn: 123880
2011-01-20 04:07:46 +00:00
Anders Carlsson db36b8055e Pass the VirtSpecifiers along to Sema::ActOnCXXMemberDeclarator.
llvm-svn: 123878
2011-01-20 03:57:25 +00:00
Anders Carlsson 428803b58a Lazily initialize the 'final' and 'override' contextual keywords as suggested by Doug.
llvm-svn: 123876
2011-01-20 03:47:08 +00:00
Anders Carlsson d802266c6b Add more parser tests for the override control keywords.
llvm-svn: 123875
2011-01-20 03:41:12 +00:00
Rafael Espindola 4b6053a1fe Turns out that the previous commit also fixes this :-)
llvm-svn: 123873
2011-01-20 02:57:51 +00:00
Rafael Espindola 9e976dcce8 Fix PR8884 by skipping transparent contexts. The test is for LikageSpec. I
failed to find a case where an enum context would make a difference, but
found PR9007 on the way.

llvm-svn: 123871
2011-01-20 02:26:24 +00:00
Ken Dyck 7d381c48fe Add CharUnits::RoundUpToAlignment() to simplify rounding in character units.
llvm-svn: 123868
2011-01-20 01:59:55 +00:00
Douglas Gregor 2bbfba0f0c When building a user-defined conversion sequence, keep track of the
declaration that name lookup actually found, so that we can use it for
access checking later on. Fixes <rdar://problem/8876150>.

llvm-svn: 123867
2011-01-20 01:32:05 +00:00
Douglas Gregor 668443efb1 Sema::BuildCXXMemberCallExpr() can fail due to access or ambiguities,
so allow it to propagate the failure outward. Fixes the crashing part
of <rdar://problem/8876150>.

llvm-svn: 123863
2011-01-20 00:18:04 +00:00
Douglas Gregor 6edd977c6f Explicitly track the number of call arguments provided when performing
overload resolution, so that we only use that number of call arguments
for partial ordering. Fixes PR9006, a recent regression.

llvm-svn: 123861
2011-01-19 23:54:39 +00:00
Douglas Gregor 312ab72dbd Eradicate any mention of C++0x concepts.
llvm-svn: 123860
2011-01-19 23:15:20 +00:00
Douglas Gregor eecc6bc388 Variadic templates are fully implemented.
Turn on the __has_feature switch for variadic templates, document
their completion, and put the ExtWarn into the c++0x-extensions
warning group.

llvm-svn: 123854
2011-01-19 22:11:50 +00:00
Douglas Gregor b25d8c3af4 Downgrade the "variadic templates are a C++0x feature" error to an
ExtWarn. We want variadic templates to be usable in libc++/libstdc++
headers even when we're in C++98/03 mode, since it's the only clean
way to implement TR1 <functional>.

llvm-svn: 123852
2011-01-19 21:59:15 +00:00
Douglas Gregor f144f4f5c9 Refactor the dependence computation for DeclRefExpr so that we can
reuse it for BlockDeclRefExpr. Do so, fixing the dependence calculate
for BlockDeclRefExpr.

llvm-svn: 123851
2011-01-19 21:52:31 +00:00
Douglas Gregor 476e3029ec Implement basic support for the use of variadic templates and blocks
together. In particular: 
  - Handle the use of captured parameter pack names within blocks
  (BlockDeclRefExpr understands parameter packs now)
  - Handle the declaration and expansion of parameter packs within a block's
  parameter list, e.g., ^(Args ...args) { ... })
  - Handle instantiation of blocks where the return type was not
  explicitly specified. (unrelated, but necessary for my tests).

Together, these fixes should make blocks and variadic templates work
reasonably well together. Note that BlockDeclRefExpr is still broken
w.r.t. its computation of type and value dependence, which will still
cause problems for blocks in templates.

llvm-svn: 123849
2011-01-19 21:32:01 +00:00
Douglas Gregor 54bce44895 Teach libclang to generate USRs containing parameter packs and pack expansions.
llvm-svn: 123848
2011-01-19 20:50:07 +00:00
Douglas Gregor 557f05c2d2 Teach libclang about SizeOfPackExpr.
llvm-svn: 123846
2011-01-19 20:34:17 +00:00
Douglas Gregor 0231d8dac7 Implement support for non-type template parameter packs whose type is
a pack expansion, e.g., the parameter pack Values in:

  template<typename ...Types>
  struct Outer {
    template<Types ...Values>
    struct Inner;
  };

This new implementation approach introduces the notion of an
"expanded" non-type template parameter pack, for which we have already
expanded the types of the parameter pack (to, say, "int*, float*",
for Outer<int*, float*>) but have not yet expanded the values. Aside
from creating these expanded non-type template parameter packs, this
patch updates template argument checking and non-type template
parameter pack instantiation to make use of the appropriate types in
the parameter pack.

llvm-svn: 123845
2011-01-19 20:10:05 +00:00
Douglas Gregor a91ad2dae4 NonTypeTemplateParmDecls always have TypeSourceInfo. There's no sense
in pretending otherwise.

llvm-svn: 123839
2011-01-19 17:02:02 +00:00
Douglas Gregor 2d4f64f441 Warn about the use of unparenthesized |= in conditionals (which may be
a typo for !=). Fixes PR9001, from Hans Wennborg!

llvm-svn: 123836
2011-01-19 16:50:08 +00:00
Douglas Gregor 8a4db83041 Parse the optional semicolon after a C++ in-class member function
definition, rather than complaining about it. Problem reported by
Marshall Clow.

llvm-svn: 123835
2011-01-19 16:41:58 +00:00
John McCall 8b7fd8f156 When building the copy expression for a __block variable, make sure
there's a respectable point of instantiation.  Also, make sure we do
this operation even when instantiating a dependently-typed variable.

llvm-svn: 123818
2011-01-19 11:48:09 +00:00
John McCall 33ddac05bb Change the canonical representation of array types to store qualifiers on the
outermost array types and not on the element type.  Move the CanonicalType
member from Type to ExtQualsTypeCommonBase;  the canonical type on an ExtQuals
node includes the qualifiers on the ExtQuals.  Assorted optimizations enabled
by this change.

getQualifiers(), hasQualifiers(), etc. should all now implicitly look through
array types.

llvm-svn: 123817
2011-01-19 10:06:00 +00:00
John McCall 424cec97bd Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.

llvm-svn: 123814
2011-01-19 06:33:43 +00:00
Nick Lewycky 0c49533039 Fix name to match reality.
llvm-svn: 123813
2011-01-19 05:59:39 +00:00
Ken Dyck 705ba07ef0 Replace calls to getTypeSize() and getTypeAlign() with their 'InChars'
counterparts where char units are needed.

llvm-svn: 123805
2011-01-19 01:58:38 +00:00
Ken Dyck 5d68663bfc Add a unary minus operator.
llvm-svn: 123804
2011-01-19 01:44:40 +00:00
Devang Patel d2d6665c71 Emit DW_TAG_lexical_scope to surround foreach.
llvm-svn: 123802
2011-01-19 01:36:36 +00:00
Douglas Gregor 345c1bcb80 Don't silently drop warning flags passed in to
clang_createTranslationUnitFromSourceFile().

llvm-svn: 123793
2011-01-19 01:02:47 +00:00
NAKAMURA Takumi 0d13fd3c94 lib/Sema/SemaExpr.cpp: __null should be LongLongTy on LLP64 Win64.
llvm-svn: 123791
2011-01-19 00:11:41 +00:00
NAKAMURA Takumi e03c603624 lib/CodeGen/TargetInfo.cpp: Fix coding style and erase an obsolete comment.
llvm-svn: 123790
2011-01-19 00:11:33 +00:00
Ted Kremenek b63931eef6 Teach UninitializedValuesV2 to implicitly reason about C++
references by monitoring whether an access to
a variable is solely to compute it's lvalue or
to do an lvalue-to-rvalue conversion (i.e., a load).

llvm-svn: 123777
2011-01-18 21:18:58 +00:00
Rafael Espindola d661a853fd Add unnamed_addr in CreateRuntimeVariable.
llvm-svn: 123773
2011-01-18 21:07:57 +00:00
Argyrios Kyrtzidis b495cc1a7b When redefining a macro don't warn twice if it's not used and don't warn for duplicate
definition by command line options. Fixes rdar://8875916.

llvm-svn: 123767
2011-01-18 19:50:15 +00:00
Argyrios Kyrtzidis e84389bf68 Properly do a float -> _Complex double conversion, fixes rdar://8875946.
llvm-svn: 123759
2011-01-18 18:49:33 +00:00
Douglas Gregor d763b3e014 Comment a wacky test case
llvm-svn: 123758
2011-01-18 18:38:18 +00:00
John McCall 0654946268 Fix some unnecessarily complicated code for canonicalizing variably-modified
parameter types.

llvm-svn: 123753
2011-01-18 08:40:38 +00:00
John McCall 6c9dd52a09 Generalize some operations on qualifiers. QualType::getQualifiers() and
::getCVRQualifiers() now look through array types, like all the other
standard queries.  Also, make a 'split' variant of getUnqualifiedType().

llvm-svn: 123751
2011-01-18 07:41:22 +00:00
Daniel Dunbar 16b0ec59f2 Fix newlines.
llvm-svn: 123742
2011-01-18 05:36:08 +00:00
Daniel Dunbar 84b643ebba tests: Force a triple.
llvm-svn: 123741
2011-01-18 05:36:03 +00:00
Francois Pichet 6422579411 Add support for explicit constructor calls in Microsoft mode.
For example: 

class A{ 
public:
  A& operator=(const A& that) {
      if (this != &that) {
          this->A::~A();
          this->A::A(that);  // <=== explicit constructor call.
      }
      return *this;
  }
};

More work will be needed to support an explicit call to a template constructor.

llvm-svn: 123735
2011-01-18 05:04:39 +00:00
Ted Kremenek c8d55da05a Correctly enable test/Sema/unit-variables.c,
thus identifying a minor logical flaw in
UninitializedValuesV2.cpp.

llvm-svn: 123734
2011-01-18 05:00:42 +00:00
Ted Kremenek cab479f0ee Teach UninitializedValuesV2 about "int x = x" and
also properly handle confluence of loops.

llvm-svn: 123733
2011-01-18 04:53:25 +00:00
Ted Kremenek b4384fb0df Get clang-wpa to build in TOT (reflecting updates
to the static analyzer).

llvm-svn: 123727
2011-01-18 04:22:19 +00:00
Douglas Gregor 0a791672f0 Introduce the notion of a "minimal" import of ASTs, to better support LLDB.
llvm-svn: 123723
2011-01-18 03:11:38 +00:00
Ken Dyck 9a6486934c Replace calls to CharUnits::fromQuantity() with ones to
ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units.

llvm-svn: 123720
2011-01-18 02:01:14 +00:00
Jeffrey Yasskin 8dfa5f1776 Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
-Wint-to-pointer-cast.

llvm-svn: 123719
2011-01-18 02:00:16 +00:00
Ken Dyck 86a7fcc19c Replace calls to CharUnits::fromQuantity() with ones
ASTContext::toCharUnitsFromBits() when converting from bit sizes to char units.

llvm-svn: 123715
2011-01-18 01:56:16 +00:00
NAKAMURA Takumi bd91f50190 lib/CodeGen/TargetInfo.cpp: Add Win64 calling conversion.
FIXME: It would be incompatible to Microsoft's in one point.
On mingw64-gcc, {i128} is expanded for args and returned as {rax, rdx}.

llvm-svn: 123692
2011-01-17 22:56:31 +00:00
NAKAMURA Takumi a2e468cb0a lib/Basic/Targets.cpp: __builtin_va_list is as same on win64 mingw64!
llvm-svn: 123691
2011-01-17 22:56:23 +00:00
NAKAMURA Takumi ce5519a790 lib/Basic/Targets.cpp: Fix __declspec() on Mingw-w64.
It should be defined as-is. Some headers would detect existence of __declspec and use one.

llvm-svn: 123690
2011-01-17 22:56:16 +00:00
NAKAMURA Takumi f7c3022369 lib/Basic/Targets.cpp: Set user_label_prefix on Win64 both mingw and msvc.
llvm-svn: 123689
2011-01-17 22:56:08 +00:00
Devang Patel 283e89dd22 Simplify.
llvm-svn: 123682
2011-01-17 22:23:07 +00:00
Rafael Espindola 2e217d6555 More unnamed_addr.
llvm-svn: 123681
2011-01-17 22:22:52 +00:00
Rafael Espindola de089d462c merge strings created by
const NSConstantString *appKey =  @"MyApp";

llvm-svn: 123680
2011-01-17 22:11:21 +00:00
Douglas Gregor 45e84b0053 NetBSD, OpenBSD, and Dragonfly BSD also have arc4random. Patch from
Joerg Sonnenberger!

llvm-svn: 123669
2011-01-17 19:16:24 +00:00
Douglas Gregor a09c6cca72 Add missing <cctype> include, from Joerg Sonnenberger
llvm-svn: 123668
2011-01-17 19:15:43 +00:00
Anders Carlsson 48d7285fc6 Handle base and member destructors in CheckFallThrough.
llvm-svn: 123667
2011-01-17 19:06:31 +00:00
Argyrios Kyrtzidis ee56962cc1 Convert "#pragma unused(...)" into tokens for the parser.
This allows us to cache a "#pragma unused" that occurs inside an inline C++ member function.
Fixes rdar://8829590&8770988.

llvm-svn: 123666
2011-01-17 18:58:44 +00:00
Rafael Espindola e79d43da3b Add unnamed_addr to the special strings created by
__builtin___CFStringMakeConstantString
This fixes PR8993. A darwin expert might want to check that this is safe.

llvm-svn: 123658
2011-01-17 16:31:00 +00:00
Anders Carlsson 0acd4cfc33 Remove dead code.
llvm-svn: 123612
2011-01-17 03:13:24 +00:00
Anders Carlsson 5610490cdf Change ParseOptionalCXX0XVirtSpecifierSeq to take a VirtSpecifiers struct.
Enforce C++[class.mem]p8:
A virt-specifier-seq shall contain at most one of each virt-specifier.

llvm-svn: 123611
2011-01-17 03:05:47 +00:00
Francois Pichet 7d92ee3852 Remove a c++ file test I inadvertently added in Sema last week.
llvm-svn: 123608
2011-01-17 01:08:01 +00:00
Francois Pichet 834bfbf147 Revert r123600.
llvm-svn: 123607
2011-01-17 00:56:42 +00:00
Anders Carlsson 11fdbbc1ad Begin work on supporting "N3206: Override control: Eliminating Attributes", from
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm

This lands support for parsing virt-specifier-seq after member functions, including the
contextual keywords 'final', and 'override'. The keywords are not yet used for anything.

llvm-svn: 123606
2011-01-16 23:56:42 +00:00
Anders Carlsson 128ddbf412 Fix a bug where the -Wmissing-noreturn would always treat constructors with base or member initializers as noreturn.
llvm-svn: 123603
2011-01-16 22:12:43 +00:00
Anders Carlsson 36ecb1f208 Add AnalysisContext::dumpCFG.
llvm-svn: 123602
2011-01-16 22:05:23 +00:00
Francois Pichet cb0527c20d Downgrade ext_enumerator_too_large from ExtWarn to Extension in Microsoft mode. Otherwise you can warnings flooding trying to selfhost clang with fms-extensions because of "unsigned int" -> "signed int" enumerator conversion.
llvm-svn: 123600
2011-01-16 21:44:17 +00:00
Douglas Gregor c124e59c90 Emit an extension diagnostic for C99 designated initializers that appear in C++ code
llvm-svn: 123582
2011-01-16 16:13:16 +00:00
Douglas Gregor cef1a03eb5 Tweak the partial ordering rules for function templates to prefer a
non-variadic function template over a variadic one. This matches GCC
and the intent of the C++0x wording, in a way that I think is likely
to be acceptable to the committee.

llvm-svn: 123581
2011-01-16 16:03:23 +00:00
Chris Lattner 906bb9047a improve compatibility with GCC: when generating the ".d" filename to use
and the filename has multiple .'s in it, use the last.  For example, "foo.bar.cpp"
should produce "foo.bar.d" not "foo.d".  Patch by Johan Boule in PR8391

llvm-svn: 123576
2011-01-16 08:14:11 +00:00
Michael J. Spencer a0acb46baa AST/InheritViz: Remove all internal uses of PathV1.
llvm-svn: 123553
2011-01-15 21:43:57 +00:00
Ken Dyck cc56c54889 Add toCharUnitsInBits() to simplify the many calls to CharUnits::fromQuantity() of the form CharUnits::fromQuantity(bitSize, Context.getCharWidth()).
llvm-svn: 123542
2011-01-15 18:38:59 +00:00
Francois Pichet 07a2e14f44 Unbreak the MSVC build again: replace bzero by memset.
llvm-svn: 123538
2011-01-15 13:27:47 +00:00
Rafael Espindola facb7d0ade Also set unnamed_addr on declarations.
llvm-svn: 123531
2011-01-15 08:23:14 +00:00
Chris Lattner 008c0a4a68 clean up some dead code around __has_include() processing code identified by the ted-o-matic.
rdar://8867482

llvm-svn: 123522
2011-01-15 06:57:04 +00:00
Douglas Gregor 5590be0491 Introduce a new kind of TemplateName that captures a substituted
template template parameter pack that cannot be fully expanded because
its enclosing pack expansion could not be expanded. This form of
TemplateName plays the same role as SubstTemplateTypeParmPackType and
SubstNonTypeTemplateParmPackExpr do for template type parameter packs
and non-type template parameter packs, respectively.

We should now handle these multi-level pack expansion substitutions
anywhere. The largest remaining gap in our variadic-templates support
is that we cannot cope with non-type template parameter packs whose
type is a pack expansion.

llvm-svn: 123521
2011-01-15 06:45:20 +00:00
Ted Kremenek b749a6d62a Add initial prototype for implementation of
-Wuninitialized based on CFG dataflow analysis.  WIP.

llvm-svn: 123512
2011-01-15 02:58:47 +00:00
Ted Kremenek 688b674087 Add const version if CFG::isBlkExpr().
llvm-svn: 123511
2011-01-15 02:58:42 +00:00
Argyrios Kyrtzidis a88942ad9c Store/retrieve -fshort-enums for PCH, fixes rdar://8854933.
llvm-svn: 123510
2011-01-15 02:56:16 +00:00
Douglas Gregor 36c0c791a8 Tweak the storage mechanism for a set of overloaded template names in
the TemplateName class. Nothing actually changes, but I find this less
objectionable (and it will factor into an upcoming change).

llvm-svn: 123508
2011-01-15 01:39:24 +00:00
Douglas Gregor cdbc539aee Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,
that captures the substitution of a non-type template argument pack
for a non-type template parameter pack within a pack expansion that
cannot be fully expanded. This follows the approach taken by
SubstTemplateTypeParmPackType.

llvm-svn: 123506
2011-01-15 01:15:58 +00:00
Douglas Gregor e1d60df0fc Teach template template argument pack expansions to keep track of the
number of expansions, when we know it, and propagate that information
through Sema.

llvm-svn: 123493
2011-01-14 23:41:42 +00:00
Douglas Gregor 715e461463 Handle substitutions into function parameter packs whose patterns
contain multiple parameter packs at different levels.

llvm-svn: 123488
2011-01-14 22:40:04 +00:00
Ted Kremenek 8cb349de80 Cleanup confused code that redundantly called "getDeclContext()" twice.
Found by clang static analyzer.

llvm-svn: 123485
2011-01-14 22:31:41 +00:00
Ted Kremenek bea8b40a86 The variable 'ReusedDecl' is written but never read.
Remove this variable (found by clang static analyzer).

llvm-svn: 123484
2011-01-14 22:31:38 +00:00
Ted Kremenek 7f1f3f6e32 The variable 'isTemplateSpecialization' is no longer
used; nuke all assignments and its declaration.

llvm-svn: 123483
2011-01-14 22:31:36 +00:00
Ted Kremenek c2a6412b97 Remove unused store to variable 'Name'. Found by clang static analyzer.
llvm-svn: 123482
2011-01-14 22:31:34 +00:00
Ted Kremenek f6ab5ff7d7 Driver: tweak handling of '--analyze' to invoke
analyzer -cc1 options that are tailored to the
input type.  If the input type is "C++", we should
only run the dead stores checker (for now).  Similarly,
checks specific to Objective-C should only run
on Objective-C Code.

llvm-svn: 123481
2011-01-14 22:31:31 +00:00
Owen Anderson 6216a44d35 Fixed by r123477.
llvm-svn: 123478
2011-01-14 22:19:38 +00:00
Douglas Gregor b884000ba9 Teach PackExpansionExpr to keep track of the number of pack expansions
it will expand to, if known. Propagate this information throughout Sema.

llvm-svn: 123470
2011-01-14 21:20:45 +00:00
Argyrios Kyrtzidis 243aedb6ec Properly propagate #pragma diagnostic mappings from PCH but not command-line warning flags.
Addresses rdar://8435969&8852495

llvm-svn: 123462
2011-01-14 20:54:07 +00:00
Ted Kremenek 44e2c5cdd9 Rename 'RemoveDeadBindings()' to 'removeDeadBindings()'
llvm-svn: 123460
2011-01-14 20:34:15 +00:00
Ted Kremenek 7c211625e0 Rename 'EnterStackFrame()' to 'enterStackFrame()'.
llvm-svn: 123459
2011-01-14 20:34:10 +00:00
Ted Kremenek 95d874fa5d Teach RegionStore::EnterStackFrame() to handle
the case where the called function has fewer
formal arguments than actual arguments.  This
fixes a crash in the analyzer when doing
function call inlining.

Patch by Zhenbo Xu!

llvm-svn: 123458
2011-01-14 20:29:43 +00:00
Douglas Gregor 9f40713ebc When we're instantiating a direct variable initializer that has a pack
expansion in it, we may end up instantiating to an empty
expression-list. In this case, the variable is uninitialized; tweak
the instantiation logic to handle this case. Fixes PR8977.

llvm-svn: 123449
2011-01-14 17:12:22 +00:00
Douglas Gregor 0dca5fdb4e Keep track of the number of expansions to be produced from a type pack
expansion, when it is known due to the substitution of an out
parameter pack. This allows us to properly handle substitution into
pack expansions that involve multiple parameter packs at different
template parameter levels, even when this substitution happens one
level at a time (as with partial specializations of member class
templates and the signatures of member function templates).

Note that the diagnostic we provide when there is an arity mismatch
between an outer parameter pack and an inner parameter pack in this
case isn't as clear as the normal diagnostic for an arity
mismatch. However, this doesn't matter because these cases are very,
very rare and (even then) only typically occur in a SFINAE context.

The other kinds of pack expansions (expression, template, etc.) still
need to support optional tracking of the number of expansions, and we
need the moral equivalent of SubstTemplateTypeParmPackType for
substituted argument packs of template template and non-type template
parameters.

llvm-svn: 123448
2011-01-14 17:04:44 +00:00
John McCall a08ffd22d5 Support the zero-initialization of VLAs when that really means a zero
bit-pattern.  Continue punting on zero-initializing VLAs with a nonzero
pattern.

llvm-svn: 123439
2011-01-14 10:37:58 +00:00
John McCall 5461a7523f When simplifying a cleanup's entry by merging it into a single predecessor,
replace all uses of the entry with the predecessor.  There are no cleanups
relying on this right now, but if we ever want a cleanup with a phi inside
it, this will be important.

llvm-svn: 123438
2011-01-14 10:35:38 +00:00
Chris Lattner fe8b47411e temporarily xfail, this was broken by r123418
llvm-svn: 123430
2011-01-14 05:30:12 +00:00
Douglas Gregor fb322d8c39 Fix a few warnings stemming from my inability to properly fill out
switch() statements.

llvm-svn: 123429
2011-01-14 05:11:40 +00:00
Douglas Gregor ada4b79947 Start implementing support for substitution into pack expansions that
involve template parameter packs at multiple template levels that
occur within the signatures members of class templates (and partial
specializations thereof). This is a work-in-progress that is deficient
in several ways, notably:
  - It only works for template type parameter packs, but we need to
  also support non-type template parameter packs and template template
  parameter packs.
  - It doesn't keep track of the lengths of the substituted argument
  packs in the expansion, so it can't properly diagnose length
  mismatches.

However, this is a concrete step in the right direction.

llvm-svn: 123425
2011-01-14 02:55:32 +00:00
Ken Dyck e9f3517f13 Replace a literal '8' with getCharWidth().
llvm-svn: 123421
2011-01-14 02:01:36 +00:00
Francois Pichet 6cf14d828f Unbreak the MSVC build.
llvm-svn: 123412
2011-01-13 23:35:06 +00:00
Fariborz Jahanian f59e80e0ed Save getObjCGCAttrKind and use it in two places
for efficiancy (still part of //rdar://8761767).
Per John's comment.

llvm-svn: 123401
2011-01-13 21:35:27 +00:00
Ted Kremenek c7ed09378e Rename 'CheckDeadStores.cpp' to 'DeadStoresChecker.cpp'.
llvm-svn: 123395
2011-01-13 20:58:59 +00:00
Ted Kremenek f224820b45 Remove warning in dead stores checker for
dead stores within nested assignments.  I have
never seen an actual bug found by this specific
warning, and it can lead to many false positives.

llvm-svn: 123394
2011-01-13 20:58:56 +00:00
Fariborz Jahanian d133979628 Generate write-barriers for global objc
assigns. // rdar://8761767 

llvm-svn: 123391
2011-01-13 20:00:54 +00:00
Peter Collingbourne 0ff0b37627 Move name mangling support from CodeGen to AST. In the
process, perform a number of refactorings:

- Move MiscNameMangler member functions to MangleContext
- Remove GlobalDecl dependency from MangleContext
- Make MangleContext abstract and move Itanium/Microsoft functionality
  to their own classes/files
- Implement ASTContext::createMangleContext and have CodeGen use it

No (intended) functionality change.

llvm-svn: 123386
2011-01-13 18:57:25 +00:00
Douglas Gregor 018778af3d Only apply the parameter pack matching of C++0x [temp.arg.template]p3
when we're actually matching a template template argument to a
template template parameter. Otherwise, use strict matching.

Fixes <rdar://problem/8859985> clang++: variadics and out-of-line definitions.

llvm-svn: 123385
2011-01-13 18:47:47 +00:00
Douglas Gregor d43037cb70 Fix a test case
llvm-svn: 123382
2011-01-13 18:03:24 +00:00
Douglas Gregor b720ff2f62 When your comments and your code are out-of-sync, the test case is wrong.
llvm-svn: 123379
2011-01-13 17:44:36 +00:00
Douglas Gregor d81c7c1659 Add tests for name mangling of variadic templates.
llvm-svn: 123378
2011-01-13 16:39:34 +00:00
Zhongxing Xu 3a3c0fd2d1 CXXBaseObjectRegion is like FieldRegion. Need to blast through it when
getting the base region. This makes the RemoveDeadBindings() correct.

llvm-svn: 123375
2011-01-13 12:46:31 +00:00
Zhongxing Xu 0d87e0c65b Support inlining base initializers. We still haven't got it completely right,
since the bindings are purged after they are set up. Need to investigate
RemoveDeadBindings algorithm.

llvm-svn: 123374
2011-01-13 12:30:12 +00:00
Zhongxing Xu 02cde7ffa4 Add comments.
llvm-svn: 123370
2011-01-13 07:59:59 +00:00
Ted Kremenek 304b6e4aa1 Fix a corner case in RegionStore where we assign
a struct value to a symbolic index into array.
RegionStore can't actually reason about this,
so we were getting bogus warnings about loading
uninitialized values from the array.  The solution
is invalidate the entire array when we cannot
represent the binding explicitly.

Fixes <rdar://problem/8848957>

llvm-svn: 123368
2011-01-13 06:58:15 +00:00
Ted Kremenek f41bdd7c24 Rename 'HasGeneratedNode' to 'hasGeneratedNode'
and 'getBasePredecessor()' to 'getPredecessor()'.

Also remove a unneeded save-and-restore of
node builder's tag field.

llvm-svn: 123363
2011-01-13 04:36:46 +00:00
Ted Kremenek b86ec25256 Remove unnecessary save-and-restore of the
node builder's 'HasGeneratedNode' field.

llvm-svn: 123362
2011-01-13 04:36:40 +00:00
Ted Kremenek f044bd68e1 Remove CheckerContext's dependence on setting
the node builder's "tag" ivar (which we would
like to remove).

llvm-svn: 123361
2011-01-13 04:36:36 +00:00
John McCall 294c2db42b Ensure an insertion point at the end of a statement-expression.
Fixes PR8967.

llvm-svn: 123360
2011-01-13 02:03:06 +00:00
Chris Lattner 8cf302a1e7 optimize out a temporary sys::Path
llvm-svn: 123359
2011-01-13 01:35:58 +00:00
Rafael Espindola d09776b945 Only add unnamed_addr to definitions.
llvm-svn: 123354
2011-01-13 01:12:55 +00:00
Douglas Gregor 0f836ea213 Allow us to transform pack expansion expressions.
llvm-svn: 123349
2011-01-13 00:19:55 +00:00
Douglas Gregor fd4344b5a6 Implement C++0x [temp.arg.template]p3, which allows slightly fuzzy
matching of variadic template template parameters to template
arguments. This paragraph was the subject of ISO C++ committee
document N2555: Extending Variadic Template Template Parameters.

llvm-svn: 123348
2011-01-13 00:08:50 +00:00
Michael J. Spencer 634f13eacb replace all uses of PathV1::IsSymlink with PathV2::is_symlink.
llvm-svn: 123344
2011-01-12 23:54:48 +00:00
Douglas Gregor 641040afba Refactor and simplify Sema::TemplateParameterListsAreEqual. We had a
bunch of duplicated checks for parameter pack/non-pack mismatches.

llvm-svn: 123343
2011-01-12 23:45:44 +00:00
Douglas Gregor 4478f858b5 Add the location of the right parenthesis of a C++ named cast
(static_cast, dynamic_cast, reinterpret_cast, or const_cast) to
improve source-location information. Fixes PR8960.

llvm-svn: 123336
2011-01-12 22:41:29 +00:00
Douglas Gregor be7b54889f Add IR generation support for SizeOfPackExpr.
llvm-svn: 123332
2011-01-12 22:11:34 +00:00
Douglas Gregor ab2ecacee1 Add some more partial-ordering tests, including one that changes with
the proposed resolution to core isue 692. I'm not certain which way
we'll go on this one.

llvm-svn: 123331
2011-01-12 22:04:05 +00:00
Douglas Gregor e6d6e51686 wint_t is defined as 'unsigned int' on Linux. Fixes PR8938.
llvm-svn: 123320
2011-01-12 21:19:25 +00:00
Anders Carlsson 46a525d456 Update Xcode project.
llvm-svn: 123319
2011-01-12 19:36:11 +00:00
Douglas Gregor 822d030118 Teach TreeTransform how to transform a pack expansion type into
another pack expansion type. This can happen when rebuilding types in
the current instantiation.

Fixes <rdar://problem/8848837> (Clang crashing on libc++ <functional>).

llvm-svn: 123316
2011-01-12 17:07:58 +00:00
Jay Foad 39c7980772 PR3558: mark "logically const" accessor methods in ASTContext as const,
and mark the fields they use as mutable. This allows us to remove a few
const_casts.

llvm-svn: 123314
2011-01-12 09:06:06 +00:00
Zhongxing Xu ebbeb79234 Add some documentation for C++ static analyzer.
llvm-svn: 123313
2011-01-12 07:20:03 +00:00
Zhongxing Xu 9addee2b29 Add cast expr kinds to CheckerVisitor.def.
llvm-svn: 123312
2011-01-12 06:24:01 +00:00
John McCall 20f6ab828a Fix a latent bug where, after emitting an expression statement, we would
delete the block we began emitting into if it had no predecessors.  We never
want to do this, because there are several valid cases during statement
emission where an existing block has no known predecessors but will acquire
some later.  The case in my test case doesn't inherently fall into this 
category, because we could safely emit the case-range code before the statement
body, but there are examples with labels that can't be fallen into 
that would also demonstrate this bug.

rdar://problem/8837067

llvm-svn: 123303
2011-01-12 03:41:02 +00:00
Daniel Dunbar e26e500b79 Driver: Change -dumpversion to return a GCC compatible answer.
- See comment for why.

llvm-svn: 123296
2011-01-12 00:43:47 +00:00
John McCall 553d45aaf3 Slight bugfix to the attribute-distribution logic for GC attributes.
Slight optimization of getObjCGCAttrKind.

llvm-svn: 123295
2011-01-12 00:34:59 +00:00
Rafael Espindola 25f4620c67 Set unnamed_addr in every type info.
llvm-svn: 123293
2011-01-11 23:55:05 +00:00
Francois Pichet c3e73b343c Add a comment for r123231.
llvm-svn: 123291
2011-01-11 23:38:13 +00:00
Douglas Gregor 74c6d19c1f Add TemplateArgument::CreatePackCopy() to create a new parameter pack
in ASTContext-allocated memory, copying the provided template
arguments. Use this new routine where we can. No functionality change.

llvm-svn: 123289
2011-01-11 23:09:57 +00:00
Rafael Espindola bb7f7686c5 Set unnamed_addr in VTTs.
llvm-svn: 123280
2011-01-11 22:29:55 +00:00
Douglas Gregor 2fcb863b2b Implement partial ordering of class template partial specializations
and function templates that contain variadic templates. This involves
three small-ish changes:

  (1) When transforming a pack expansion, if the transformed argument
  still contains unexpanded parameter packs, build a pack
  expansion. This can happen during the substitution that occurs into
  class template partial specialiation template arguments during
  partial ordering. 
 
  (2) When performing template argument deduction where the argument
  is a pack expansion, match against the pattern of that pack
  expansion.

  (3) When performing template argument deduction against a non-pack
  parameter, or a non-expansion template argument, deduction fails if
  the argument itself is a pack expansion (C++0x
  [temp.deduct.type]p22).

llvm-svn: 123279
2011-01-11 22:21:24 +00:00
Rafael Espindola b1e879c80f Set unnamed_addr for type infos that we are confortable marking as hidden. I
think it is safe to mark all type infos with unnamed_addr, but I am not sure.

llvm-svn: 123275
2011-01-11 21:44:37 +00:00
Rafael Espindola 5674c644cf Add unnamed_addr to vtables.
llvm-svn: 123272
2011-01-11 21:10:26 +00:00
Eric Christopher 50c59e9e9a Add back 122079 so we can ignore the argument some more.
llvm-svn: 123271
2011-01-11 20:37:13 +00:00
Argyrios Kyrtzidis 4b7433fab2 [analyzer] Introduce ObjCSelfInitChecker, which checks initialization methods to verify that they assign 'self' to the
result of an initialization call (e.g. [super init], or [self initWith..]) before using any instance variable or
returning 'self'.

llvm-svn: 123264
2011-01-11 19:45:25 +00:00
Argyrios Kyrtzidis 9c23e6c689 [analyzer] Support post-visiting ObjCIvarRefExprs for checkers.
llvm-svn: 123263
2011-01-11 19:45:20 +00:00
Argyrios Kyrtzidis 52f04650ae [analyzer] Add 'bool ignorePrefix' parameter to cocoa::deriveNamingConvention to control whether
the prefix should be ignored.

E.g. if ignorePrefix is true, "_init" and "init" selectors will both be result in InitRule, but if
ignorePrefix is false, only "init" will return InitRule.

llvm-svn: 123262
2011-01-11 19:45:16 +00:00
Argyrios Kyrtzidis 1790c975e7 [analyzer] Add 'isLoad' parameter in Checker::visitLocation() to conveniently distinguish between loads/stores.
llvm-svn: 123261
2011-01-11 19:45:13 +00:00
Douglas Gregor 552c7cf22c Add another test for [temp.func.order]p5/[temp.deduct.partial]p11,
from James Widman.

llvm-svn: 123245
2011-01-11 17:51:55 +00:00
Douglas Gregor b837ea4eee Implement C++ [temp.func.order]p5 more directly, by passing down the
number of explicit call arguments. This actually fixes an erroneous
test for [temp.deduct.partial]p11, where we were considering
parameters corresponding to arguments beyond those that were
explicitly provided.

llvm-svn: 123244
2011-01-11 17:34:58 +00:00
Bob Wilson b9fa00e0c2 Remove special handling for opaque Neon vector types.
Clang does not wrap the vectors in structs anymore so this isn't needed.

llvm-svn: 123241
2011-01-11 16:53:49 +00:00
Ted Kremenek 841df11dab Remove ProgramPoint parameter from GenericNodeBuilder::generateNode().
llvm-svn: 123240
2011-01-11 16:53:44 +00:00
Douglas Gregor 7a7dc6f504 Add example from C++0x [temp.deduct.type]p21, which already works
llvm-svn: 123237
2011-01-11 15:36:52 +00:00
Abramo Bagnara 1339223186 Added warning about invalid register specification for local variables.
llvm-svn: 123236
2011-01-11 15:16:52 +00:00
Francois Pichet bf711d90ed In Microsoft mode, force 64 bit hex integer constants to signed type if the LL or i64 suffix is used. This MSVC behavior.
For example:

void f(long long){ printf("long long"); }
void f(unsigned long long) { printf("unsigned long long"); }
int main() {
   f(0xffffffffffffffffLL);
}
Will print "long long" using MSVC.

This patch also fixes 16 compile errors related to overloading issues when parsing the MSVC 2008 C++ standard lib.

llvm-svn: 123231
2011-01-11 12:23:00 +00:00
Francois Pichet 12df1dc8f2 Microsoft integer suffix changes:
i64 is like LL
i32 is like L

Also set isMicrosoftInteger to true only if the suffix is well formed.

llvm-svn: 123230
2011-01-11 11:57:53 +00:00
Francois Pichet 9b76fa9b07 Rename GenericNodeBuilder to GenericNodeBuilderRefCount to avoid namespace clash using MSVC.
llvm-svn: 123228
2011-01-11 10:41:37 +00:00
Ted Kremenek a00bccc0c5 Rework ExprEngine::processCFGBlockEntrance()
to use a node builder.  This paves the way
for Checkers to interpose (via a "visit" method)
at the entrance to blocks.

llvm-svn: 123217
2011-01-11 06:37:47 +00:00
Ted Kremenek f82068a994 Remove several silly methods from ento::CoreEngine
that just forwarded to ento::SubEngine.

llvm-svn: 123216
2011-01-11 04:49:40 +00:00
Douglas Gregor aec93c6bbe Ensure that the result type of an Objective-C class message send is
complete. However, if it returns a reference type, don't require the
type it refers to to be complete. Fixes <rdar://problem/8807070>.

llvm-svn: 123214
2011-01-11 03:23:19 +00:00
Douglas Gregor 5cde386e5e When mapping from a function parameter pack to the set of function
parameters it expanded to, map exactly the number of function
parameters that were expanded rather than just running to the end of
the instantiated parameter list. This finishes the implementation of
the last sentence of C++0x [temp.deduct.call]p1.

llvm-svn: 123213
2011-01-11 03:14:20 +00:00
Ted Kremenek f4ef3d3ca1 Rename misc. methods in ento::Worklist to start
with lowercase letter.

llvm-svn: 123212
2011-01-11 02:34:50 +00:00
Ted Kremenek 926c96211e Rename misc. methods in GRSubEngine to start
with a lower-case letter.  No functionality change.

llvm-svn: 123211
2011-01-11 02:34:45 +00:00
Douglas Gregor 0dd423ef33 Implement the last bullet of [temp.deduct.type]p5 and part of the last
sentence of [temp.deduct.call]p1, both of which concern the
non-deducibility of parameter packs not at the end of a
parameter-type-list. The latter isn't fully implemented yet; see the
new FIXME.

llvm-svn: 123210
2011-01-11 01:52:23 +00:00
Michael J. Spencer e503f89b4b Replace all uses of PathV1::isDirectory with PathV2::fs::is_directory.
llvm-svn: 123208
2011-01-11 01:21:20 +00:00
Douglas Gregor 180dda9b6e Make sure that we parse a '>>' that closes two template argument lists
appropritely when there are no other template arguments.

llvm-svn: 123204
2011-01-11 00:45:18 +00:00
Douglas Gregor 94a32477fd When we're inside a functional cast, '>' is an operator. Fixes PR8912.
llvm-svn: 123201
2011-01-11 00:33:19 +00:00
Devang Patel bc47498973 Fix debug info for __block variable referenced outside of block.
llvm-svn: 123199
2011-01-11 00:30:27 +00:00
Douglas Gregor 8008ba75a5 Add testing for unexpanded parameter packs in all of the C++
expression kinds. This is (indirectly) a test verifying that the
recursive AST visitor is visiting the children of these expression
nodes.

llvm-svn: 123198
2011-01-11 00:27:36 +00:00
Rafael Espindola 0ee986c1f1 Add unnamed_addr to constructors and destructors.
llvm-svn: 123197
2011-01-11 00:26:26 +00:00
Bob Wilson bd4520b535 Move DefaultABIInfo::classifyReturnType where it belongs. No functional change.
llvm-svn: 123195
2011-01-10 23:54:17 +00:00
Matt Beaumont-Gay 2083ba400f Only traverse template argument locations if we actually have explicit
template arguments.

llvm-svn: 123194
2011-01-10 23:53:06 +00:00
Rafael Espindola b7f60e3474 Add unnamed_addr when creating artificial string globals. For example, in
static const char foo[] = "foo";
static const char *bar = "bar";

the global created to hold "bar" will have it, but foo will not.

llvm-svn: 123192
2011-01-10 22:34:03 +00:00
Douglas Gregor 48d2411597 Implement more of C++0x [temp.arg.explicit]p9, allowing extension of
pack expansions in template argument lists and function parameter
lists. The implementation of this paragraph should be complete
*except* for cases where we're substituting into one of the unexpanded
packs in a pack expansion; that's a general issue I haven't solved yet.

llvm-svn: 123188
2011-01-10 20:53:55 +00:00
Bob Wilson b39017ad19 Fix a comment typo.
llvm-svn: 123184
2011-01-10 18:23:55 +00:00
Bob Wilson ce3ee6539e NEON vector support for ARM is in pretty good shape now. Update the docs.
llvm-svn: 123183
2011-01-10 17:55:14 +00:00
Douglas Gregor b94a6177fc Repent for my copy-and-paste sins, factoring out the code that forms
argument packs from a set of deduced arguments, then checks that those
argument packs match previously-deduced argument packs.

llvm-svn: 123182
2011-01-10 17:53:52 +00:00
Douglas Gregor a8bd0d94f8 Factor out the code to set up template argument deduction for a set of
template argument packs. This also ensures that explicitly-specified
template arguments get properly represented in those cases.

llvm-svn: 123180
2011-01-10 17:35:05 +00:00
Zhongxing Xu b84ec97699 Remove dead code.
llvm-svn: 123168
2011-01-10 11:28:29 +00:00
Zhongxing Xu fb060c9014 Fix CMakeLists.txt.
llvm-svn: 123167
2011-01-10 09:33:41 +00:00
Zhongxing Xu 40c9d8a4c5 Revert r123160. There are linking dependency problems.
llvm-svn: 123166
2011-01-10 09:23:01 +00:00
Douglas Gregor a8bac7f514 Work-in-progress implementation of C++0x [temp.arg.explicit]p9, which
allows an argument pack determines via explicit specification of
function template arguments to be extended by further, deduced
arguments. For example:

template<class ... Types> void f(Types ... values);
void g() { 
  f<int*, float*>(0, 0, 0);   // Types is deduced to the sequence int*, float*, int
}

There are a number of FIXMEs in here that indicate places where we
need to implement + test retained expansions, plus a number of other
places in deduction where we need to correctly cope with the
explicitly-specified arguments when deducing an argument
pack. Furthermore, it appears that the RecursiveASTVisitor needs to be
auditied; it's missing some traversals (especially w.r.t. template
arguments) that cause it not to find unexpanded parameter packs when
it should.

The good news, however, is that the tr1::tuple implementation now
works fully, and the tr1::bind example (both from N2080) is actually
working now. 

llvm-svn: 123163
2011-01-10 07:32:04 +00:00
Douglas Gregor eff85ad41b Unbreak the CMake build.
llvm-svn: 123162
2011-01-10 07:26:53 +00:00
Zhongxing Xu 7d4ab7d915 ExprEngine.cpp and AnalysisConsumer.cpp should not be in the Checkers directory.
llvm-svn: 123160
2011-01-10 05:52:42 +00:00
Zhongxing Xu 03f169ef71 Add some expression kinds to CheckerVisitor.def.
llvm-svn: 123159
2011-01-10 05:39:35 +00:00
Zhongxing Xu 5609e21337 In C++, assignment and compound assignment operators return an lvalue.
llvm-svn: 123158
2011-01-10 03:54:19 +00:00
Zhongxing Xu 0710f5c5e1 The isPrefix() checking is redundant. Lvalue incremental/decremental expressions
are all prefixes.

llvm-svn: 123156
2011-01-10 03:22:57 +00:00
Michael J. Spencer f6efe58d45 Replace all uses of PathV1::exists with PathV2::fs::exists.
llvm-svn: 123150
2011-01-10 02:34:13 +00:00
Zhongxing Xu 7042251985 Fix comment.
llvm-svn: 123147
2011-01-10 02:22:04 +00:00
Francois Pichet 96df71ad90 Don't crash if SpecString is an empty string.
llvm-svn: 123134
2011-01-09 22:32:25 +00:00
Benjamin Kramer 39f987ffd0 Make a helper function static.
llvm-svn: 123118
2011-01-09 13:21:33 +00:00
Alexis Hunt a50dd46ee8 Rename CXXCtorInitializer::BaseOrMember to Initializee, since it will also be
used to store the CXXConstructorDecl in a delegating constructor.

llvm-svn: 123095
2011-01-08 23:01:16 +00:00
Alexis Hunt 1d7926502f Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
more accurate, and makes it make sense for it to hold a delegating constructor
call.

llvm-svn: 123084
2011-01-08 20:30:50 +00:00
Alexis Hunt 4049b8d4cd Check for delegating constructors and (currently) return an error about them.
llvm-svn: 123076
2011-01-08 19:20:43 +00:00
Chandler Carruth b35635e942 Remove a kludge from analysis based warnings that used to detect
temporaries with no-return destructors. The CFG now properly supports
temporaries and implicit destructors which both makes this kludge no
longer work, and conveniently removes the need for it.

Turn on CFG handling of implicit destructors and initializers. Several
ad-hoc benchmarks don't indicate any measurable performance impact from
growing the CFG, and it fixes real correctness problems with warnings.

As a result of turning on these CFG elements, we started to tickle an
inf-loop in the unreachable code logic used for warnings. The fix is
trivial.

llvm-svn: 123056
2011-01-08 06:54:40 +00:00
Ted Kremenek bf4832cda8 Add semantic checking that the "thousands grouping"
prefix in a printf format string is matched
with the appropriate conversion specifier.

llvm-svn: 123055
2011-01-08 05:28:46 +00:00
Ted Kremenek a322cae011 Add printf format string parsing support for '
prefix to format conversions (POSIX extension).

llvm-svn: 123054
2011-01-08 05:28:38 +00:00
Eric Christopher 7d5f2ff6c9 Fix typo.
llvm-svn: 123041
2011-01-07 22:44:49 +00:00
Douglas Gregor b41e2d9298 Variadic templates example: a nearly-complete implementation of a TR1
function class template. 

llvm-svn: 123024
2011-01-07 19:56:20 +00:00