Commit Graph

35953 Commits

Author SHA1 Message Date
Douglas Gregor 7345626a5b Implement return type deduction for lambdas per C++11
[expr.prim.lambda]p4, including the current suggested resolution of
core isue 975, which allows multiple return statements so long as the
types match. ExtWarn when user code is actually making use of this
extension.

llvm-svn: 150168
2012-02-09 10:18:50 +00:00
Douglas Gregor 410d6af994 Restore the appropriate lexical declaration context for a lambda's
function call operator (to the lambda class). This allows us to IRgen
calls to simple (non-capturing) lambdas, e.g.,

  [](int i, int j) -> int { return i + j; }(1, 2)

Eli will be providing test cases as he brings up more IRgen.

llvm-svn: 150166
2012-02-09 08:52:43 +00:00
Douglas Gregor 656bc62a73 Remove the "unsupported" error for lambda expressions. It's annoying,
and rapidly becoming untrue.

llvm-svn: 150165
2012-02-09 08:26:42 +00:00
Douglas Gregor 291af2b7e6 Add a test for the non-aggregaticity of lambda types per C++11
[expr.prim.lambda].

llvm-svn: 150164
2012-02-09 08:15:36 +00:00
Douglas Gregor 8962549164 Implement C++ [expr.prim.lambda]p2, which bans lambda expressions in
unevaluated operands. Be certain that we're marking everything
referenced within a capture initializer as odr-used.

llvm-svn: 150163
2012-02-09 08:14:43 +00:00
Argyrios Kyrtzidis 7456ac44b0 [PCH] Add some comments, per Ted's request.
llvm-svn: 150162
2012-02-09 07:46:54 +00:00
Argyrios Kyrtzidis 5605de7c8b Fix ASTReader::FinishedDeserializing().
We were passing a decl to the consumer after all pending deserializations were finished
but this was not enough; due to processing by the consumer we may end up into yet another
deserialization process but the way FinishedDeserializing() was setup we would not ensure
that everything was fully deserialized before returning to the consumer.

Separate ASTReader::FinishedDeserializing() into two semantic actions.
The first is ensuring that a deserialization process ends up will fully deserialized decls/types even
if the process is started by the consumer.
The second is pushing "interesting" decls to the consumer; we make sure that we don't re-enter this
section recursively be checking a variable.

llvm-svn: 150160
2012-02-09 07:31:52 +00:00
Eric Christopher 39e39c8efe Don't cache the artificial type for the this pointer, there's no
difference in the qual type. This is a workaround for the fact that
the type isn't artificial but the this decl is, however, we don't
have any way of representing it in the current metadata. For now,
however, just don't cache the full type.

Fixes rdar://10831526 and probably a couple of others.

llvm-svn: 150159
2012-02-09 07:26:21 +00:00
Anna Zaks 78edc2fb3c [analyzer] MallocChecker: address a diagnostic "fixme".
llvm-svn: 150158
2012-02-09 06:48:19 +00:00
Richard Smith 4d59eebb49 DR1359: A constexpr constructor does not need to initialize an empty struct or
empty union. This still rejects anonymous member structs or unions which only
contain such empty class types, pending standard wording defining exactly what
an empty class type is.

llvm-svn: 150157
2012-02-09 06:40:58 +00:00
Anna Zaks 2b5bb97986 [analyzer] Add custom path diagnostic to the Malloc Checker.
Very simple so far - we just highlight every allocation and release
site.

llvm-svn: 150156
2012-02-09 06:25:51 +00:00
Anna Zaks 12259b443d [analyzer] MallocChecker cleanup, more tests.
llvm-svn: 150155
2012-02-09 06:25:47 +00:00
Argyrios Kyrtzidis 6c07547b56 [PCH] Set the DeclContext before doing any deserialization, to make sure internal
calls to Decl::getASTContext() by Decl's methods will find the TranslationUnitDecl
without crashing due to a parent declaration context still deserializing.

llvm-svn: 150153
2012-02-09 06:02:44 +00:00
David Blaikie c8233cb740 Correct comment Clang C++ use in production.
This was from way-back-when (r82583) when Clang's C++ support wasn't prime-time
yet. Production quality C++ was tested experimentally from r100119 and turned
on by default in r141063.

Patch by Justin Bogner.

llvm-svn: 150148
2012-02-09 03:57:02 +00:00
Eli Friedman 8631f3e86a Use RAII object for cleanups.
llvm-svn: 150147
2012-02-09 03:47:20 +00:00
Eli Friedman c370a7eec7 Refactor lambda IRGen so AggExprEmitter::VisitLambdaExpr does the right thing.
llvm-svn: 150146
2012-02-09 03:32:31 +00:00
Richard Smith 5a294e6a2c CWG issue 1405: mutable members are allowed in literal types, but can't undergo
lvalue-to-rvalue conversions in constant expressions.

llvm-svn: 150145
2012-02-09 03:29:58 +00:00
Aaron Ballman 3bc84198f4 Attempting to initialize a union member that does not exist no longer crashes.
Patch by Remi Gacogne

llvm-svn: 150144
2012-02-09 03:29:06 +00:00
Eli Friedman 0cfd5bd67f Basic IRGen for LambdaExprs with captures.
llvm-svn: 150141
2012-02-09 03:19:12 +00:00
Eli Friedman 79399e883f A tiny bit more lambda IRGen.
llvm-svn: 150140
2012-02-09 02:56:22 +00:00
Eli Friedman faea56944c Fix a typo in the LambdaExpr class.
llvm-svn: 150139
2012-02-09 02:55:22 +00:00
Douglas Gregor 199cec7673 Implement capture-by-copy for arrays in lambdas.
llvm-svn: 150138
2012-02-09 02:45:47 +00:00
Argyrios Kyrtzidis 6f40eb7e56 [PCH] Avoid using Decl::setAttrs() and Decl::setLexicalDeclContext() from the ASTReaderDecl
directly; they internally call Decl::getASTContext() which may crash if a declaration context
parent is still deserializing.

llvm-svn: 150137
2012-02-09 02:44:08 +00:00
Douglas Gregor fbf19a0eb1 Don't complain about the lack of a constructor for a lambda expression. They are constructed in different ways
llvm-svn: 150136
2012-02-09 02:20:38 +00:00
Douglas Gregor 3d23f78852 When we create a non-static data member in the closure object for a
capture, make sure we actually add the field.

llvm-svn: 150135
2012-02-09 02:12:34 +00:00
Douglas Gregor abecb9ce3c Factor the logic for capturing variables in a lambda into its own
function; it's going to get longer soon. No functionality change.

llvm-svn: 150132
2012-02-09 01:56:40 +00:00
Douglas Gregor ab23d9a9be Along the error path for lambdas, mark the lambda class as invalid and finalize it
llvm-svn: 150130
2012-02-09 01:28:42 +00:00
Douglas Gregor 9390e9cc49 Fix yet one more test
llvm-svn: 150129
2012-02-09 01:26:17 +00:00
Aaron Ballman c2a9493a26 Adding support for warning when a non-C compatible user-defined type is returned from an extern "C" function.
Fixes bug 6143

llvm-svn: 150128
2012-02-09 01:21:34 +00:00
Douglas Gregor 26f4b32f26 Fix tests for r150123
llvm-svn: 150126
2012-02-09 01:02:27 +00:00
Douglas Gregor 8c50e7c5e3 Various interrelated cleanups for lambdas:
- Complete the lambda class when we finish the lambda expression
    (previously, it was left in the "being completed" state)
  - Actually return the LambdaExpr object and bind to the resulting
  temporary when needed.
  - Detect when cleanups are needed while capturing a variable into a
  lambda (e.g., due to default arguments in the copy constructor), and
  make sure those cleanups apply for the whole of the lambda
  expression.
    

