Граф коммитов

30536 Коммитов

Автор SHA1 Сообщение Дата
Daniel Jasper 04abbb2125 When breaking at function calls, indent from function name.
Otherwise (when indenting from the wrapped -> or .), this looks
like a confusing indent.

Before:
aaaaaaa        //
    .aaaaaaa( //
        aaaaaaa);
After:
aaaaaaa        //
    .aaaaaaa( //
         aaaaaaa);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181595 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 13:37:16 +00:00
Dmitri Gribenko daaa468cdd ArrayRef'ize Sema::FindAllocationFunctions
Patch by Robert Wilhelm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181594 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 13:22:23 +00:00
Dmitri Gribenko 8061322dab ArrayRef'ize GenericSelectionExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181592 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 13:06:58 +00:00
Daniel Jasper 89b3a7f76f Always format entire macro definitions.
Thereby, the macro is consistently formatted (including the trailing
escaped newlines) even if clang-format is invoked only on single lines
of the macro.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181590 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 13:00:49 +00:00
Alexander Kornienko dd256314cf Config file support for clang-format, part 2.
Summary:
Adds actual config file reading to the clang-format utility.
Configuration file name is .clang-format. It is looked up for each input file
in its parent directories starting from immediate one. First found .clang-format
file is used. When using standard input, .clang-format is searched starting from
the current directory.
Added -dump-config option to easily create configuration files.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits, jordan_rose, kimgr

Differential Revision: http://llvm-reviews.chandlerc.com/D758

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181589 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 11:56:10 +00:00
Hans Wennborg 15f92bad58 Add support for __wchar_t in -fms-extensions mode.
MSVC provides __wchar_t. This is the same as the built-in wchar_t type
from C++, but it is also available with -fno-wchar and in C.

The commit changes ASTContext to have two different types for this:

  - WCharTy is the built-in type used for wchar_t in C++ and __wchar_t.

  - WideCharTy is the type of a wide character literal. In C++ this is
    the same as WCharTy, and in C  it is an integer type compatible with
    the type in <stddef.h>.

This fixes PR15815.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181587 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 10:08:40 +00:00
Daniel Jasper 6ea933c7e8 Fix bug when formatting overloaded operators.
Before, the actual operator of an overloaded operator declaration was
handled as a binary operator an thus, clang-format could not find valid
formattings for many examples, e.g.:

