]> granicus.if.org Git - clang/log
clang
11 years ago[analyzer] Indirect invalidation counts as an escape for leak checkers.
Jordan Rose [Fri, 10 May 2013 17:07:16 +0000 (17:07 +0000)]
[analyzer] Indirect invalidation counts as an escape for leak checkers.

Consider this example:

  char *p = malloc(sizeof(char));
  systemFunction(&p);
  free(p);

In this case, when we call systemFunction, we know (because it's a system
function) that it won't free 'p'. However, we /don't/ know whether or not
it will /change/ 'p', so the analyzer is forced to invalidate 'p', wiping
out any bindings it contains. But now the malloc'd region looks like a
leak, since there are no more bindings pointing to it, and we'll get a
spurious leak warning.

The fix for this is to notice when something is becoming inaccessible due
to invalidation (i.e. an imperfect model, as opposed to being explicitly
overwritten) and stop tracking it at that point. Currently, the best way
to determine this for a call is the "indirect escape" pointer-escape kind.

In practice, all the patch does is take the "system functions don't free
memory" special case and limit it to direct parameters, i.e. just the
arguments to a call and not other regions accessible to them. This is a
conservative change that should only cause us to escape regions more
eagerly, which means fewer leak warnings.

This isn't perfect for several reasons, the main one being that this
example is treated the same as the one above:

  char **p = malloc(sizeof(char *));
  systemFunction(p + 1);
  // leak

Currently, "addresses accessible by offsets of the starting region" and
"addresses accessible through bindings of the starting region" are both
considered "indirect" regions, hence this uniform treatment.

Another issue is our longstanding problem of not distinguishing const and
non-const bindings; if in the first example systemFunction's parameter were
a char * const *, we should know that the function will not overwrite 'p',
and thus we can safely report the leak.

<rdar://problem/13758386>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181607 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCodegen tests for captured statements with templates
Wei Pan [Fri, 10 May 2013 14:15:18 +0000 (14:15 +0000)]
Codegen tests for captured statements with templates

Differential-revision: llvm-reviews.chandlerc.com/D778

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181598 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen breaking at function calls, indent from function name.
Daniel Jasper [Fri, 10 May 2013 13:37:16 +0000 (13:37 +0000)]
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

11 years agoArrayRef'ize Sema::FindAllocationFunctions
Dmitri Gribenko [Fri, 10 May 2013 13:22:23 +0000 (13:22 +0000)]
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

11 years agoUpdated clang-format help messages for -offset and -length
Alexander Kornienko [Fri, 10 May 2013 13:18:17 +0000 (13:18 +0000)]
Updated clang-format help messages for -offset and -length

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181593 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRef'ize GenericSelectionExpr
Dmitri Gribenko [Fri, 10 May 2013 13:06:58 +0000 (13:06 +0000)]
ArrayRef'ize GenericSelectionExpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181592 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoMinor clarifications in help messages and a comment.
Alexander Kornienko [Fri, 10 May 2013 13:04:20 +0000 (13:04 +0000)]
Minor clarifications in help messages and a comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181591 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAlways format entire macro definitions.
Daniel Jasper [Fri, 10 May 2013 13:00:49 +0000 (13:00 +0000)]
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

11 years agoConfig file support for clang-format, part 2.
Alexander Kornienko [Fri, 10 May 2013 11:56:10 +0000 (11:56 +0000)]
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

11 years agoAdd caseStmt(), defaultStmt(), eachCase() and hasCaseConstant() matchers.
Peter Collingbourne [Fri, 10 May 2013 11:52:02 +0000 (11:52 +0000)]
Add caseStmt(), defaultStmt(), eachCase() and hasCaseConstant() matchers.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181588 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd support for __wchar_t in -fms-extensions mode.
Hans Wennborg [Fri, 10 May 2013 10:08:40 +0000 (10:08 +0000)]
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

11 years agoFix bug when formatting overloaded operators.
Daniel Jasper [Fri, 10 May 2013 07:59:58 +0000 (07:59 +0000)]
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

11 years agoC++1y auto return type: when a function contains no 'return' statements at all,
Richard Smith [Fri, 10 May 2013 04:31:10 +0000 (04:31 +0000)]
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