llvm-svn: 150123
2012-02-09 00:47:04 +00:00
Anna Zaks a1b227b6a7 [analyzer] MallocChecker: implement pessimistic version of the checker,
which allows values to escape through unknown calls.

Assumes all calls but the malloc family are unknown.

Also, catch a use-after-free when a pointer is passed to a
function after a call to free (previously, you had to explicitly
dereference the pointer value).

llvm-svn: 150112
2012-02-08 23:16:56 +00:00
Anna Zaks cd37bf4ec8 [analyzer] Split the MallocChecker into two versions - pessimistic and
optimistic.

TODO: actually implement the pessimistic version of the checker. Ex: it
needs to assume that any function that takes a pointer might free it.

The optimistic version relies on annotations to tell us which functions
can free the pointer.

llvm-svn: 150111
2012-02-08 23:16:52 +00:00
Ted Kremenek 7df15cd21f Remove explicit delete of PathDiagnosticMacroPiece, as it is now reference counted.
llvm-svn: 150110
2012-02-08 22:48:17 +00:00
Fariborz Jahanian a8395a6edb last piece of metadata to complete modern metadata for
protocol definitions.

llvm-svn: 150106
2012-02-08 22:23:26 +00:00
Douglas Gregor 8390afde4e Minor comment fix
llvm-svn: 150090
2012-02-08 21:19:04 +00:00
Douglas Gregor 03dd13cfb6 Factor C++11 lambda expressions implementation into a separate
file. No functionality change.

llvm-svn: 150089
2012-02-08 21:18:48 +00:00
Douglas Gregor c70fe353ea When computing the type of a local variable reference within a lambda,
only add 'const' for variables captured by copy in potentially
evaluated expressions of non-mutable lambdas. (The "by copy" part was
missing).

llvm-svn: 150088
2012-02-08 20:56:50 +00:00
Douglas Gregor 21f4692c62 When completing a lambda expression, make sure to check and attach the
body of the lambda to the function call operator.

llvm-svn: 150087
2012-02-08 20:17:14 +00:00
Anna Zaks c68bf4c036 [analyzer] MallocChecker: convert from using evalCall to
post visit of CallExpr.

In general, we should avoid using evalCall as it leads to interference
with other checkers.

llvm-svn: 150086
2012-02-08 20:13:28 +00:00
Fariborz Jahanian e18961baaf More rewriting of objective-c moderin abi metadata.
All protocol related metadata is close to completion.

llvm-svn: 150084
2012-02-08 19:53:58 +00:00
Aaron Ballman e1224a5067 Fixing hex floating literal support so that it handles 0x.2p2 properly.
llvm-svn: 150072
2012-02-08 13:36:33 +00:00
Benjamin Kramer 793bd55f5a CodeGen: Move EHPersonality from CGException.h into the cpp file, it has no other users.
While at it make it value-initializable to get rid of static ctors.

llvm-svn: 150070
2012-02-08 12:41:24 +00:00
Richard Smith 90cacbbf3e Implement DR1458: Taking the address of an object of incomplete class type is
not a constant expression, because we can't tell whether the complete class type
will have an overloaded operator&.

llvm-svn: 150066
2012-02-08 08:11:33 +00:00
Craig Topper e5ea3b0239 Remove vperm2f* and vperm2i builtins. Same effect can be achieved with builtin_shufflevector.
llvm-svn: 150064
2012-02-08 07:33:36 +00:00
Richard Smith 3c7ad4e01b Add more testing for r149776.
llvm-svn: 150061
2012-02-08 06:41:34 +00:00
Richard Smith da7c4ba1af Implement the agreed resolution to DR1457: a signed left shift of a 1 bit into
the sign bit doesn't have undefined behavior, but a signed left shift of a 1 bit
out of the sign bit still does. As promised to Howard :)

The suppression of the potential constant expression checking in system headers
is also removed, since the problem it was working around is gone.

llvm-svn: 150059
2012-02-08 06:14:53 +00:00
Eli Friedman 5bc1712940 A little bit of lambda IRGen.
llvm-svn: 150058
2012-02-08 05:34:55 +00:00
Craig Topper fec9f8edb7 Remove vpermilp* builtins. Same effect can be achieved with builtin_shufflevector.
llvm-svn: 150056
2012-02-08 05:16:54 +00:00
Ted Kremenek 8d968ad5c0 Move -Wcovered-switch-default out of -Wswitch (and -Wall), and make it an opt-in warning.
This is a great warning, but it was observed that a ton of real world code violates
it all the time for (semi-)legitimate reasons.  This warnings is fairly pedantic, which is good,
but not for everyone.  For example, there is a fair amount of idiomatic code out there
that does "default: abort()", and similar idioms.

Addresses <rdar://problem/10814651>.

llvm-svn: 150055
2012-02-08 05:08:58 +00:00
Ted Kremenek afa6e249cb Change PathDiagnosticPieces to be reference counted (simplifying their management), and introduce 'PathPieces' as a common container for PathDiagnosticPieces.
llvm-svn: 150054
2012-02-08 04:32:34 +00:00
Ted Kremenek 3116c4e5cd Refactor pieces of PathDiagnostic into its own data structure. No functionality change.
llvm-svn: 150053
2012-02-08 04:32:27 +00:00
Eli Friedman 77dcc726de Make sure template argument deduction is consistently performed in an unevaluated context.
llvm-svn: 150049
2012-02-08 03:07:05 +00:00
Argyrios Kyrtzidis 95c0feb5e0 [libclang] Indexing: When suppressing references, suppress references
of bases in C++ classes. rdar://10768707

llvm-svn: 150048
2012-02-08 03:04:33 +00:00
Eric Christopher b2db8e47e2 Constify the getClassName routine and variables that come out of it,
and then use it for forward decl names.

Part of rdar://10209967 and rdar://10400981

llvm-svn: 150040
2012-02-08 01:53:14 +00:00
Akira Hatanaka c07c4655f1 Do not return records with non trivial destructors or copy constructors in
registers.

llvm-svn: 150035
2012-02-08 01:31:22 +00:00
Argyrios Kyrtzidis a2a299e586 [libclang] For CXXOperatorCallExprs, give a valid source location to the DeclRefExpr
that is referencing the member function, so we can index the referenced function.

Fixes rdar://10762375&10324915 & http://llvm.org/PR11192

llvm-svn: 150033
2012-02-08 01:21:13 +00:00
Fariborz Jahanian 48985804cd modern objc rewriter: mode metadata stuff. wip.
llvm-svn: 150030
2012-02-08 00:50:52 +00:00
John McCall 5ece54ce3f Only complain about __strong __strong id, not __strong SomeStrongTypedef
or __strong __typeof__(some.strong.thing).

llvm-svn: 150029
2012-02-08 00:46:41 +00:00
John McCall 18ce25e1ec Revise the SplitQualType interface to make it its own thing instead of
a typedef of std::pair.  This slightly improves type-safety, but mostly
makes code using it clearer to read as well as making it possible to add
methods to the type.

Add such a method for efficiently single-step desugaring a split type.
Add a method to single-step desugaring a locally-unqualified type.
Implement both the SplitQualType and QualType methods in terms of that.