template <typename AAAAAAA, typename BBBBBBB>
AAAAAAA operator/(const AAAAAAA &a, BBBBBBB &b);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181585 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 07:59:58 +00:00
Richard Smith 25d8c85668 C++1y auto return type: when a function contains no 'return' statements at all,
substitute 'void' into the return type rather than replacing it with 'void', so
that we maintain the 'auto' type sugar.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181584 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 04:31:10 +00:00
Richard Smith 8f19003769 Typo and misc comment fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181583 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 02:36:35 +00:00
Argyrios Kyrtzidis 7eca8d2262 [libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install the ASTWriter that we create as an ASTMutationListener.
Fixes rdar://13833268

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181575 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 01:28:51 +00:00
Dmitri Gribenko 96c2473661 Remove redundant variable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181574 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 01:14:26 +00:00
Dmitri Gribenko 27365ee830 ArrayRef'ize ShuffleVectorExpr::setExprs
But ShuffleVectorExpr should be tail-allocating the storage for expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181572 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 00:43:44 +00:00
Dmitri Gribenko 416c9b318e ArrayRef'ize Sema::CheckMessageArgumentTypes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181571 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 00:27:15 +00:00
Dmitri Gribenko a7b7d0e4bb ArrayRef'ize Sema::FindAllocationOverload
Now tests should pass.  The previous error was caused by a misplaced backing
array for MutableArrayRef that I introduced.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181570 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 00:20:06 +00:00
Dmitri Gribenko ed09bfcf04 Revert my r181563, breaks tests on buildbots
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181568 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10 00:11:18 +00:00
Dmitri Gribenko a36bbac10f ArrayRef'ize Sema::ActOnMemInitializer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181565 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 23:51:52 +00:00
Dmitri Gribenko 8e6b7093c8 ArrayRef'ize Sema::FindAllocationOverload
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181563 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 23:45:53 +00:00
Dmitri Gribenko 7297a2ecbf ArrayRef'ize Sema::BuildCallToObjectOfClassType
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181562 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 23:32:58 +00:00
Adrian Prantl 0a050f7d56 Debug Info: Fix a problem that resulted in missing DW_AT_specifications
for C++ constructors.

If the DIType for a class was generated by
CGDebugInfo::createContextChain(), the cache contains only a
limited DIType wihtout any declarations. Since EmitFunctionStart()
needs to find the canonical declaration for each method, we
construct the complete type before emitting any method.

rdar://problem/13116508

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181561 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 23:16:27 +00:00
David Blaikie f1e08ac58e Debug Info: include address-of ('&') operator and qualified names in template argument lists
This fixes several (7 out of 16) cases of PR14492 in the GDB 7.5 test
suite. It seems GDB was bailing out whenever it had even the slightest
problem with the template argument list (& I assume it didn't like
seeing template value parameters that were just simple names - perhaps
assuming that lone names must be types, not values)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181556 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 22:43:45 +00:00
Richard Smith 0a664b8632 C++1y n3648: parse and reject init-captures for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181553 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 21:36:41 +00:00
Dmitri Gribenko 9e00f12a25 ArrayRef'ize some SemaOverload methods
Patch by Robert Wilhelm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181544 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 21:02:07 +00:00
Reid Kleckner f632730ffb [ms-cxxabi] Implement member pointer conversions
Summary:
This only supports converting along non-virtual inheritance paths by
changing the field offset or the non-virtual base adjustment.

This implements three kinds of conversions:
- codegen for Value conversions
- Constant emission for APValue
- Constant folding for CastExprs

In almost all constant initialization settings
EmitMemberPointer(APValue) is called, except when the expression
contains a reinterpret cast.

reinterpret casts end up being a big corner case because the null value
changes between different kinds of member pointers.

Reviewers: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D741

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181543 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 21:01:17 +00:00
David Blaikie 089db2e3af Debug Info: Remove unnecessary check for dependent array types
This was added, untested (though the relevant crash was tested), in
r128725/PR9600. Removing it doesn't cause failures & nothing I can
imagine could cause this check to ever return 'true' (we should never be
dealing with dependent types here). The subsequent change to check
"isIncompleteType" (r128855/PR9608) makes a lot more sense.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181542 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 20:48:12 +00:00
Ben Langmuir 524387ae3d CodeGen for CapturedStmts
EmitCapturedStmt creates a captured struct containing all of the captured
variables, and then emits a call to the outlined function.  This is similar in
principle to EmitBlockLiteral.

GenerateCapturedFunction actually produces the outlined function.  It is based
on GenerateBlockFunction, but is much simpler.  The function type is determined
by the parameters that are in the CapturedDecl.

Some changes have been added to this patch that were reviewed as part of the
serialization patch and moving the parameters to the captured decl.

Differential Revision: http://llvm-reviews.chandlerc.com/D640


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181536 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 19:17:11 +00:00
Richard Smith 75883618c9 Fix the return type of the complex creal functions. Patch by YunZhong Gao, modified to use _Static_assert and to check __STDC_HOSTED__ by me.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181527 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 17:41:19 +00:00
Fariborz Jahanian f4030ae463 [doc parsing]: make single character command impostures
warn in pedantic mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181523 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 17:18:52 +00:00
Fariborz Jahanian 5cd4c41422 [doc parsing]: So, in this patch, single character
'commands' will not go through typo fixit logic,
preserving the old behavior (no typo, no diagnostics).
// rdar://12381408


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181521 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 16:44:02 +00:00
Fariborz Jahanian 9d6b1cb173 [doc parsing]: don't attempt to fix single character
commands (\t \n are common). \\ rdar://12381408 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181517 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 16:22:31 +00:00
Benjamin Kramer ee3cd95d31 xopintrin.h: Add wrappers for all flavors of _mm_com.
GCC defines only the wrappers, MSVC defines both, we define both now too.
PR15844.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181514 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 15:07:46 +00:00
Benjamin Kramer 61b669b937 Add include guards to prfchwintrin.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181513 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 15:07:39 +00:00
Richard Smith 6391ea2897 Implement C++1y constant initializer rules: in a constant initializer for an
object x, x's subobjects can be constructed by constexpr constructor even if
they are of non-literal type, and can be read and written even though they're
not members of a constexpr object or temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181506 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 07:14:00 +00:00
Ted Kremenek afde200cda [analyzer; alternate arrows] for "loop back" edges add back the extra edge to the closing '}'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181505 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 06:55:41 +00:00
Ted Kremenek 8841c532f2 [analyzer;alternate arrows] adapt 'for' loop aesthetic cleanup to 'while' loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181504 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 06:55:35 +00:00
Nico Weber d7ceab3f31 Objective-C: Correctly encode 'retain' and 'copy' for readonly properties.
clang would omit 'C' for 'copy' properties and '&' for 'retain' properties if
the property was also 'readonly'. Fix this, which makes clang match gcc4.2's
behavior.

Fixes PR15928.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181491 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 23:47:40 +00:00
Argyrios Kyrtzidis f9ba851c9b [PCH] Remove the ASTReaderListener::ReadHeaderFileInfo callback.
This made sense in pre-module era, before merging of HeaderFileInfos was introduced.

Final part of rdar://13840148.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181490 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 23:46:55 +00:00
Argyrios Kyrtzidis d3220dbeea [modules] When building a module, make sure we don't serialize out HeaderFileInfo for headers not belonging to the module.
After r180934 we may initiate module map parsing for modules not related to the module what we are building,
make sure we ignore the header file info of headers from such modules.

First part of rdar://13840148

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181489 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 23:46:46 +00:00
Adrian Prantl f06989b9f3 typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181485 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 23:37:22 +00:00
Dmitri Gribenko 41487f37d3 Comment: use \code...\endcode for code examples
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181481 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 23:09:44 +00:00
Fariborz Jahanian 5b382770ec unbreak buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181479 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 22:52:20 +00:00
Fariborz Jahanian ad91e5431f [doc parsing]: Also do typo correction for
dynamically registered commands. 
// rdar://12381408


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181477 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 22:14:28 +00:00
Fariborz Jahanian abbfa67153 Turn off a warning caused by my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181464 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 20:29:57 +00:00
Fariborz Jahanian 0089bc4dde documentation parsing. Patch to do typo correction for
documentation commands. Patch was reviewed, along with
great suggestions for improvement, by Doug. 
// rdar://12381408


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181458 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 19:21:00 +00:00
Daniel Jasper 4b7b104c2c Further fix to pointer to member formatting.
With style where the *s go with the type:
Before: typedef bool* (Class:: *Member)() const;
After:  typedef bool* (Class::*Member)() const;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181439 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 15:06:58 +00:00
Daniel Jasper 395228fdc3 Fix formatting of pointers to members.
Before: int(S::*func)(void *);
After:  int (S::*func)(void *);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181438 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 14:58:20 +00:00
Daniel Jasper 11e13801d8 Improve line breaking in binary expressions.
If the LHS of a binary expression is broken, clang-format should also
break after the operator as otherwise:
- The RHS can be easy to miss
- It can look as if clang-format doesn't understand operator precedence

Before:
bool aaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa !=
                                 bbbbbbbbbbbbbbbbbb && ccccccccc == ddddddddddd;
After:
bool aaaaaaaaaaaaaaaaaaaaa =
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa != bbbbbbbbbbbbbbbbbb &&
    ccccccccc == ddddddddddd;

As an additional note, clang-format would also be ok with the following
formatting, it just has a higher penalty (IMO correctly so).
bool aaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa !=
                                 bbbbbbbbbbbbbbbbbb &&
                             ccccccccc == ddddddddddd;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181430 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 14:12:04 +00:00
Reid Kleckner 3190ca922d Forward #pragma comment(lib/linker) through as flags metadata
Summary:
Most of this change is wiring the pragma all the way through from the
lexer, parser, and sema to codegen.  I considered adding a Decl AST node
for this, but it seemed too heavyweight.

Mach-O already uses a metadata flag called "Linker Options" to do this
kind of auto-linking.  This change follows that pattern.

LLVM knows how to forward the "Linker Options" metadata into the COFF
.drectve section where these flags belong.  ELF support is not
implemented, but possible.

This is related to auto-linking, which is http://llvm.org/PR13016.

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D723

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181426 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 13:44:39 +00:00
Daniel Jasper b2f063aeb9 Change indentation of multi-line nested name specifiers.
Before:
aaaaaaaa::
    aaaaaaaa::
    aaaaaaaa();
After:
aaaaaaaa::
    aaaaaaaa::
        aaaaaaaa();

The reason for the change is that:
a) we are not sure which is better
b) it is a really rare edge case
c) it simplifies the code
d) it currently causes problems with memoization

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181421 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 10:00:18 +00:00
Timur Iskhodzhanov 2fca8027fd Fix one FIXME in VTableBuilder
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181396 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 08:09:21 +00:00
David Blaikie 3923d6a87f Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions.
Basic support is implemented here - it still doesn't account for
declared-but-not-defined variables or functions. It cannot handle out of
order (declared, 'using', then defined) cases for variables, but can
handle that for functions (& can handle declared, 'using'd, and not
defined at all cases for types).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181393 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-08 06:01:46 +00:00