Commit Graph

4306 Commits

Author SHA1 Message Date
Abramo Bagnara 4910701339 Added forgotten break.
llvm-svn: 165298
2012-10-05 04:43:29 +00:00
Abramo Bagnara aeeb989cc4 Fixed FunctionTypeLoc source range.
llvm-svn: 165259
2012-10-04 21:42:10 +00:00
Nick Lewycky 37eb038a66 Add missing comment for mangling.
llvm-svn: 165202
2012-10-04 04:58:17 +00:00
Benjamin Kramer daa0961244 CodeGen: Fix a silly typo when emitting subs of block addresses.
Part of PR14005.

llvm-svn: 165117
2012-10-03 14:15:39 +00:00
Nico Weber 90a415e7ca When mangling an APSInt with the ms abi, make sure to look at all nibbles.
Currently, it's ignored if the number of set bits isn't divisible by 4.

llvm-svn: 165116
2012-10-03 13:39:49 +00:00
Nico Weber 7dfc8be995 While I'm here, resync a %select with the enum definition it selects on.
* nullptr used to be mapped to ERROR, now mapped to nullptr
* integral was missing
* expressions now have their own error message, so they won't reach
  this. Map them to ERROR.

Note that clang usually crashes before emitting this diagnostic anyway
(see PR13984), so this change alone doesn't have an observable effect.
It makes the code more correct though.

llvm-svn: 165095
2012-10-03 06:57:02 +00:00
Nico Weber a682681058 Move expression mangling in the microsoft mangler to its own function.
This matches what's done in ItaniumMangle and makes it a bit easier
to implement mangling for more expressions. Also use the slightly nicer
"not yet implemented" error message from there.

No functionality change (except for the different error message).

llvm-svn: 165093
2012-10-03 06:46:47 +00:00
Nico Weber 1dc7e03047 Replace a default: with an explicit list of cases. No functionality change.
llvm-svn: 165091
2012-10-03 06:12:27 +00:00
Argyrios Kyrtzidis 72d1aa3cff Introduce ASTConsumer::HandleImplicitImportDecl() callback that is invoked
when an ImportDecl that was implicitly created due to an inclusion directive.

llvm-svn: 165084
2012-10-03 01:58:37 +00:00
Jordan Rose 7bb2611400 Teach getCXXRecordDeclForPointerType about references.
Then, rename it getPointeeCXXRecordDecl and give it a nice doc comment,
and actually use it.

No intended functionality change.

llvm-svn: 165077
2012-10-03 01:08:28 +00:00
Lang Hames 5de91cc35f Add FP_CONTRACT support for clang.
Clang will now honor the FP_CONTRACT pragma and emit LLVM
fmuladd intrinsics for expressions of the form A * B + C (when they occur in a
single statement).

llvm-svn: 164989
2012-10-02 04:45:10 +00:00
Richard Smith cdd1da209d Fix treatment of case which came up on std-proposals@: 'void' is permitted in core constant expressions, despite not being a literal type.
llvm-svn: 164968
2012-10-01 20:36:17 +00:00
Anna Zaks 97c7ce3368 Move isObjCSelf into Expr.
llvm-svn: 164966
2012-10-01 20:34:04 +00:00
Dmitri Gribenko 6743e04699 Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.

llvm-svn: 164892
2012-09-29 11:40:46 +00:00
Richard Trieu b7243855d9 Update template type diffing to handle qualifiers. Differing qualifiers will
now be printed with highlighting.

llvm-svn: 164843
2012-09-28 20:32:51 +00:00
Richard Smith 80ac9efec4 Allow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl Coosemans!
llvm-svn: 164841
2012-09-28 20:20:52 +00:00
Richard Trieu 8e14cacfb9 Clean up part of template type diffing. Moved repeated code to separate
functions.  Reworked one of the conditionals.  No functional changes.

llvm-svn: 164839
2012-09-28 19:51:57 +00:00
Eli Friedman c681e5f608 Fix a regression from r164656.
llvm-svn: 164804
2012-09-27 22:13:33 +00:00
Anna Zaks 454477cd07 Make getDefaultSynthIvarName() a member of ObjCPropertyDecl.
llvm-svn: 164789
2012-09-27 19:45:11 +00:00
Benjamin Kramer 75ee95fa95 Pass PrintingPolicy by reference, copying it isn't cheap.
llvm-svn: 164781
2012-09-27 17:37:30 +00:00
Eli Friedman b826a00857 Fix the AST representation for non-type template arguments to encode
enough information so we can mangle them correctly in cases involving
dependent parameter types. (This specifically impacts cases involving
null pointers and cases involving parameters of reference type.)
Fix the mangler to use this information instead of trying to scavenge
it out of the parameter declaration.