Also, fix a typo ("ObjCGLifetime").

llvm-svn: 150028
2012-02-08 00:46:36 +00:00
Eric Christopher f76dd56dd3 Whitespace.
llvm-svn: 150026
2012-02-08 00:23:21 +00:00
Eric Christopher 75b90c4a86 Use the new forward declaration scheme for records. Also add more
caching of results after we create them.

Fixes rdar://10809898

llvm-svn: 150025
2012-02-08 00:23:18 +00:00
Devang Patel 00fca3a106 Remove tabs.
llvm-svn: 150021
2012-02-08 00:10:20 +00:00
Sean Callanan 56c198962c If a struct needs to be laid out, and it has not
been completed yet, then complete it if possible.
This fixes some assertion failures encountered by
LLDB.

llvm-svn: 150020
2012-02-08 00:04:52 +00:00
Fariborz Jahanian 67f7c55a9c modern objc abi rewriter: mode protocol metadata
for modern objc abi.

llvm-svn: 150011
2012-02-07 23:31:52 +00:00
Chad Rosier 849a67bba2 Fix indentation and an 80-column violation.
llvm-svn: 150010
2012-02-07 23:24:49 +00:00
Jean-Daniel Dupas 6567f48fd9 non-literal strftime format string is not unsafe.
llvm-svn: 150009
2012-02-07 23:10:53 +00:00
Argyrios Kyrtzidis ea9b81b4c6 [libclang] Do not index implicit C++ member functions. rdar://10769813
llvm-svn: 150007
2012-02-07 22:46:16 +00:00
Benjamin Kramer 7ec12c928a Revert my patches which removed Diagnostic.h includes by moving some operator overloads out of line.
This seems to negatively affect compile time onsome ObjC tests
(which use a lot of partial diagnostics I assume). I have to come
up with a way to keep them inline without including Diagnostic.h
everywhere. Now adding a new diagnostic requires a full rebuild
of e.g. the static analyzer which doesn't even use those diagnostics.

This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99.
This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789.
This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7.
This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f.
This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5.

llvm-svn: 150006
2012-02-07 22:29:24 +00:00
Fariborz Jahanian 4aaf8b15c9 objc rewriter: modern metadata for protocol decls. wip.
llvm-svn: 150002
2012-02-07 20:15:08 +00:00
Chad Rosier 4c17fa7620 In r149662, setDiagnosticMapping was modified to not allow warnings mapped to
MAP_ERROR to be remapped to MAP_WARNING.  These new APIs are being added to 
allow the diagnostic mapping's "no Werror" bit to be set, and potentially 
downgrade anything already mapped to be a warning.

llvm-svn: 150001
2012-02-07 19:55:45 +00:00
David Blaikie 09d20eefaa Make use of const-correct ParseCommandLineOptions
llvm-svn: 150000
2012-02-07 19:36:38 +00:00
Jean-Daniel Dupas 6255bd14f0 Implements support of format_arg attribute on C++ member.
llvm-svn: 149998
2012-02-07 19:01:42 +00:00
Devang Patel 56a321df0b Remove tabs.
llvm-svn: 149996
2012-02-07 18:55:08 +00:00
Devang Patel 37a5c9564d Emit debug info for properites that are not backed by an ivar.
llvm-svn: 149995
2012-02-07 18:40:30 +00:00
Fariborz Jahanian 1167190344 objc rewriter: start supporting modern objective-c abi
in objective-c rewriter. wip.

llvm-svn: 149989
2012-02-07 17:11:38 +00:00
Argyrios Kyrtzidis b6c6a58366 Make parsing of objc @implementations more robust.
Parsing of @implementations was based on modifying global state from
the parser; the logic for late parsing of methods was spread in multiple places
making it difficult to have a robust error recovery.

  -it was difficult to ensure that we don't neglect parsing the lexed methods.
  -it was difficult to setup the original objc container context for parsing the lexed methods
   after completing ParseObjCAtImplementationDeclaration and returning to top level context.

Enhance parsing of @implementations by centralizing it in Parser::ParseObjCAtImplementationDeclaration().
ParseObjCAtImplementationDeclaration now returns only after an @implementation is fully parsed;
all the data and logic for late parsing of methods is now in one place.

This allows us to provide code-completion for late parsed methods with mis-matched braces.
rdar://10775381

llvm-svn: 149987
2012-02-07 16:50:53 +00:00
Aaron Ballman b97a5addd5 Hex literals without a significand no longer crash the lexer. Fixes bug 7910
Patch by Eitan Adler

llvm-svn: 149984
2012-02-07 13:46:03 +00:00
Benjamin Kramer db0fc5131d Print NamedDecls directly to a raw_ostream where possible.
llvm-svn: 149982
2012-02-07 11:57:57 +00:00
Benjamin Kramer 2f56992964 Switch the ObjC*Decl raw_stream overloads to take a reference, for consistency with NamedDecls.
llvm-svn: 149981
2012-02-07 11:57:45 +00:00
Douglas Gregor e31e606ff3 Introduce basic ASTs for lambda expressions. This covers:
- Capturing variables by-reference and by-copy within a lambda
  - The representation of lambda captures
  - The creation of the non-static data members in the lambda class
  that store the captured variables
  - The initialization of the non-static data members from the
  captured variables
  - Pretty-printing lambda expressions

There are a number of FIXMEs, both explicit and implied, including:
  - Creating a field for a capture of 'this'
  - Improved diagnostics for initialization failures when capturing
  variables by copy
  - Dealing with temporaries created during said initialization
  - Template instantiation
  - AST (de-)serialization
  - Binding and returning the lambda expression; turning it into a
  proper temporary
  - Lots and lots of semantic constraints
  - Parameter pack captures

llvm-svn: 149977
2012-02-07 10:09:13 +00:00
Bill Wendling 8392a47174 Use SmallVector instead of std::vector.
llvm-svn: 149976
2012-02-07 09:40:07 +00:00
Bill Wendling cb5b5ff36f Use 'ArrayRef<>' instead of 'std::vector<>&' for passed-in arguments.
llvm-svn: 149975
2012-02-07 09:25:09 +00:00
Bill Wendling 5313685c2d Calculate the .size() of the vector once.
llvm-svn: 149974
2012-02-07 09:06:01 +00:00
Bill Wendling d5a2f4406e Reserve a moderate amount of space for the back-end arguments.
llvm-svn: 149973
2012-02-07 09:05:34 +00:00
Eli Friedman a767941651 Fix a bug in semantic analysis involving anonymous structs and flexible arrays.
llvm-svn: 149966
2012-02-07 05:00:47 +00:00
Eli Friedman 2beed114ba Fix a couple of nasty bugs involving negative enum constants. <rdar://problem/10760113>.
llvm-svn: 149965
2012-02-07 04:34:38 +00:00
Ted Kremenek 987dbdb56e Update test case.
llvm-svn: 149964
2012-02-07 03:56:27 +00:00
Eli Friedman 1b125c3e31 Make FunctionDecl::doesDeclarationForceExternallyVisibleDefinition use the same logic as FunctionDecl::isInlineDefinitionExternallyVisible to figure out whether to emit a definition. Based on work by Anton Yartsev.
llvm-svn: 149963
2012-02-07 03:50:18 +00:00
Ted Kremenek 0298834e46 Create PathDiagnosticCallEnter and PathDiagnosticCallExit, to remark calls in PathDiagnostics from other events. This will
have potential uses later.