11 years agoTypo and misc comment fix.
Richard Smith [Fri, 10 May 2013 02:36:35 +0000 (02:36 +0000)]
Typo and misc comment fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181583 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] When parsing with CXTranslationUnit_ForSerialization, make sure to install...
Argyrios Kyrtzidis [Fri, 10 May 2013 01:28:51 +0000 (01:28 +0000)]
[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

11 years agoRemove redundant variable
Dmitri Gribenko [Fri, 10 May 2013 01:14:26 +0000 (01:14 +0000)]
Remove redundant variable

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181574 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRef'ize ShuffleVectorExpr::setExprs
Dmitri Gribenko [Fri, 10 May 2013 00:43:44 +0000 (00:43 +0000)]
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

11 years agoArrayRef'ize Sema::CheckMessageArgumentTypes
Dmitri Gribenko [Fri, 10 May 2013 00:27:15 +0000 (00:27 +0000)]
ArrayRef'ize Sema::CheckMessageArgumentTypes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181571 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRef'ize Sema::FindAllocationOverload
Dmitri Gribenko [Fri, 10 May 2013 00:20:06 +0000 (00:20 +0000)]
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

11 years agoRevert my r181563, breaks tests on buildbots
Dmitri Gribenko [Fri, 10 May 2013 00:11:18 +0000 (00:11 +0000)]
Revert my r181563, breaks tests on buildbots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181568 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRef'ize Sema::ActOnMemInitializer
Dmitri Gribenko [Thu, 9 May 2013 23:51:52 +0000 (23:51 +0000)]
ArrayRef'ize Sema::ActOnMemInitializer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181565 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRef'ize Sema::FindAllocationOverload
Dmitri Gribenko [Thu, 9 May 2013 23:45:53 +0000 (23:45 +0000)]
ArrayRef'ize Sema::FindAllocationOverload

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181563 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRef'ize Sema::BuildCallToObjectOfClassType
Dmitri Gribenko [Thu, 9 May 2013 23:32:58 +0000 (23:32 +0000)]
ArrayRef'ize Sema::BuildCallToObjectOfClassType

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181562 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDebug Info: Fix a problem that resulted in missing DW_AT_specifications
Adrian Prantl [Thu, 9 May 2013 23:16:27 +0000 (23:16 +0000)]
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

11 years agoRemove dependence on system headers from this test, to try to make the Windows bots...
Richard Smith [Thu, 9 May 2013 22:45:27 +0000 (22:45 +0000)]
Remove dependence on system headers from this test, to try to make the Windows bots happier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181558 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDebug Info: include address-of ('&') operator and qualified names in template argumen...
David Blaikie [Thu, 9 May 2013 22:43:45 +0000 (22:43 +0000)]
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

11 years agoFix some test cases I broke in r181552
David Blaikie [Thu, 9 May 2013 22:11:34 +0000 (22:11 +0000)]
Fix some test cases I broke in r181552

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181554 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoC++1y n3648: parse and reject init-captures for now.
Richard Smith [Thu, 9 May 2013 21:36:41 +0000 (21:36 +0000)]
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

11 years agoDebugInfo: Simply & constrain test(s) for PR9600/PR9608
David Blaikie [Thu, 9 May 2013 21:32:04 +0000 (21:32 +0000)]
DebugInfo: Simply & constrain test(s) for PR9600/PR9608

Both these tests were ultimately fixed by the check for
"isIncompleteType" & neither test case was really reduced to a minimal
form. On doing so it becomes apparent that the problem wasn't specific
to templates at all, so I've moved the test case to a more appropriate
test file and added FileCheck verification to it (to show the forward
declaration of the array element type as well as the array alignment and
size being 0 since it cannot be computed). That's about as far down this
rabbithole as I'm willing to go today, so the rest of the un-FileChecked
tests in test/CodeGenCXX/debug-info.cpp will have to go another day
without actually testing anything other than the fact that they don't
crash.

& improve the actually interesting test case in
test/CodeGenCXX/debug-info-templates.cpp which was my original goal (in
preparation for expanding it/fixing some related bugs in non-type
template parameters)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181552 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDocumentation warning: \param, not \parm
Dmitri Gribenko [Thu, 9 May 2013 21:15:22 +0000 (21:15 +0000)]
Documentation warning: \param, not \parm

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181550 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd pragma-comment.c test case for r181426 that I forgot to add
Reid Kleckner [Thu, 9 May 2013 21:10:06 +0000 (21:10 +0000)]
Add pragma-comment.c test case for r181426 that I forgot to add

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181546 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoArrayRef'ize some SemaOverload methods
Dmitri Gribenko [Thu, 9 May 2013 21:02:07 +0000 (21:02 +0000)]
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

11 years ago[ms-cxxabi] Implement member pointer conversions
Reid Kleckner [Thu, 9 May 2013 21:01:17 +0000 (21:01 +0000)]
[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

11 years agoDebug Info: Remove unnecessary check for dependent array types
David Blaikie [Thu, 9 May 2013 20:48:12 +0000 (20:48 +0000)]
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

11 years agoFix captured statements codegen test on ARM
Ben Langmuir [Thu, 9 May 2013 20:42:43 +0000 (20:42 +0000)]
Fix captured statements codegen test on ARM

The return type of the destructor may vary between platforms, so stop
inadvertently testing it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181541 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCodeGen for CapturedStmts
Ben Langmuir [Thu, 9 May 2013 19:17:11 +0000 (19:17 +0000)]
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

11 years agoSwitch C++1y paper links back to the canonical location at open-std.org now that...
Richard Smith [Thu, 9 May 2013 18:53:17 +0000 (18:53 +0000)]
Switch C++1y paper links back to the canonical location at open-std.org now that the post-Bristol mailing has shipped.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181533 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd testcase missed from r181527.
Richard Smith [Thu, 9 May 2013 18:33:50 +0000 (18:33 +0000)]
Add testcase missed from r181527.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181531 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix the return type of the complex creal functions. Patch by YunZhong Gao, modified...
Richard Smith [Thu, 9 May 2013 17:41:19 +0000 (17:41 +0000)]
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

11 years agoRemove trailing whitespace
David Blaikie [Thu, 9 May 2013 17:29:54 +0000 (17:29 +0000)]
Remove trailing whitespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181525 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[doc parsing]: make single character command impostures
Fariborz Jahanian [Thu, 9 May 2013 17:18:52 +0000 (17:18 +0000)]
[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

11 years agoAdding isConst() ASTMatcher for CXXMethodDecl nodes
Edwin Vane [Thu, 9 May 2013 17:00:17 +0000 (17:00 +0000)]
Adding isConst() ASTMatcher for CXXMethodDecl nodes

Updated reference and unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181522 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[doc parsing]: So, in this patch, single character
Fariborz Jahanian [Thu, 9 May 2013 16:44:02 +0000 (16:44 +0000)]
[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

11 years agoUpdating LibASTMatchersReference to include namespaceDecl()
Edwin Vane [Thu, 9 May 2013 16:42:37 +0000 (16:42 +0000)]
Updating LibASTMatchersReference to include namespaceDecl()

The namespaceDecl() ASTMatcher was added in r179027.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181519 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[doc parsing]: don't attempt to fix single character
Fariborz Jahanian [Thu, 9 May 2013 16:22:31 +0000 (16:22 +0000)]
[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

11 years agoxopintrin.h: Add wrappers for all flavors of _mm_com.
Benjamin Kramer [Thu, 9 May 2013 15:07:46 +0000 (15:07 +0000)]
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

11 years agoAdd include guards to prfchwintrin.h.
Benjamin Kramer [Thu, 9 May 2013 15:07:39 +0000 (15:07 +0000)]
Add include guards to prfchwintrin.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181513 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImplement C++1y constant initializer rules: in a constant initializer for an
Richard Smith [Thu, 9 May 2013 07:14:00 +0000 (07:14 +0000)]
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

11 years ago[analyzer; alternate arrows] for "loop back" edges add back the extra edge to the...
Ted Kremenek [Thu, 9 May 2013 06:55:41 +0000 (06:55 +0000)]
[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

11 years ago[analyzer;alternate arrows] adapt 'for' loop aesthetic cleanup to 'while' loops.
Ted Kremenek [Thu, 9 May 2013 06:55:35 +0000 (06:55 +0000)]
[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

11 years agoPut some diagnostics in DiagnosticCommonKinds.td in a category, mirroring what they...
Ted Kremenek [Thu, 9 May 2013 00:07:27 +0000 (00:07 +0000)]
Put some diagnostics in DiagnosticCommonKinds.td in a category, mirroring what they are in other .td files.

I really dislike the copy-pasting of the category strings.  If there is a better
way to do this with TableGen, please advise.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181494 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoObjective-C: Correctly encode 'retain' and 'copy' for readonly properties.
Nico Weber [Wed, 8 May 2013 23:47:40 +0000 (23:47 +0000)]
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

11 years ago[PCH] Remove the ASTReaderListener::ReadHeaderFileInfo callback.
Argyrios Kyrtzidis [Wed, 8 May 2013 23:46:55 +0000 (23:46 +0000)]
[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

11 years ago[modules] When building a module, make sure we don't serialize out HeaderFileInfo...
Argyrios Kyrtzidis [Wed, 8 May 2013 23:46:46 +0000 (23:46 +0000)]
[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

11 years agoput noisy "unknown command tag name" warning
Fariborz Jahanian [Wed, 8 May 2013 23:38:56 +0000 (23:38 +0000)]
put noisy "unknown command tag name"  warning
under -Wdocumentation-unknown-command and off by default.
patch by Dmitri Gribenko.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181487 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agotypo
Adrian Prantl [Wed, 8 May 2013 23:37:22 +0000 (23:37 +0000)]
typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181485 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoComment: use \code...\endcode for code examples
Dmitri Gribenko [Wed, 8 May 2013 23:09:44 +0000 (23:09 +0000)]
Comment: use \code...\endcode for code examples

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181481 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAll -Wdocumentation warnings are DefaultIgnore
Dmitri Gribenko [Wed, 8 May 2013 22:54:41 +0000 (22:54 +0000)]
All -Wdocumentation warnings are DefaultIgnore

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181480 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agounbreak buildbot.
Fariborz Jahanian [Wed, 8 May 2013 22:52:20 +0000 (22:52 +0000)]
unbreak buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181479 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[doc parsing]: Also do typo correction for
Fariborz Jahanian [Wed, 8 May 2013 22:14:28 +0000 (22:14 +0000)]
[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

11 years agoFix test in two ways: remove incorrect comment (the intrinsic generated now
Eli Bendersky [Wed, 8 May 2013 20:58:01 +0000 (20:58 +0000)]
Fix test in two ways: remove incorrect comment (the intrinsic generated now
is of the llvm.sjlj.* flavore) and convert grep->FileCheck

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181468 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd missing triple to unit test.
Richard Smith [Wed, 8 May 2013 20:32:14 +0000 (20:32 +0000)]
Add missing triple to unit test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181465 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTurn off a warning caused by my last patch.
Fariborz Jahanian [Wed, 8 May 2013 20:29:57 +0000 (20:29 +0000)]
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

11 years agodocumentation parsing. Patch to do typo correction for
Fariborz Jahanian [Wed, 8 May 2013 19:21:00 +0000 (19:21 +0000)]
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

11 years agoFurther fix to pointer to member formatting.
Daniel Jasper [Wed, 8 May 2013 15:06:58 +0000 (15:06 +0000)]
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

11 years agoFix formatting of pointers to members.
Daniel Jasper [Wed, 8 May 2013 14:58:20 +0000 (14:58 +0000)]
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

11 years agoDocument Clang's support for #pragma comment(lib/linker) with -fms-extensions
Reid Kleckner [Wed, 8 May 2013 14:40:51 +0000 (14:40 +0000)]
Document Clang's support for #pragma comment(lib/linker) with -fms-extensions

As suggested by Dmitri Gribenko.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181433 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoImprove line breaking in binary expressions.
Daniel Jasper [Wed, 8 May 2013 14:12:04 +0000 (14:12 +0000)]
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

11 years agoForward #pragma comment(lib/linker) through as flags metadata
Reid Kleckner [Wed, 8 May 2013 13:44:39 +0000 (13:44 +0000)]
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

11 years agoChange indentation of multi-line nested name specifiers.
Daniel Jasper [Wed, 8 May 2013 10:00:18 +0000 (10:00 +0000)]
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

11 years agoFix one FIXME in VTableBuilder
Timur Iskhodzhanov [Wed, 8 May 2013 08:09:21 +0000 (08:09 +0000)]
Fix one FIXME in VTableBuilder

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181396 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDebug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and...
David Blaikie [Wed, 8 May 2013 06:01:46 +0000 (06:01 +0000)]
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

11 years agoIn block enum-return inference, don't die on loads of enum lvalues.
John McCall [Wed, 8 May 2013 03:34:22 +0000 (03:34 +0000)]
In block enum-return inference, don't die on loads of enum lvalues.

More of rdar://13200889.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181390 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoAdd test forgotten in r181388.
Richard Smith [Wed, 8 May 2013 02:38:36 +0000 (02:38 +0000)]
Add test forgotten in r181388.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181389 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoC++1y: Add a step limit to constexpr evaluation, to catch runaway loops.
Richard Smith [Wed, 8 May 2013 02:12:03 +0000 (02:12 +0000)]
C++1y: Add a step limit to constexpr evaluation, to catch runaway loops.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181388 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate edges] insert an extra edge for 'for' statements to conditions.
Ted Kremenek [Wed, 8 May 2013 01:15:24 +0000 (01:15 +0000)]
[analyzer; alternate edges] insert an extra edge for 'for' statements to conditions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181385 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer;alternate edges] edges from subexpressions of "?:" are important to retain
Ted Kremenek [Wed, 8 May 2013 01:15:20 +0000 (01:15 +0000)]
[analyzer;alternate edges] edges from subexpressions of "?:" are important to retain

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181384 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoC++1y constant expression evaluation: compound assignment support for floating-point...
Richard Smith [Tue, 7 May 2013 23:34:45 +0000 (23:34 +0000)]
C++1y constant expression evaluation: compound assignment support for floating-point and pointer types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181376 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoThe style guide prefers preincrement expressions :-)
Adrian Prantl [Tue, 7 May 2013 22:41:09 +0000 (22:41 +0000)]
The style guide prefers preincrement expressions :-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181373 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoremove commented out code.
Adrian Prantl [Tue, 7 May 2013 22:26:03 +0000 (22:26 +0000)]
remove commented out code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181372 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWhen typo correction produces an overloaded result when looking up a member,
Nick Lewycky [Tue, 7 May 2013 22:14:37 +0000 (22:14 +0000)]
When typo correction produces an overloaded result when looking up a member,
return all the overloads instead of just picking the first possible declaration.
This removes an invalid note (and on occasion other invalid diagnostics) and
also makes clang's parsing recovery behave as if the text from its fixit were
applied.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181370 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoDon't crash in IRGen if a conditional with 'throw' in one of its branches is
Richard Smith [Tue, 7 May 2013 21:53:22 +0000 (21:53 +0000)]
Don't crash in IRGen if a conditional with 'throw' in one of its branches is
used as a branch condition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181368 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoFix crash on invalid in template type diffing.
Richard Trieu [Tue, 7 May 2013 21:36:24 +0000 (21:36 +0000)]
Fix crash on invalid in template type diffing.

This is a fix for PR15895, where Clang will crash when trying to print a
template diff and the template uses an address of operator.  This resulted
from expecting a DeclRefExpr when the Expr could have also been
UnaryOperator->DeclRefExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181365 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer;alternate arrows] Fix inconsistencies in recorded location context when...
Ted Kremenek [Tue, 7 May 2013 21:12:06 +0000 (21:12 +0000)]
[analyzer;alternate arrows] Fix inconsistencies in recorded location context when handling interprocedural paths.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181362 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate arrows] add back recording whether we visited the first edge.
Ted Kremenek [Tue, 7 May 2013 21:12:03 +0000 (21:12 +0000)]
[analyzer; alternate arrows] add back recording whether we visited the first edge.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181361 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate arrows] remove pruning of loop diagnostics.
Ted Kremenek [Tue, 7 May 2013 21:12:00 +0000 (21:12 +0000)]
[analyzer; alternate arrows] remove pruning of loop diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181360 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate arrows] include logical '||' and '&&' as anchors for edges.
Ted Kremenek [Tue, 7 May 2013 21:11:57 +0000 (21:11 +0000)]
[analyzer; alternate arrows] include logical '||' and '&&' as anchors for edges.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181359 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate arrows] include an edge from the "break" or "continue"
Ted Kremenek [Tue, 7 May 2013 21:11:54 +0000 (21:11 +0000)]
[analyzer; alternate arrows] include an edge from the "break" or "continue"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181358 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate arrows] the extra edge to the closing '}' in a loop adds no...
Ted Kremenek [Tue, 7 May 2013 21:11:52 +0000 (21:11 +0000)]
[analyzer; alternate arrows] the extra edge to the closing '}' in a loop adds no value.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181357 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate arrows] the initializer of a ForStmt isn't interesting either.
Ted Kremenek [Tue, 7 May 2013 21:11:49 +0000 (21:11 +0000)]
[analyzer; alternate arrows] the initializer of a ForStmt isn't interesting either.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181356 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[libclang] Add a null check in CursorVisitor::visitPreprocessedEntities.
Argyrios Kyrtzidis [Tue, 7 May 2013 20:37:17 +0000 (20:37 +0000)]
[libclang] Add a null check in CursorVisitor::visitPreprocessedEntities.

rdar://13680583

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181352 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoWe're in 3.4 land now.
Bill Wendling [Tue, 7 May 2013 20:31:37 +0000 (20:31 +0000)]
We're in 3.4 land now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181351 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTry to recognise hidden tag type names in potential declarations, in ObjC code as...
Argyrios Kyrtzidis [Tue, 7 May 2013 19:54:28 +0000 (19:54 +0000)]
Try to recognise hidden tag type names in potential declarations, in ObjC code as well.

rdar://13829073

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181345 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoC++1y: Update __cplusplus to temporary value 201305L to allow detection of provisiona...
Richard Smith [Tue, 7 May 2013 19:32:56 +0000 (19:32 +0000)]
C++1y: Update __cplusplus to temporary value 201305L to allow detection of provisional C++1y support.
Add __has_feature and __has_extension checks for C++1y features (based on the provisional names from
the C++ features study group), and update documentation to match.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181342 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer] Fix a crash triggered by printing a note on a default argument
Anna Zaks [Tue, 7 May 2013 17:42:42 +0000 (17:42 +0000)]
[analyzer] Fix a crash triggered by printing a note on a default argument