<rdar://problem/12296776>.

llvm-svn: 164656
2012-09-26 02:36:12 +00:00
Richard Smith 6e0605d654 Teach Type::getAs<TemplateSpecializationType> that a TemplateSpecializationType
for a type alias template can appear as sugar at any level of desugaring, just
like a TypedefType.

llvm-svn: 164655
2012-09-26 02:18:13 +00:00
Argyrios Kyrtzidis 2f45853f2f Improve upon r164450 and localize the logic of updating the type of
a function decl inside the ASTNodeImporter::VisitFunctionDecl function.

llvm-svn: 164625
2012-09-25 19:26:39 +00:00
John McCall f652e9a6b0 Implement Mike Herrick's proposed noexcept mangling.
llvm-svn: 164593
2012-09-25 09:10:17 +00:00
John McCall bf4a7d7193 Add the Microsoft __is_interface_class type trait.
Patch by Andy Gibbs!

llvm-svn: 164591
2012-09-25 07:32:49 +00:00
Eli Friedman bdd5753bda Handle C++ functional casts in a similar way to C-style casts in
unused expression warnings.  <rdar://problem/12359208>.

llvm-svn: 164569
2012-09-24 23:02:26 +00:00
Dmitri Gribenko 1da8886915 Comment sema: warn when comment has \deprecated but declaration does not have a
deprecation attribute ('deprecated', 'availability' or 'unavailable').

This warning is under a separate flag, -Wdocumentation-deprecated-sync, so it
can be turned off easily while leaving other -Wdocumentation warnings on.

llvm-svn: 164467
2012-09-22 21:47:50 +00:00
Argyrios Kyrtzidis b41791d848 When importing a FunctionProtoType::ExtProtoInfo, its ExceptionSpecDecl can point to the
FunctionDecl that we are importing the FunctionProtoType for, in which case we'll have
infinite recursion when importing.

Initially create a FunctionProtoType with null ExceptionSpecDecl/ExceptionSpecTemplate and
update the type in ASTNodeImporter::VisitFunctionDecl after the FunctionDecl has been created.

llvm-svn: 164450
2012-09-22 01:58:06 +00:00
Argyrios Kyrtzidis 89df5ecaf2 Fix build errors.
llvm-svn: 164417
2012-09-21 22:17:13 +00:00
Argyrios Kyrtzidis 9c71b1e0be [AST importer] Do a correct import of a FunctionProtoType::ExtProtoInfo, don't pass
nodes from the imported ASTContext.

rdar://12348924

llvm-svn: 164416
2012-09-21 22:04:02 +00:00
Benjamin Kramer 8a52676b85 StmtPrinter: Print floating point literals with the right suffix to disambiguate them from integers.
Based on a patch by Olaf Krzikalla, UDL fixes by me.

llvm-svn: 164303
2012-09-20 14:07:17 +00:00
Eli Friedman d564afb0ad Add the TypeSourceInfo for the lambda call operator to the lambda's
definition info; it needs to be there because the mangler needs to
access it before we're finished defining the lambda class.
PR12808.

llvm-svn: 164186
2012-09-19 01:18:11 +00:00
Dmitri Gribenko 49fdf8d3f5 Comment parsing: don't treat typedef to a typedef to a function as a
'function-like' type that can be annotated with \param.

Thanks to Eli Friedman for noticing!

llvm-svn: 163985
2012-09-15 21:13:36 +00:00
Dmitri Gribenko a664e5b88f Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.
llvm-svn: 163983
2012-09-15 20:20:27 +00:00
Argyrios Kyrtzidis 617108990d In StringLiteral::setString make sure that we copy the number of
bytes of the buffer and not the size of the string, otherwise we
may overwrite the buffer if there is a mismatch between the size
of the string and the CharByteWidth, and assertions are disabled.

The bug where this could occur was fixed in r163931.
Related to rdar://12069503

llvm-svn: 163939
2012-09-14 21:17:41 +00:00
Dmitri Gribenko ad45ad6fe9 Comment parsing: don't parse comment marker followed by a digit as a command
since no Doxygen command starts with a digit.

llvm-svn: 163909
2012-09-14 16:35:35 +00:00
Dmitri Gribenko b37d5e8a95 Comment parsing: handle \deprecated command. It is a block command, but it
should be fine to use it without further explanations in the attached
paragraph, so the warning about empty paragraph was turned off for it.