llvm-svn: 149960
2012-02-07 02:27:37 +00:00
Ted Kremenek 7d88ff436b Tweak BugReporter extensive diagnostics to not add edges between function calls.
llvm-svn: 149959
2012-02-07 02:26:17 +00:00
Ted Kremenek 8ffd764702 Quote name of function in path diagnostics.
llvm-svn: 149958
2012-02-07 02:26:14 +00:00
Kaelyn Uhrain 1c75d4084d Remove the unused TypoCorrectionConsumer::MaxEditDistance.
MaxEditDistance was effectively unused as it being initialized to the max
unsigned valued but never updated. Removing it avoids conversion
headaches once the "edit distance" of a typo correction is a weighted
composite of several values instead of roughly the number of characters
changed; comparing the weighted composite value to the number of
characters in a typo would require some form of normalization to make it
comparable to the old, character-based notion of edit distance.

llvm-svn: 149953
2012-02-07 01:32:58 +00:00
Bob Wilson 7ecbd32e4e Filter a few more options not recognized by gcc. <rdar://problem/10814020>
These are new options that gcc doesn't recognize so the clang driver needs
to remove them when it falls back to invoking gcc.

llvm-svn: 149951
2012-02-07 01:17:55 +00:00
Eli Friedman 96efec99eb Add C11 FLT_TRUE_MIN and friends. <rdar://problem/10812837>.
llvm-svn: 149949
2012-02-07 01:02:19 +00:00
Anna Zaks e0c7c27473 [analyzer] Allow each CString check to be enabled/disabled
separately.

llvm-svn: 149947
2012-02-07 00:56:14 +00:00
Bill Wendling 7ac747245f Bump up the initial vector size to avoid having to grow the vector more often.
llvm-svn: 149945
2012-02-07 00:54:58 +00:00
Chris Lattner ece0409a1a simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.
llvm-svn: 149943
2012-02-07 00:39:47 +00:00
Chris Lattner 8573dc7e1f tidy up code, make the common case (1-byte strings) come first
llvm-svn: 149942
2012-02-07 00:39:21 +00:00
Ted Kremenek a2bbac3ffc Add basic BugReporter support for CallEnter/CallExit. WIP.
llvm-svn: 149939
2012-02-07 00:24:33 +00:00
Eli Friedman dd053f6fba Misc improvements to the diagnostic when a variable is odr-used in a context that is not allowed to capture variables.
Fixes PR11883.

llvm-svn: 149937
2012-02-07 00:15:00 +00:00
Bill Wendling 9972958a89 Use a more efficient container for these values. Also reserve space when using a
std::vector.

llvm-svn: 149936
2012-02-07 00:13:27 +00:00
Bill Wendling 1e375fa219 Use a SmallVector instead of std::vector. This improves compilation time in
445.gobmk by ~1.7%.

llvm-svn: 149935
2012-02-07 00:04:27 +00:00
Bill Wendling bf21cacef1 Don't recalculate the size of the array each time through the for-loop.
llvm-svn: 149933
2012-02-06 23:46:08 +00:00
Eli Friedman 433aae6927 Minor comment clarification.
llvm-svn: 149931
2012-02-06 23:34:35 +00:00
Eli Friedman 5f0ca248ac Fix a minor regression from my potentially-evaluated expression changes.
llvm-svn: 149930
2012-02-06 23:29:57 +00:00
Devang Patel f93d0b8b28 Relax valid location check. This fixes a clang crash while emitting debug info for properties that are synthesized by the compiler by default.
llvm-svn: 149929
2012-02-06 23:24:13 +00:00
Chris Lattner 02cb1715ec build wide strings with ConstantDataArray, just because we can.
llvm-svn: 149928
2012-02-06 22:52:04 +00:00
Chris Lattner 00a10caeb6 improve the code that handles IR generation of byte-sized string literals to avoid
allocating an std::string.

llvm-svn: 149924
2012-02-06 22:47:00 +00:00
Abramo Bagnara e0a70b2656 Added source location for the template keyword in DependentTemplateSpecializationTypeLoc nodes (DTSTLoc).
The new info is propagated to TSTLoc on template instantiation, getting rid of 3 FIXMEs in TreeTransform.h and another one Parser.cpp.

Simplified code in TypeSpecLocFiller visitor methods for DTSTLoc and DependentNameTypeLoc by removing what now seems to be dead code (adding corresponding assertions). 

llvm-svn: 149923
2012-02-06 22:45:07 +00:00
Chris Lattner 3def9aeaff use cheaper llvm APIs for various bits of IR generation.
llvm-svn: 149916
2012-02-06 22:16:34 +00:00
Chris Lattner 72977a18db simplify code and smallvectorize.
llvm-svn: 149915
2012-02-06 22:00:56 +00:00
Manuel Klimek e716741f8b Canonicalize the base class used in the nested-name-specifier of a generated
assignment operator.

llvm-svn: 149909
2012-02-06 21:51:39 +00:00
Eli Friedman 8f66cdffa0 Fix the result of VarDecl::checkInitIsICE so it is consistently accurate in C++11 mode. PR11928.
llvm-svn: 149908
2012-02-06 21:50:18 +00:00
Ted Kremenek d22b98aad2 Tweak format string checking to work with %@ and ObjC toll-free bridging. <rdar://problem/10814120>
llvm-svn: 149907
2012-02-06 21:45:29 +00:00
Aaron Ballman abc7c5c5b6 Added MSVC visualizers for PointerIntPair and PointerUnions.
Patch by Nikola Smiljanic

llvm-svn: 149896
2012-02-06 20:47:31 +00:00
Eric Christopher 65c05fa79c Rewrite the debug action handling to take -verify into account.
Add a quiet option for dwarfdump and move it out of NDEBUG only.
Still requires an option as we don't want this on by default.

llvm-svn: 149894
2012-02-06 19:43:51 +00:00
Eric Christopher 3622221c87 Update the command line here and update the comment, we're just going
to leave this as a debug only option for now.

llvm-svn: 149890
2012-02-06 19:13:09 +00:00
Abramo Bagnara 9033e2b358 Removed redundant location info from ElaboratedTypeLoc / DependentNameLoc / DependentTSTLoc. Uniformed names referencing elaborated keyword. No intended functionality changes.
llvm-svn: 149889
2012-02-06 19:09:27 +00:00
Fariborz Jahanian adfe905145 objc: fixes a problem in block type comparison involving
enums with underlying type explicitly specified
(feature which is on by default in objective-c). 
// rdar://10798770

llvm-svn: 149888
2012-02-06 19:06:20 +00:00
Devang Patel 60fc242545 Let an ivar directly refer property TAG.
llvm-svn: 149881
2012-02-06 18:20:02 +00:00
Benjamin Kramer 3bb42f38f4 - Turn the other distribution checks into range compares.
- Turn openSUSE version parsing into a StringSwitch
- Add an entry for Fedora release 16 (Verne)