Instead, use the location of the call to print the note.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181337 91177308-0d34-0410-b5e6-96231b3b80d8

11 years ago[analyzer; alternate arrows] The ForStmt increment is not a critical anchor for arrows.
Ted Kremenek [Tue, 7 May 2013 17:02:41 +0000 (17:02 +0000)]
[analyzer; alternate arrows] The ForStmt increment is not a critical anchor for arrows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181333 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoTest commit
Serge Pavlov [Tue, 7 May 2013 16:56:03 +0000 (16:56 +0000)]
Test commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181332 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoPrevent crashes from hasCanonicalType matcher
Edwin Vane [Tue, 7 May 2013 15:53:23 +0000 (15:53 +0000)]
Prevent crashes from hasCanonicalType matcher

Adding an QualType::isNull() check.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181329 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoConfig file support for clang-format, part 1.
Alexander Kornienko [Tue, 7 May 2013 15:32:14 +0000 (15:32 +0000)]
Config file support for clang-format, part 1.

Summary:
Added parseConfiguration method, which reads FormatStyle from YAML
string. This supports all FormatStyle fields and an additional BasedOnStyle
field, which can be used to specify base style.

Reviewers: djasper, klimek

Reviewed By: djasper

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D754

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181326 91177308-0d34-0410-b5e6-96231b3b80d8

11 years agoCorrectly recognize dereference after 'delete'.
Daniel Jasper [Tue, 7 May 2013 14:17:18 +0000 (14:17 +0000)]
Correctly recognize dereference after 'delete'.

With certain styles:
Before: delete* x;
After:  delete *x;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181318 91177308-0d34-0410-b5e6-96231b3b80d8