llvm-svn: 163836
2012-09-13 20:36:01 +00:00
Ted Kremenek 26774b15f6 Convert a few more getAs cases to castAs where we immediately call a member function.
llvm-svn: 163684
2012-09-12 06:50:29 +00:00
Richard Smith b15fe3a5e4 PR13811: Add a FunctionParmPackExpr node to handle references to function
parameter packs where the reference is not being expanded but the pack has
been. Previously, Clang would segfault in such cases.

llvm-svn: 163672
2012-09-12 00:56:43 +00:00
Dmitri Gribenko 9304d86329 Comment parsing: handle non-builtin commands correctly. After semantic
analysis registers a command, it becomes a "known" command for the lexer, since
it has an ID.  Having this freedom of choice to register a command is a good
thing since BriefParser does not need this.

But the parser should still invoke the correct semantic analysis method
(actOnUnknownCommand) in this case.

llvm-svn: 163646
2012-09-11 19:22:03 +00:00
Douglas Gregor 18e1b52964 Switch a SmallPtrSet/SmallVector pair over to SetVector.
llvm-svn: 163600
2012-09-11 07:19:42 +00:00
Eli Friedman de4f470125 Fix buffer overflow.
llvm-svn: 163578
2012-09-11 00:36:26 +00:00
Argyrios Kyrtzidis f89a92702f [PCH] When loading fields from external storage make sure to also
load in the IndirectField declarations as well.

Field designators in initializer lists depend on traversing the fields
decl chain to find the indirect fields.

Fixes rdar://12239321

llvm-svn: 163552
2012-09-10 22:04:22 +00:00
Dmitri Gribenko 76bb5cabfa Remove redundant semicolons which are null statements.
llvm-svn: 163546
2012-09-10 21:20:09 +00:00
Dmitri Gribenko 7acbf00f96 Comment AST: TableGen'ize all command lists in CommentCommandTraits.cpp.
Now we have a list of all commands.  This is a good thing in itself, but it
also enables us to easily implement typo correction for command names.

With this change we have objects that contain information about each command,
so it makes sense to resolve command name just once during lexing (currently we
store command names as strings and do a linear search every time some property
value is needed).  Thus comment token and AST nodes were changed to contain a
command ID -- index into a tables of builtin and registered commands.  Unknown
commands are registered during parsing and thus are also uniformly assigned an
ID.  Using an ID instead of a StringRef is also a nice memory optimization
since ID is a small integer that fits into a common bitfield in Comment class.

This change implies that to get any information about a command (even a command
name) we need a CommandTraits object to resolve the command ID to CommandInfo*.
Currently a fresh temporary CommandTraits object is created whenever it is
needed since it does not have any state.  But with this change it has state --
new commands can be registered, so a CommandTraits object was added to
ASTContext.

Also, in libclang CXComment has to be expanded to include a CXTranslationUnit
so that all functions working on comment AST nodes can get a CommandTraits
object.  This breaks binary compatibility of CXComment APIs.

Now clang_FullComment_getAsXML(CXTranslationUnit TU, CXComment CXC) doesn't
need TU parameter anymore, so it was removed.  This is a source-incompatible
change for this C API.

llvm-svn: 163540
2012-09-10 20:32:42 +00:00
Dmitri Gribenko 1d0f567f64 RawCommentList: don't copy the whole new RawComment to LastComment each time.
We just need a single SourceLocation for previous comment end.

llvm-svn: 163482
2012-09-09 20:47:31 +00:00
Abramo Bagnara 136404985c Added missing const.
llvm-svn: 163477
2012-09-09 10:21:24 +00:00
Abramo Bagnara 0678294dba Fixed support for disabled wchar_t and added an appropriate test.
llvm-svn: 163476
2012-09-09 10:13:32 +00:00
Richard Smith 1fde8ece37 PR9023: A template template parameter whose template parameter list contains an
unexpanded parameter pack is a pack expansion. Thus, as with a non-type template
parameter which is a pack expansion, it needs to be expanded early into a fixed
list of template parameters.

Since the expanded list of template parameters is not itself a parameter pack,
it is permitted to appear before the end of the template parameter list, so also
remove that restriction (for both template template parameter pack expansions and
non-type template parameter pack expansions).

llvm-svn: 163369
2012-09-07 02:06:42 +00:00
Roman Divacky e637711ae0 Dont cast away const needlessly. Found by gcc48 -Wcast-qual.
llvm-svn: 163325
2012-09-06 15:59:27 +00:00