llvm-svn: 149872
2012-02-06 15:33:06 +00:00
Abramo Bagnara 48c05be124 Added location for template keyword in TemplateSpecializationTypeLoc. In the process removed some naming ambiguities.
llvm-svn: 149870
2012-02-06 14:41:24 +00:00
Benjamin Kramer 7c3f09d416 Consolidate the ubuntu detection logic a bit, add an entry for Ubuntu 12.04 aka precise pangolin.
llvm-svn: 149869
2012-02-06 14:36:09 +00:00
Abramo Bagnara 65f7c3dba2 Fixed instantiation of DependentScopeDeclRefExpr.
llvm-svn: 149868
2012-02-06 14:31:00 +00:00
Benjamin Kramer bf8da9d706 Move instantiateTemplateAttribute into the sema namespace, make helpers static.
llvm-svn: 149864
2012-02-06 11:13:08 +00:00
Craig Topper 33aa76c88a Test for r149855.
llvm-svn: 149862
2012-02-06 08:31:19 +00:00
Craig Topper 5b5935d17d Fix vector splat casts to cast element to the appropriate vector element before inserting into the vector. Fixes PR11930.
llvm-svn: 149855
2012-02-06 05:05:50 +00:00
Richard Smith 574e896976 Implement name mangling for scalar value initialization. Reported on IRC by Xeo.
llvm-svn: 149854
2012-02-06 02:54:51 +00:00
Aaron Ballman 746c62bf88 Invalid O levels on the command line no longer have a confusing error.
llvm-svn: 149852
2012-02-06 00:40:31 +00:00
Gregory Szorc 04d612aa12 [clang.py] Implement Type.is_pod
llvm-svn: 149842
2012-02-05 19:42:06 +00:00
Tobias Grosser 6a7644683c [clang.py] Change type -> Type
Names that have corresponding classes in python are commonly started with an
uppercase letter. Let's follow that convention.

llvm-svn: 149831
2012-02-05 12:15:56 +00:00
Tobias Grosser a0022e911e [clang.py] Implement Cursor.enum_type
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149830
2012-02-05 11:42:25 +00:00
Tobias Grosser 062d2a3c89 [clang.py] Implement Cursor.underlying_typedef_type
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149829
2012-02-05 11:42:20 +00:00
Tobias Grosser 13d92a4b8f [clang.py] add TypeKind.VECTOR
Added a missing enumeration.

Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149828
2012-02-05 11:42:14 +00:00
Tobias Grosser 49bd32c1d2 [clang.py] Add CursorKind.{is_translation_unit, is_preprocessing, is_unexposed}
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149827
2012-02-05 11:42:09 +00:00
Tobias Grosser ebb0ae82a2 [clang.py] Implement Cursor.hash
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149826
2012-02-05 11:42:03 +00:00
Tobias Grosser 9fc76f2cbf [clang.py] Expose diagnostic category and option info to Python binding
Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149825
2012-02-05 11:41:58 +00:00
Tobias Grosser fb7b4aa45a [clang.py] Implement __eq__ and __ne__ on SourceLocation and SourceRange
There is no type checking in __eq__, so ctypes will throw if the wrong
Python type is passed in to the C function. Personally, I feel garbage
in means garbage out and it isn't worth testing for this explicitly.

Contributed by: Gregory Szorc <gregory.szorc@gmail.com>

llvm-svn: 149824
2012-02-05 11:40:59 +00:00
Benjamin Kramer a20863e67d Fix a typo (builting -> builtin).
Patch by Afriza N. Arief!

llvm-svn: 149822
2012-02-05 11:24:56 +00:00
Benjamin Kramer 2c0dd81b73 Move operator overload out of line. Calling operator<< on a forward declared type doesn't seem to work on MSVC.
llvm-svn: 149819
2012-02-05 09:46:30 +00:00
Aaron Ballman 0e95d90acc Fixing a warning in MSVC (this is also a test commit)
llvm-svn: 149806
2012-02-05 03:08:16 +00:00
Richard Smith 2de5a939e2 constexpr: Implement DR1358: An instantiation of a constexpr function which
can't produce a constant expression is not ill-formed (so long as some
instantiation of that function can produce a constant expression).

llvm-svn: 149802
2012-02-05 02:30:54 +00:00
Chris Lattner 9c81833c8d reapply the patches reverted in r149477, which enable ConstantDataArray.
llvm-svn: 149801
2012-02-05 02:30:40 +00:00
Dylan Noblesmith 2c1dd2716a Basic: import SmallString<> into clang namespace
(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
NAKAMURA Takumi 9ef84dde49 Try to fix Benjamin's r149781 on MSVC.
MSVC has complained the definition of "inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, CanQualType T)" in clang/AST/CanonicalType.h.

llvm-svn: 149797
2012-02-05 02:00:07 +00:00
Richard Smith c82fae6070 constexpr: Fix implementation of DR1311: check for volatile qualifiers in
lvalue-to-rvalue conversions on the source type of the conversion, not the
target type (which has them removed for non-class types).

llvm-svn: 149796
2012-02-05 01:23:16 +00:00
Bob Wilson 49708d41a6 Preserve alignment for Neon vld1_lane/dup and vst1_lane intrinsics.
We had been generating load/store instructions with the default alignment
for the vector element type, even when the pointer argument had less alignment.
<rdar://problem/10538555>

llvm-svn: 149794
2012-02-04 23:58:08 +00:00
Bob Wilson 6fb01c2c96 Skip freebsd driver test when ppc32/ppc64 targets are not configured.
Otherwise, the clang driver falls back to invoking gcc and the ppc tests
fail.

llvm-svn: 149793
2012-02-04 23:15:59 +00:00
Sebastian Redl 860eb7cf12 A useful approximation of initializer list constructors.
llvm-svn: 149792
2012-02-04 21:27:47 +00:00
Sebastian Redl ab3f7a4e3d Factor out the actual overload resolution from TryConstructorInitialization, since it needs to be used again for list constructor resolution.
llvm-svn: 149791
2012-02-04 21:27:39 +00:00
Sebastian Redl 88e4d4933a Don't unwrap initializer lists before calling TryConstructorInitialization, instead doing a little more work inside. This should make finding initializer list constructors easier, as well as fix one place where the ({}) vs {} issue was probably poorly handled.
llvm-svn: 149790
2012-02-04 21:27:33 +00:00
Sebastian Redl f2089a409e Remove an unused and unimplemented function prototype.
llvm-svn: 149789
2012-02-04 21:27:28 +00:00
Fariborz Jahanian 42d05f2faf Also, these objc++ rewriter tests are meant to run in NeXt's
fragile-abi mode.

llvm-svn: 149788
2012-02-04 19:06:06 +00:00
Fariborz Jahanian 27062dd7d2 These tests are intended to run in NeXt's legacy objective-c abi (fragile-abi).
Make this explicit since default is now nonfragile-abi.

llvm-svn: 149787
2012-02-04 18:56:43 +00:00
Benjamin Kramer 6bc0952b0f Some compilers do require Diagnostic.h to be present here.
llvm-svn: 149785
2012-02-04 14:13:11 +00:00
Benjamin Kramer 1edced6810 Don't include Diagnostics.h twice when it's required zero times.
llvm-svn: 149784
2012-02-04 14:09:30 +00:00
Benjamin Kramer 4903802fbf Move a method from IdentifierTable.h out of line and remove the SmallString include.
Fix all the transitive include users.

llvm-svn: 149783
2012-02-04 13:45:25 +00:00
Benjamin Kramer 02c746de10 Remove Diagnostic.h include from Preprocessor.h.
- Move the offending methods out of line and fix transitive includers.
- This required changing an enum in the PPCallback API into an unsigned.

llvm-svn: 149782
2012-02-04 13:02:15 +00:00
Benjamin Kramer 3307c508c9 Move various diagnostic operator<< overloads out of line and remove includes of Diagnostic.h.
Fix all the files that depended on transitive includes of Diagnostic.h.
With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer.

llvm-svn: 149781
2012-02-04 12:31:12 +00:00
Benjamin Kramer 728ed3f386 Move Storage and StorageAllocator out of the PartialDiagnostic class so we can forward declare them.
Let ASTContext allocate the storage in its BumpPtrAllocator.
This will help us remove ASTContext's depedency on PartialDiagnostic.h soon.

llvm-svn: 149780
2012-02-04 12:30:46 +00:00
Benjamin Kramer 3f85fb2277 StaticAnalyzer: Remove FixIts from PathDiagnosticPieces.
They were unused and pulled in Diagnostic.h for no reason.

llvm-svn: 149779
2012-02-04 12:30:37 +00:00
Richard Smith f4c51d9d76 In C++11 mode, when an integral constant expression is desired and we have a
value of class type, look for a unique conversion operator converting to
integral or unscoped enumeration type and use that. Implements [expr.const]p5.

Sema::VerifyIntegerConstantExpression now performs the conversion and returns
the converted result. Some important callers of Expr::isIntegralConstantExpr
have been switched over to using it (including all of those required for C++11
conformance); this switch brings a side-benefit of improved diagnostics and, in
several cases, simpler code. However, some language extensions and attributes
have not been moved across and will not perform implicit conversions on
constant expressions of literal class type where an ICE is required.

In passing, fix static_assert to perform a contextual conversion to bool on its
argument.

llvm-svn: 149776
2012-02-04 09:53:13 +00:00
Richard Smith 8dd3425077 Don't allow a value of a scoped enumeration to be used as the first bound for an
array new expression. This lays some groundwork for the implicit conversion to
integral or unscoped enumeration which C++11 ICEs undergo.

llvm-svn: 149772
2012-02-04 07:07:42 +00:00
Anna Zaks 88598248f9 [analyzer] Make sure Containers OutOfBounds checker does not crash on undefined arguments, when CF functions are called with wrong number of arguments.
llvm-svn: 149771
2012-02-04 06:40:52 +00:00
Richard Smith 3f333f2edf Disallow constexpr main.
llvm-svn: 149770
2012-02-04 06:10:17 +00:00
Richard Smith bcc9bcb65f Fix a rejects-valid in C++11: array new of a negative size, or overflowing array
new, is well-formed with defined semantics of throwing (a type which can be
caught by a handler for) std::bad_array_new_length, unlike in C++98 where it is
somewhere nebulous between undefined behavior and ill-formed.

If the array size is an integral constant expression and satisfies one of these
criteria, we would previous the array new expression, but now in C++11 mode, we
merely issue a warning (the code is still rejected in C++98 mode, naturally).

We don't yet implement new C++11 semantics correctly (see PR11644), but we do
implement the overflow checking, and (for the default operator new) convert such
expressions to an exception, so accepting such code now does not seem especially
unsafe.

llvm-svn: 149767
2012-02-04 05:35:53 +00:00
Richard Smith 5d8e7593e3 Unbreak failing test added in r149738.
llvm-svn: 149766
2012-02-04 05:33:36 +00:00
Argyrios Kyrtzidis 275a671b2a ArrayRef goodness in MultiplexConsumer, no functionality change.
llvm-svn: 149764
2012-02-04 05:23:00 +00:00
Argyrios Kyrtzidis 3bd71be4af Remove unused field from FixItRecompile.
llvm-svn: 149762
2012-02-04 04:53:03 +00:00
Nick Lewycky 96ed7b62f9 Don't warn on use of default allocator with an over-aligned type when the
allocator is given the pointer to allocate into.

llvm-svn: 149760
2012-02-04 03:30:14 +00:00
Argyrios Kyrtzidis bd6a7d4c6c Fix ASTMerge tests that I broke in my previous commit.
llvm-svn: 149759
2012-02-04 03:26:16 +00:00
Dylan Noblesmith 35952f82bd autoconf: update config header
Sync with the change in r149652.

Also fix the comment to sync with LLVM's config.h header.

llvm-svn: 149748
2012-02-04 02:38:34 +00:00
Anna Zaks 8e009df96e [analyzer] Turn on by default two checkers:
- osx.coreFoundation.containers.IndexOutOfBounds
 - osx.cocoa.SelfInit

llvm-svn: 149747
2012-02-04 02:31:57 +00:00
Anna Zaks 922b86e7e1 [analyzer] fixup to the previous commit.
llvm-svn: 149746
2012-02-04 02:31:53 +00:00
Anna Zaks 00790d9a3b [analyzer] Minor cleanups to the ObjCSelfInitChecker.
(Also renames in other ObjC checkers to create one category of checks.)

llvm-svn: 149745
2012-02-04 02:31:37 +00:00
Sean Callanan 8870a32408 Fixed some testsuite problems introduced by my
last commit.  Sorry for the outage.

llvm-svn: 149744
2012-02-04 02:28:18 +00:00
Nick Lewycky d0ba3793aa Comment mystery code.
llvm-svn: 149742
2012-02-04 02:16:48 +00:00
Nico Weber d1928cb912 Revert r149721. chapuni tells me akyrtzi already fixed the test
by adding a triple, and the typedef makes things worse on windows.

llvm-svn: 149740
2012-02-04 01:50:30 +00:00
Argyrios Kyrtzidis 3d97a9beb9 Use variable in place of multiple CI.getFrontendOpts() calls and use a bit
of ArrayRef goodness. No functionality change.

llvm-svn: 149739
2012-02-04 01:36:04 +00:00
Devang Patel c047c4d15b New test case.
llvm-svn: 149738
2012-02-04 01:30:45 +00:00
Sean Callanan 1ce3a6b650 Clang has existing support for debuggers that
want to provide "po"-like functionality which
treats the result of an expression implicitly as
"id" (if it is not otherwise known) and prints
it as an Objective-C object.

This has in the past been gated by the
"DebuggerSupport" language option, but that is
too general.  Debuggers also provide other commands
like "print" that do not make any assumptions
about whether the object is an Objective-C object.

This patch makes the assumption conditional on a
new language option: DebuggerCastResultToId.  I
have also made corresponding modifications to the
testsuite.

llvm-svn: 149735
2012-02-04 01:29:37 +00:00
Devang Patel a21bbb2423 Create new tag for the property. This is a work in progress.
llvm-svn: 149734
2012-02-04 01:15:04 +00:00
Argyrios Kyrtzidis fcf8d1f82a [libclang] Stick to the silly notion that a forward class/protocol
declaration is a reference. rdar://10749990

llvm-svn: 149733
2012-02-04 01:04:58 +00:00
Eli Friedman 130bbd0302 Suppress the used-but-not-defined warning for static data members while I look into a rather nasty bug in the new odr-use marking code.
llvm-svn: 149731
2012-02-04 00:54:05 +00:00
Richard Smith 74388b4ec0 constexpr:
The recent support for potential constant expressions exposed a bug in the
  implementation of libstdc++4.6, where numeric_limits<int>::min() is defined
  as (int)1 << 31, which isn't a constant expression. Disable the 'constexpr
  function never produces a constant expression' error inside system headers
  to compensate.

llvm-svn: 149729
2012-02-04 00:33:54 +00:00
Devang Patel fb04ece198 Update tests so that they don't rely upon LLVMDebugVersion number.
llvm-svn: 149726
2012-02-03 23:58:39 +00:00
Nick Lewycky 51a009092c Make _mm_cmpgt_epi8 immute to -funsigned-char.
llvm-svn: 149725
2012-02-03 23:57:48 +00:00
Nico Weber bf5e6442e7 Try to get test passing on windows.
Idea by Jean-Daniel Dupas.

llvm-svn: 149721
2012-02-03 23:36:13 +00:00
Eli Friedman a023e0c619 Make explicit captures which cause implicit captures work correctly.
llvm-svn: 149719
2012-02-03 23:06:43 +00:00
Eli Friedman 24af850470 Implement implicit capture for lambda expressions.
Still left: explicit captures in lambdas need to cause implicit capture, and I need to take a look at the diagnostics for some cases.

llvm-svn: 149718
2012-02-03 22:47:37 +00:00
Douglas Gregor 3dd5fe2006 Make sure that the layout-override parser grabs the size, not the data
size. Otherwise, we can end up with bogus layouts.

llvm-svn: 149703
2012-02-03 19:31:51 +00:00
Douglas Gregor 1f79ca839c When a pack expansion occurs in the template argument list of an alias
template without a corresponding parameter pack, don't immediately
substitute the alias template. This is under discussion in the C++
committee, and may become ill-formed, but for now we match GCC.

llvm-svn: 149697
2012-02-03 17:16:23 +00:00
Argyrios Kyrtzidis e340deedbf Add a triple to test/SemaObjC/format-strings-objc.m to make it pass in windows hosts.
llvm-svn: 149696
2012-02-03 17:13:43 +00:00
Hans Wennborg b64a1fa65c Don't warn about anonymous struct/union in C11.
Also, in C, call this a C11 extension rather than a GNU extension.

llvm-svn: 149695
2012-02-03 15:47:04 +00:00
Douglas Gregor 8e07261362 Implement support for a pack expansion into a fixed-length
template. Such pack expansions can easily fail at template
instantiation time, if the expanded parameter packs are of the wrong
length. Fixes <rdar://problem/10040867>, PR9021, and the example that
came up today at Going Native.

llvm-svn: 149685
2012-02-03 07:34:46 +00:00
Anna Zaks 4c1ef976a8 [analyzer] Testing: add automated reference results reset.
llvm-svn: 149682
2012-02-03 06:35:23 +00:00
Bob Wilson 14adb360a7 Fix -ftrap-function fallout from llvm r145714. <rdar://problem/10799325>
That llvm change removed the -trap-func backend option, so that using
-ftrap-function with clang would cause the backend to complain.  Fix it
by adding the trap function name to the CodeGenOptions and passing it through
to the TargetOptions.

llvm-svn: 149679
2012-02-03 06:27:22 +00:00
Argyrios Kyrtzidis 0d9e24b1db Change Lexer::makeFileCharRange() to have it accept a CharSourceRange
instead of a SourceRange, and handle the case where the range is
a char (not token) range.

llvm-svn: 149677
2012-02-03 05:58:29 +00:00
Argyrios Kyrtzidis de044e5bb8 Change the fixed array of FixitHints to a SmallVector to lift off
the limit on the number of fixits.

llvm-svn: 149676
2012-02-03 05:58:22 +00:00
Argyrios Kyrtzidis 2e809ce7b4 Move isSentinelNullExpr() from Sema to ASTContext to make it more widely
available.

llvm-svn: 149675
2012-02-03 05:58:16 +00:00
Ted Kremenek 60bbeb345b Further downgrade -Warc-bridge-casts-disallowed-in-nonarc to a warning (not mapped to an error). We can consider mapping it back to an error later.
llvm-svn: 149670
2012-02-03 05:01:51 +00:00
Richard Smith 922866783b Thread safety analysis:
* When we detect that a CFG block has inconsistent lock sets, point the
   diagnostic at the location where we found the inconsistency, and point a note
   at somewhere the inconsistently-locked mutex was locked.
 * Fix the wording of the normal (non-loop, non-end-of-function) case of this
   diagnostic to not suggest that the mutex is going out of scope.
 * Fix the diagnostic emission code to keep a warning and its note together when
   sorting the diagnostics into source location order.

llvm-svn: 149669
2012-02-03 04:45:26 +00:00
Richard Smith 815b29d7c9 Thread safety analysis: at a CFG join point between a block terminating in a
'continue' and another block, prefer the lockset from the other block, and
diagnose the 'continue' block as being the end of a loop.

llvm-svn: 149666
2012-02-03 03:30:07 +00:00
Chad Rosier 96c755d13c C++ 5.2.10p2 has a note that mentions that, subject to all other restrictions,
a cast to the same type is allowed so long as it does not cast away constness.

Fix for PR11747. Patch by Aaron Ballman. Reviewed by Eli.

llvm-svn: 149664
2012-02-03 02:54:37 +00:00
Eli Friedman 9bb33f572f Refactor capture in blocks to use new-style capture hooks. Start adding a bit of the code for lambdas. The only visible changes are that we use the C++11 odr-used rules to figure out when a variable is captured, and type-checking in lambdas is slightly more accurate.
llvm-svn: 149663
2012-02-03 02:04:35 +00:00
Chad Rosier d1956e46dd [frontend] Don't allow a mapping to a warning override an error/fatal mapping.
rdar://10736625

llvm-svn: 149662
2012-02-03 01:49:51 +00:00
Eli Friedman 07f9df1953 Note whether a lambda is mutable in the LambdaScopeInfo; this information will be necessary to handle references to captured variables.
llvm-svn: 149660
2012-02-03 01:39:09 +00:00
Ted Kremenek 172039a89c Make error about using bridge casts in non-ARC mode a warning that is default mapped to an error. This is to ease the transition of large apps moving from non-ARC to ARC.
llvm-svn: 149659
2012-02-03 01:30:34 +00:00
Anna Zaks 5069aa33b9 Do not show macro expansion in strncat warnings, which can be defined as
a builtin.

llvm-svn: 149657
2012-02-03 01:27:37 +00:00
Fariborz Jahanian c934de67e0 objc: Issue diagnostic when receiver type is a forward class declaration and
it is treated as of 'id' type resulting in multiple method lookup.
// rdar://10686120

llvm-svn: 149653
2012-02-03 01:02:44 +00:00
Rafael Espindola c29af947d6 Replace the old --with-cxx-* configure options with a single --with-gcc-toolchain
that just uses the new toolchain probing logic. This fixes linking with -m32 on
64 bit systems (the /32 dir was not being added to the search).

llvm-svn: 149652
2012-02-03 01:01:20 +00:00
Douglas Gregor 2e12965942 Rename -dependency-graphviz to -dependencncy-dot
llvm-svn: 149645
2012-02-02 23:45:13 +00:00
Eli Friedman 3bda6b1f8e Add some code to accurately perform odr-used marking for variables per the C++11 rules.
llvm-svn: 149641
2012-02-02 23:15:15 +00:00
Fariborz Jahanian 57539cf8c8 Further enhance comment for property in continuation class.
llvm-svn: 149639
2012-02-02 22:37:48 +00:00
Andrew Trick 877d5a712d unnecessary include of TargetMachine.h?
llvm-svn: 149638
2012-02-02 22:36:19 +00:00
Benjamin Kramer b6d6508b16 Initialize the user defined conversion function to null if this is an aggregate initialization from an initializer list.
Found by valgrind.

llvm-svn: 149627
2012-02-02 19:35:29 +00:00
Douglas Gregor 9f93dc7582 Use -isystem rather than relying on -isysroot to work consistently
llvm-svn: 149626
2012-02-02 19:35:15 +00:00
Fariborz Jahanian 24c2ccc254 objc: comment the code which allows narroing of property object
type in continuation class.

llvm-svn: 149625
2012-02-02 19:34:05 +00:00
Douglas Gregor ac8a57787f Yet more data from failing buildbots...
llvm-svn: 149624
2012-02-02 19:30:09 +00:00
Fariborz Jahanian 6a73384b53 objective-c: When redeclaraing in continuation class a 'readonly'
property to 'readwrite', also allow redeclaration of
property type to a narrowring object type.
// rdar://10790488

llvm-svn: 149614
2012-02-02 18:54:58 +00:00
Douglas Gregor 510340fdc2 Drop -verify to get better diagnostics from failing buildbots. Plus, we don't need it here
llvm-svn: 149613
2012-02-02 18:54:34 +00:00
Douglas Gregor 3ec6663be0 Back out my heinous hack that tricked the module generation mechanism
into using non-absolute system includes (<foo>)...

... and introduce another hack that is simultaneously more heineous
and more effective. We whitelist Clang-supplied headers that augment
or override system headers (such as float.h, stdarg.h, and
tgmath.h). For these headers, Clang does not provide a module
mapping. Instead, a system-supplied module map can refer to these
headers in a system module, and Clang will look both in its own
include directory and wherever the system-supplied module map
suggests, then adds either or both headers. The end result is that
Clang-supplied headers get merged into the system-supplied module for
the C standard library.

As a drive-by, fix up a few dependencies in the _Builtin_instrinsics
module.

llvm-svn: 149611
2012-02-02 18:42:48 +00:00
Matt Beaumont-Gay 248bc72737 Pacify gcc's -Wreturn-type
llvm-svn: 149610
2012-02-02 18:35:35 +00:00
Jim Grosbach ff3789a6bb Pass the SourceMgr to the MCContext for cc1as.
llvm-svn: 149608
2012-02-02 17:54:07 +00:00
Alexander Potapenko ef41fd31d4 Move the code that sets the AddressSafety
attribute into CodeGenModule::SetLLVMFunctionAttributesForDefinition().

Previously it resided in CodeGenModule::GetOrCreateLLVMFunction, which
for some reason wasn't called for ObjC class methods, see
http://code.google.com/p/address-sanitizer/issues/detail?id=33

llvm-svn: 149605
2012-02-02 11:49:28 +00:00
Anton Yartsev 79de4d49a6 r149587 reverted
llvm-svn: 149594
2012-02-02 06:06:34 +00:00
Anton Yartsev 3da212585e Fix for PR10657 (http://llvm.org/bugs/show_bug.cgi?id=10657)
extern inline case considered

llvm-svn: 149587
2012-02-02 05:13:59 +00:00
Eli Friedman fa0df83eba Split Sema::MarkDeclarationReferenced into multiple functions; the additional entry points are needed to implement C++11 odr-use marking correctly. No functional change in this patch; I'll actually make the change which fixes the odr-use marking in a followup patch.
llvm-svn: 149586
2012-02-02 03:46:19 +00:00
Anna Zaks 699f55b98c [analyzer] Fix a false positive in the CFArrayCreate check that surfaces
the the code like this (due to x and &x being the same value but
different size):

void* x[] = { ptr1, ptr2, ptr3 };
CFArrayCreate(NULL, (const void **) &x, count, NULL);

llvm-svn: 149579
2012-02-02 01:30:08 +00:00
Richard Smith 84f6dcf2b5 constexpr:
* support the gcc __builtin_constant_p() ? ... : ... folding hack in C++11
  * check for unspecified values in pointer comparisons and pointer subtractions

llvm-svn: 149578
2012-02-02 01:16:57 +00:00
Douglas Gregor 83d46be31e Introduce a -cc1 option "-dependency-graphviz" that determines header
dependencies and outputs them in GraphViz format.

llvm-svn: 149575
2012-02-02 00:54:52 +00:00
Fariborz Jahanian 17612b1dbf objc: don't crash if primary class is missing and continuation class
is declaring ivars. // rdar://10752081

llvm-svn: 149573
2012-02-02 00:49:12 +00:00
Eli Friedman e1ffd49165 Change the check for constant-conversion with width-1 bitfields so it doesn't suppress quite as many cases. Based off a testcase in the gcc testsuite.
llvm-svn: 149572
2012-02-02 00:40:20 +00:00
Dylan Noblesmith 4f4e745725 back out r149504
Too many weird build failures.

llvm-svn: 149571
2012-02-02 00:40:14 +00:00
Ted Kremenek 7f4bd16b53 Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
llvm-svn: 149566
2012-02-02 00:16:13 +00:00
Fariborz Jahanian ccded6e447 objc2: add __has_feature(objc_default_synthesize_properties).
// rdar://10770497

llvm-svn: 149565
2012-02-02 00:15:51 +00:00
Eric Christopher c9e6924fb2 r149474 went a bit too far when combined with type caching. If we want
a full type go ahead and emit it if we currently only have a forward
declaration.

Fixes gdb bots for gdb1090.exp and call-ar-st.exp.

llvm-svn: 149560
2012-02-01 23:39:00 +00:00
Rafael Espindola 6d65d7b63d Reject mismatched "#pragma GCC visibility push" and "#pragma GCC visibility pop".
llvm-svn: 149559
2012-02-01 23:24:59 +00:00
Fariborz Jahanian 30febeb224 Look for declaration of CFBridgingRetain/CFBridgingRetain before
changing the diagnostic. Also use correct spelling for both.

llvm-svn: 149554
2012-02-01 22:56:20 +00:00
Dylan Noblesmith 27b37ab9b1 make: fix installation of generated header files
The PROJ_SRC_DIR != PROJ_OBJ_DIR path was missing the directory
creation logic that was in the path for non-generated headers.
PR11903.

(The oversight was copied and pasted from LLVM's Makefile.rules,
where it apparently existed since time immemorial til it was
corrected in r127325.)

llvm-svn: 149551
2012-02-01 22:23:31 +00:00
Dylan Noblesmith 5b7ba95294 cmake: don't install config.h (v2)
This header is private and shouldn't be used by clients.

(This reverts r149540, reinstating r149496. False alarm.)

llvm-svn: 149550
2012-02-01 22:22:37 +00:00
Eric Christopher 25a11e6dbd Remove duplicated comment.
llvm-svn: 149544
2012-02-01 21:48:10 +00:00
Eric Christopher 034ba7e487 Fix comment.
llvm-svn: 149543
2012-02-01 21:44:56 +00:00
Dylan Noblesmith dc3980a945 cmake: revert r149496
It *looks* like this caused PR11903, somehow.

llvm-svn: 149540
2012-02-01 21:17:55 +00:00
Douglas Gregor 2e15c844a5 Make sure that imported definitions get completed before we add
anything into the corresponding DeclContext. Co-hacked with Sean;
fixes <rdar://problem/10768928>.

llvm-svn: 149535
2012-02-01 21:00:38 +00:00
Benjamin Kramer 72e6ce5aa9 libclang: Mark clang_Cursor_isNull with CINDEX_LINKAGE to make it available on windows.
Patch by Timothy J Fontaine!

llvm-svn: 149533
2012-02-01 20:37:28 +00:00
Argyrios Kyrtzidis 38bacf3429 [libclang] Make sure we don't ever leave a StoredDiagnostic associated with
a SourceManager that has already been deleted, rdar://10768346.

llvm-svn: 149532
2012-02-01 19:54:02 +00:00
Douglas Gregor c48190c10a Add missing dependency to unbreak the CMake build
llvm-svn: 149531
2012-02-01 19:53:01 +00:00