]> granicus.if.org Git - clang/log
clang
11 years agoAdd move semantics to PartialDiagnostic, which can be very expensive to copy.
Benjamin Kramer [Thu, 6 Dec 2012 19:09:30 +0000 (19:09 +0000)]
Add move semantics to PartialDiagnostic, which can be very expensive to copy.

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

11 years agoUn-XFAIL hexagon-toolchain.c test for mingw32
Matthew Curtis [Thu, 6 Dec 2012 19:03:09 +0000 (19:03 +0000)]
Un-XFAIL hexagon-toolchain.c test for mingw32

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

11 years agoAdd a bit on FunctionDecl/ObjCMethodDecl to indicate if there was a body
Argyrios Kyrtzidis [Thu, 6 Dec 2012 18:59:10 +0000 (18:59 +0000)]
Add a bit on FunctionDecl/ObjCMethodDecl to indicate if there was a body
that was skipped by the parser.

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

11 years ago[analyzer] Remove isa<> followed by dyn_cast<>.
Jordan Rose [Thu, 6 Dec 2012 18:58:29 +0000 (18:58 +0000)]
[analyzer] Remove isa<> followed by dyn_cast<>.

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

11 years ago[analyzer] Remove unused fields from ExprEngine.
Jordan Rose [Thu, 6 Dec 2012 18:58:26 +0000 (18:58 +0000)]
[analyzer] Remove unused fields from ExprEngine.

'currStmt', 'CleanedState', and 'EntryNode' were being set, but only ever
used locally.

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

11 years ago[analyzer] Remove checks that predate the linearized CFG.
Jordan Rose [Thu, 6 Dec 2012 18:58:22 +0000 (18:58 +0000)]
[analyzer] Remove checks that predate the linearized CFG.

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

11 years ago[analyzer] Simplify RetainCountChecker's handling of dead symbols.
Jordan Rose [Thu, 6 Dec 2012 18:58:18 +0000 (18:58 +0000)]
[analyzer] Simplify RetainCountChecker's handling of dead symbols.

Previously we made three passes over the set of dead symbols, and removed
them from the state /twice/. Now we combine the autorelease pass and the
symbol death pass, and only have to remove the bindings for the symbols
that leaked.

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

11 years ago[analyzer] Use a smarter algorithm to find the last block in an inlined call.
Jordan Rose [Thu, 6 Dec 2012 18:58:15 +0000 (18:58 +0000)]
[analyzer] Use a smarter algorithm to find the last block in an inlined call.

Previously we would search for the last statement, then back up to the
entrance of the block that contained that statement. Now, while we're
scanning for the statement, we just keep track of which blocks are being
exited (in reverse order).

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

11 years ago[analyzer] Speed up ExplodedNode::Profile by avoiding copy constructors.
Jordan Rose [Thu, 6 Dec 2012 18:58:12 +0000 (18:58 +0000)]
[analyzer] Speed up ExplodedNode::Profile by avoiding copy constructors.

ProgramStateRef::Retain isn't free!

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

11 years ago[analyzer] Use optimized assumeDual for branches.
Jordan Rose [Thu, 6 Dec 2012 18:58:09 +0000 (18:58 +0000)]
[analyzer] Use optimized assumeDual for branches.

This doesn't seem to make much of a difference in practice, but it does
have the potential to avoid a trip through the constraint manager.

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

11 years ago[analyzer] Aggressively cut back on the canonicalization in RegionStore.
Jordan Rose [Thu, 6 Dec 2012 18:58:06 +0000 (18:58 +0000)]
[analyzer] Aggressively cut back on the canonicalization in RegionStore.

Whenever we touch a single bindings cluster multiple times, we can delay
canonicalizing it until the final access. This has some interesting
implications, in particular that we shouldn't remove an /empty/ cluster
from the top-level map until canonicalization.

This is good for a 2% speedup or so on the test case in
<rdar://problem/12810842>

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

11 years ago[analyzer] Remove bindExprAndLocation, which does extra work for no gain.
Jordan Rose [Thu, 6 Dec 2012 18:58:01 +0000 (18:58 +0000)]
[analyzer] Remove bindExprAndLocation, which does extra work for no gain.

This feature was probably intended to improve diagnostics, but was currently
only used when dumping the Environment. It shows what location a given value
was loaded from, e.g. when evaluating an LValueToRValue cast.

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

11 years agoClang-format: IndentCaseLabels option, proper namespace handling
Alexander Kornienko [Thu, 6 Dec 2012 18:03:27 +0000 (18:03 +0000)]
Clang-format: IndentCaseLabels option, proper namespace handling

Summary: + tests arranged in groups, as their number is already quite large.

Reviewers: djasper, klimek

Reviewed By: djasper

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

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

11 years agoFixes a typo in this test.
Fariborz Jahanian [Thu, 6 Dec 2012 17:50:40 +0000 (17:50 +0000)]
Fixes a typo in this test.

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

11 years agoClang-format: detect unbalanced braces.
Alexander Kornienko [Thu, 6 Dec 2012 17:49:17 +0000 (17:49 +0000)]
Clang-format: detect unbalanced braces.

Reviewers: klimek, djasper

Reviewed By: klimek

CC: cfe-commits, silvas
Differential Revision: http://llvm-reviews.chandlerc.com/D176

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

11 years agoHexagon TC: Add/improve support for small data
Matthew Curtis [Thu, 6 Dec 2012 17:49:03 +0000 (17:49 +0000)]
Hexagon TC: Add/improve support for small data
 threshold, pic, pie

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

11 years agoFix hexagon-toolchain.c test to handle versioned clang executables.
Matthew Curtis [Thu, 6 Dec 2012 16:01:06 +0000 (16:01 +0000)]
Fix hexagon-toolchain.c test to handle versioned clang executables.

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

11 years agoHexagon TC: Reimplement Link::ConstructJob to call
Matthew Curtis [Thu, 6 Dec 2012 15:46:07 +0000 (15:46 +0000)]
Hexagon TC: Reimplement Link::ConstructJob to call
 linker directly

Rather than calling gcc.

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

11 years agoSema: Don't emit a warning when __func__ is used in a lambda outside of a function.
Benjamin Kramer [Thu, 6 Dec 2012 15:42:21 +0000 (15:42 +0000)]
Sema: Don't emit a warning when __func__ is used in a lambda outside of a function.

Fixes PR14518.

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

11 years agotest/Driver/hexagon-toolchain.c: Unbreak XPASS. Cygwin can be treated as unix-like...
NAKAMURA Takumi [Thu, 6 Dec 2012 14:42:56 +0000 (14:42 +0000)]
test/Driver/hexagon-toolchain.c: Unbreak XPASS. Cygwin can be treated as unix-like system.

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

11 years agoImplements multiple parents in the parent map.
Manuel Klimek [Thu, 6 Dec 2012 14:42:48 +0000 (14:42 +0000)]
Implements multiple parents in the parent map.

Previously we would match the last visited parent, which in the
case of template instantiations was the last instantiated template.

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

11 years agoHexagon TC: Move getHexagonTargetCPU from Tools.cpp to
Matthew Curtis [Thu, 6 Dec 2012 14:16:43 +0000 (14:16 +0000)]
Hexagon TC: Move getHexagonTargetCPU from Tools.cpp to
 ToolChains.cpp

This is in anticipation of forthcoming library path changes.

Also ...
- Fixes some inconsistencies in how the arch is passed to tools.
- Add test cases for various forms of arch flags

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

11 years agoImprove clang-format's handling of unary operators.
Daniel Jasper [Thu, 6 Dec 2012 13:16:39 +0000 (13:16 +0000)]
Improve clang-format's handling of unary operators.

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

11 years agoDisable hexagon toolchain test on windows targets
Matthew Curtis [Thu, 6 Dec 2012 13:06:19 +0000 (13:06 +0000)]
Disable hexagon toolchain test on windows targets

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

11 years agoHexagon TC: Update toolchain to add appropriate include
Matthew Curtis [Thu, 6 Dec 2012 12:43:18 +0000 (12:43 +0000)]
Hexagon TC: Update toolchain to add appropriate include
 paths

- Inherit from Linux rather than ToolChain
- Override AddClangSystemIncludeArgs and AddClangCXXStdlibIncludeArgs
  to properly set include paths.

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

11 years agoclang/test/CodeGen/2008-01-07-UnusualIntSize.c: Add triple x86_64. It doesn't assume...
NAKAMURA Takumi [Thu, 6 Dec 2012 12:05:25 +0000 (12:05 +0000)]
clang/test/CodeGen/2008-01-07-UnusualIntSize.c: Add triple x86_64. It doesn't assume 32-bit target, for now.

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

11 years agoRework the bitfield access IR generation to address PR13619 and
Chandler Carruth [Thu, 6 Dec 2012 11:14:44 +0000 (11:14 +0000)]
Rework the bitfield access IR generation to address PR13619 and
generally support the C++11 memory model requirements for bitfield
accesses by relying more heavily on LLVM's memory model.

The primary change this introduces is to move from a manually aligned
and strided access pattern across the bits of the bitfield to a much
simpler lump access of all bits in the bitfield followed by math to
extract the bits relevant for the particular field.

This simplifies the code significantly, but relies on LLVM to
intelligently lowering these integers.

I have tested LLVM's lowering both synthetically and in benchmarks. The
lowering appears to be functional, and there are no really significant
performance regressions. Different code patterns accessing bitfields
will vary in how this impacts them. The only real regressions I'm seeing
are a few patterns where the LLVM code generation for loads that feed
directly into a mask operation don't take advantage of the x86 ability
to do a smaller load and a cheap zero-extension. This doesn't regress
any benchmark in the nightly test suite on my box past the noise
threshold, but my box is quite noisy. I'll be watching the LNT numbers,
and will look into further improvements to the LLVM lowering as needed.

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

11 years ago"<<" alignment for clang-format.
Daniel Jasper [Thu, 6 Dec 2012 09:56:08 +0000 (09:56 +0000)]
"<<" alignment for clang-format.

Also, small fix for handling the first token correctly.

Review: http://llvm-reviews.chandlerc.com/D177

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

11 years agoUse the BlockDecl captures list to infer the direct captures for a BlockDataRegion...
Ted Kremenek [Thu, 6 Dec 2012 07:17:26 +0000 (07:17 +0000)]
Use the BlockDecl captures list to infer the direct captures for a BlockDataRegion.  Fixes <rdar://problem/12415065>.

We still need to do a recursive walk to determine all static/global variables
referenced by a block, which is needed for region invalidation.

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

11 years agoOnly provide explicit getCapturedRegion() and getOriginalRegion() from referenced_var...
Ted Kremenek [Thu, 6 Dec 2012 07:17:20 +0000 (07:17 +0000)]
Only provide explicit getCapturedRegion() and getOriginalRegion() from referenced_vars_iterator.

This is a nice conceptual cleanup.

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

11 years agoPull logic to map from VarDecl* to captured region using a helper function. WIP.
Ted Kremenek [Thu, 6 Dec 2012 07:17:13 +0000 (07:17 +0000)]
Pull logic to map from VarDecl* to captured region using a helper function.  WIP.

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

11 years agoUse 'getOriginalRegion()' rather than going through the logic to recreate it.
Ted Kremenek [Thu, 6 Dec 2012 07:17:04 +0000 (07:17 +0000)]
Use 'getOriginalRegion()' rather than going through the logic to recreate it.

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

11 years agoFix http://stackoverflow.com/questions/13521163
Richard Smith [Thu, 6 Dec 2012 06:44:44 +0000 (06:44 +0000)]
Fix http://stackoverflow.com/questions/13521163

Don't require that, during template deduction, a template specialization type
as a function parameter has at least as many template arguments as one used in
a function argument (not even if the argument has been resolved to an exact
type); the additional parameters might be provided by default template
arguments in the template. We don't need this check, since we now implement
[temp.deduct.call]p4 with an additional check after deduction.

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

11 years agoDon't use dyn_cast on a Type* which might not be canonical. Fixes an extremely obscur...
Richard Smith [Thu, 6 Dec 2012 03:04:50 +0000 (03:04 +0000)]
Don't use dyn_cast on a Type* which might not be canonical. Fixes an extremely obscure record layout bug.

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

11 years agoDisable clang/test/Preprocessor/macro-multiline.c for now, while investigating lit...
NAKAMURA Takumi [Thu, 6 Dec 2012 01:09:31 +0000 (01:09 +0000)]
Disable clang/test/Preprocessor/macro-multiline.c for now, while investigating lit.ShUtil.parser.

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

11 years agomore test of template declarations in a
Fariborz Jahanian [Thu, 6 Dec 2012 00:57:28 +0000 (00:57 +0000)]
more test of template declarations in a
<declaration> XML tag. // rdar://12378714

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

11 years agoMore C++ testing of declarations embedded in
Fariborz Jahanian [Thu, 6 Dec 2012 00:09:40 +0000 (00:09 +0000)]
More C++ testing of declarations embedded in
<declaration> tag of Comment XML  and fixing
DeclPrint of templates along the way - wip.
//rdar://12378714

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

11 years ago[driver, ms-inline asm] -fms-compatibility enables -fms-extensions, so this should...
Chad Rosier [Wed, 5 Dec 2012 23:35:10 +0000 (23:35 +0000)]
[driver, ms-inline asm] -fms-compatibility enables -fms-extensions, so this should enable
the AsmBlocks language extension as well.
rdar://12808010

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

11 years ago[driver, ms-inline asm] Have -fms-extensions enable the AsmBlocks language
Chad Rosier [Wed, 5 Dec 2012 23:08:09 +0000 (23:08 +0000)]
[driver, ms-inline asm] Have -fms-extensions enable the AsmBlocks language
option.  MS-style inline asm can now be enabled by either -fasm-blocks or
-fms-extensions.
rdar://12808010

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

11 years agoLooks like lit on Windows can't cope with parens here, and in any case, we shouldn...
Richard Smith [Wed, 5 Dec 2012 22:59:28 +0000 (22:59 +0000)]
Looks like lit on Windows can't cope with parens here, and in any case, we shouldn't need them after r169441.

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

11 years agoIn DeclPrint add printing of '= default'
Fariborz Jahanian [Wed, 5 Dec 2012 22:53:06 +0000 (22:53 +0000)]
In DeclPrint add printing of '= default'
in constructors.

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

11 years agoMore workarounds for PR10867.
Richard Smith [Wed, 5 Dec 2012 22:33:14 +0000 (22:33 +0000)]
More workarounds for PR10867.

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

11 years agoIn DeclPrint add printing of 'explicit'
Fariborz Jahanian [Wed, 5 Dec 2012 22:19:06 +0000 (22:19 +0000)]
In DeclPrint add printing of 'explicit'
constructors.

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

11 years agoFix an egregiously broken test. This pattern doesn't work:
Richard Smith [Wed, 5 Dec 2012 22:18:04 +0000 (22:18 +0000)]
Fix an egregiously broken test. This pattern doesn't work:

RUN: a
RUN: b || true

lit expands it to a && b || true, and the || true applies to both commands (thus ignoring failures in 'a')! This is PR10867 again.

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

11 years ago[c-index-test] Introduce '-index-compile-db' which accepts a compilation database...
Argyrios Kyrtzidis [Wed, 5 Dec 2012 21:53:37 +0000 (21:53 +0000)]
[c-index-test] Introduce '-index-compile-db' which accepts a compilation database file
and does an '-index-file' for all compile commands in the database.

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

11 years agoFix name. The array is unboundED.
Bill Wendling [Wed, 5 Dec 2012 21:43:37 +0000 (21:43 +0000)]
Fix name. The array is unboundED.

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

11 years ago[driver, ms-inline asm] MS-Style inline assembly is controlled by the
Chad Rosier [Wed, 5 Dec 2012 21:08:21 +0000 (21:08 +0000)]
[driver, ms-inline asm] MS-Style inline assembly is controlled by the
-fasm-blocks flag, not the -fms-extensions flag.
rdar://12808010

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

11 years agofix comment.
Fariborz Jahanian [Wed, 5 Dec 2012 20:10:11 +0000 (20:10 +0000)]
fix comment.

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

11 years agoTesting C++ declarations embedded in
Fariborz Jahanian [Wed, 5 Dec 2012 19:54:11 +0000 (19:54 +0000)]
Testing C++ declarations embedded in
<declaration> tag of Comment XML.
Added DeclPrint support for constructors
and fix tests accordingly.
This is wip. // rdar://12378714

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

11 years ago[ms-inline asm] Add more tests.
Chad Rosier [Wed, 5 Dec 2012 19:52:05 +0000 (19:52 +0000)]
[ms-inline asm] Add more tests.

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

11 years agoFormat strings: offer a cast to 'unichar' for %C in Objective-C contexts.
Jordan Rose [Wed, 5 Dec 2012 18:44:49 +0000 (18:44 +0000)]
Format strings: offer a cast to 'unichar' for %C in Objective-C contexts.

For most cases where a conversion specifier doesn't match an argument,
we usually guess that the conversion specifier is wrong. However, if
the argument is an integer type and the specifier is %C, it's likely
the user really did mean to print the integer as a character.

(This is more common than %c because there is no way to specify a unichar
literal -- you have to write an integer literal, such as '0x2603',
and then cast it to unichar.)

This does not change the behavior of %S, since there are fewer cases
where printing a literal Unicode *string* is necessary, but this could
easily be changed in the future.

<rdar://problem/11982013>

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

11 years agoFormat strings: add more expression types that don't need parens to cast.
Jordan Rose [Wed, 5 Dec 2012 18:44:44 +0000 (18:44 +0000)]
Format strings: add more expression types that don't need parens to cast.

No functionality change (the test change is a comment only, and the new
functionality can't be tested using the current test).

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

11 years agoFormat strings: a character literal should be printed with %c, not %d.
Jordan Rose [Wed, 5 Dec 2012 18:44:40 +0000 (18:44 +0000)]
Format strings: a character literal should be printed with %c, not %d.

The type of a character literal is 'int' in C, but if the user writes a
character /as/ a literal, we should assume they meant it to be a
character and not a numeric value, and thus offer %c as a correction
rather than %d.

There's a special case for multi-character literals (like 'MooV'), which
have implementation-defined value and usually cannot be printed with %c.
These still use %d as the suggestion.

In C++, the type of a character literal is 'char', and so this problem
doesn't exist.

<rdar://problem/12282316>

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

11 years agoFormat strings: the correct conversion for 'char' is %c, not %d or %hhd.
Jordan Rose [Wed, 5 Dec 2012 18:44:37 +0000 (18:44 +0000)]
Format strings: the correct conversion for 'char' is %c, not %d or %hhd.

We tried to account for 'uint8_t' by saying that /typedefs/ of 'char'
should be corrected as %hhd rather than %c, but the condition was wrong.

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

11 years agoRemove bad and useless enum to bool conversion.
Daniel Jasper [Wed, 5 Dec 2012 16:24:48 +0000 (16:24 +0000)]
Remove bad and useless enum to bool conversion.

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

11 years agoClang-format: parse for and while loops
Alexander Kornienko [Wed, 5 Dec 2012 15:06:06 +0000 (15:06 +0000)]
Clang-format: parse for and while loops

Summary: Adds support for formatting for and while loops.

Reviewers: djasper, klimek

Reviewed By: klimek

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

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

11 years agoIndentation fixes for clang-format.
Daniel Jasper [Wed, 5 Dec 2012 14:57:28 +0000 (14:57 +0000)]
Indentation fixes for clang-format.

- Fix behavior of memoization together with optimization
- Correctly attribute the PenaltyIndentLevel (breaking directly after "(" did
  not count towards the inner level)
- Recognize more tokens as assignments

Review: http://llvm-reviews.chandlerc.com/D172

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

11 years agoFollow-up to r169286, addresses comments in http://llvm-reviews.chandlerc.com/D164...
Alexander Kornienko [Wed, 5 Dec 2012 13:56:52 +0000 (13:56 +0000)]
Follow-up to r169286, addresses comments in http://llvm-reviews.chandlerc.com/D164#comment-4 : comments and a method rename

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

11 years agoReuse an existing diagnostic for tsan/msan needing -pie error.
Evgeniy Stepanov [Wed, 5 Dec 2012 13:37:12 +0000 (13:37 +0000)]
Reuse an existing diagnostic for tsan/msan needing -pie error.
Add a diagnosting for -fsanitize=memory conflicting with other sanitizers.
Extend tests.

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

11 years agotest/Modules/build-fail-notes.m: Tweak to unbreak Win32 hosts to relax expressions...
NAKAMURA Takumi [Wed, 5 Dec 2012 11:52:45 +0000 (11:52 +0000)]
test/Modules/build-fail-notes.m: Tweak to unbreak Win32 hosts to relax expressions, for now.

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

11 years agoIn C++, if we hit an error in the class-head, don't try to parse the class body.
Richard Smith [Wed, 5 Dec 2012 11:34:06 +0000 (11:34 +0000)]
In C++, if we hit an error in the class-head, don't try to parse the class body.
Our error recovery path may have made the class anonymous, and that has a pretty
disastrous impact on any attempt to parse a class body containing constructors.

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

11 years agoPR14049: Don't say "expanded from macro 'foo'" when 'foo' just happens to be
Richard Smith [Wed, 5 Dec 2012 11:04:55 +0000 (11:04 +0000)]
PR14049: Don't say "expanded from macro 'foo'" when 'foo' just happens to be
the LHS of a token paste. Use "expanded from here" instead when we're not sure
it's actually a macro.

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

11 years agoMinor reorganization. No functionality change.
Richard Smith [Wed, 5 Dec 2012 09:47:49 +0000 (09:47 +0000)]
Minor reorganization. No functionality change.

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

11 years agoAdd missing virtual destructors reported by -Wnon-virtual-dtor.
Daniel Jasper [Wed, 5 Dec 2012 09:23:48 +0000 (09:23 +0000)]
Add missing virtual destructors reported by -Wnon-virtual-dtor.

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

11 years agoSmall tweaks to automatic formatting.
Daniel Jasper [Wed, 5 Dec 2012 07:51:39 +0000 (07:51 +0000)]
Small tweaks to automatic formatting.

Recognize '!=' as a binary operator and assume that there are no
type definitions on the RHS of an assignment.

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

11 years agoSimplify slightly by seperating out the responsibility for emission of a caret
Richard Smith [Wed, 5 Dec 2012 06:20:58 +0000 (06:20 +0000)]
Simplify slightly by seperating out the responsibility for emission of a caret
diagnostic from the emission of macro backtraces. Incidentally, we now get the
displayed source location for a diagnostic and the location for the caret from
the same place, rather than computing them separately. No functionality change.

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

11 years agoThis test used to fail forever if it failed once, because it does not clean up after...
Richard Smith [Wed, 5 Dec 2012 06:16:54 +0000 (06:16 +0000)]
This test used to fail forever if it failed once, because it does not clean up after itself if it failed.

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

11 years agoDriver.cpp: Restore clang/Config/config.h to be included at last not to prevent llvm...
NAKAMURA Takumi [Wed, 5 Dec 2012 04:56:27 +0000 (04:56 +0000)]
Driver.cpp: Restore clang/Config/config.h to be included at last not to prevent llvm-config.h.

Or "llvm/Support/system_error.h" could not be compiled on mingw.

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

11 years agoSimplify diagnostic emission. No functionality change intended.
Richard Smith [Wed, 5 Dec 2012 03:18:16 +0000 (03:18 +0000)]
Simplify diagnostic emission. No functionality change intended.

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

11 years agoThread-safety analysis: check locks on method calls, operator=, and
DeLesley Hutchins [Wed, 5 Dec 2012 01:20:45 +0000 (01:20 +0000)]
Thread-safety analysis: check locks on method calls, operator=, and
copy constructors.

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

11 years ago[analyzer] Implement an opt-in variant of direct ivar assignment.
Anna Zaks [Wed, 5 Dec 2012 01:14:37 +0000 (01:14 +0000)]
[analyzer] Implement an opt-in variant of direct ivar assignment.

This will only check the direct ivar assignments in the annotated
methods.

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

11 years agoThread Safety Analysis: refactor to make more methods accept const pointers,
DeLesley Hutchins [Wed, 5 Dec 2012 00:52:33 +0000 (00:52 +0000)]
Thread Safety Analysis: refactor to make more methods accept const pointers,
adjust checkAccess.  No change in functionality.

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

11 years agoTesting C++ declarations embedded in
Fariborz Jahanian [Wed, 5 Dec 2012 00:38:44 +0000 (00:38 +0000)]
Testing C++ declarations embedded in
<declaration> tag of Comment XML and
added support for friend declaration printing.
This is wip. // rdar://12378714

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

11 years agoThread safety analysis: Add a new "beta" warning flag: -Wthread-safety-beta.
DeLesley Hutchins [Wed, 5 Dec 2012 00:06:15 +0000 (00:06 +0000)]
Thread safety analysis: Add a new "beta" warning flag: -Wthread-safety-beta.
As the analysis improves, it will continue to add new warnings that are
potentially disruptive to existing users.  From now on, such warnings will
first be introduced under the "beta" flag.  Such warnings are not turned on by
default; their purpose is to allow users to test their code against future
planned changes, before those changes are actually made.  After a suitable
migration period, beta warnings will be folded into the standard
-Wthread-safety.

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

11 years agoAdd -whole-archive around the ASan runtime archive in the link command.
Chandler Carruth [Tue, 4 Dec 2012 22:54:37 +0000 (22:54 +0000)]
Add -whole-archive around the ASan runtime archive in the link command.

This ensures that even though it comes first, we pick up its .o files.
Note that if we can use this (or something similar / equivalent) on
other platforms, we could potentially remove
ReplaceOperatorsNewAndDelete from the ASan runtimes.

We should probably do something similar for TSan and MSan as well.

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

11 years agoAlphabetize source files, just like they have been before.
Ted Kremenek [Tue, 4 Dec 2012 22:17:32 +0000 (22:17 +0000)]
Alphabetize source files, just like they have been before.

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

11 years agoUse the 'count' attribute to calculate the upper bound of an array.
Bill Wendling [Tue, 4 Dec 2012 21:33:58 +0000 (21:33 +0000)]
Use the 'count' attribute to calculate the upper bound of an array.

The count attribute is more accurate with regards to the size of an array. It
also obviates the upper bound attribute in the subrange. We can also better
handle an unbound array by setting the count to -1 instead of the lower bound to
1 and upper bound to 0.

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

11 years agoCurrently, with -fsanitize=address, the driver appends libclang_rt.asan.a to
Matt Beaumont-Gay [Tue, 4 Dec 2012 21:18:26 +0000 (21:18 +0000)]
Currently, with -fsanitize=address, the driver appends libclang_rt.asan.a to
the link command. This all works fine when the driver is also responsible for
adding -lstdc++ to the link command. But, if -lstdc++ (or libstdc++.a, etc) is
passed explicitly to the driver, the ASan runtime will appear in the link
command after the standard library, leading to multiple-definition errors for
the global 'operator new' and 'operator delete'. Fix this in a painfully
simple way, by inserting libclang_rt.asan.a at the start of the link command
instead of the end.

If we need to do something more clever, we can walk the link command looking
for something that resembles libstdc++ and insert libclang_rt.asan.a as late
as possible, but the simple solution works for now.

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

11 years agoTesting C declarations embedded in
Fariborz Jahanian [Tue, 4 Dec 2012 21:15:23 +0000 (21:15 +0000)]
Testing C declarations embedded in
<declaration> tag of Comment XML and fixed a
missing block literal printout as result of the testing.
// rdar://12378714

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

11 years agoAdd missing destructors found with -Wnon-virtual-dtor.
Daniel Jasper [Tue, 4 Dec 2012 21:05:31 +0000 (21:05 +0000)]
Add missing destructors found with -Wnon-virtual-dtor.

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

11 years agoAdapt to LLVM commit 169291 which streamlines the usage of NaCl/NativeClient
Eli Bendersky [Tue, 4 Dec 2012 18:38:10 +0000 (18:38 +0000)]
Adapt to LLVM commit 169291 which streamlines the usage of NaCl/NativeClient
in the triple.

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

11 years agoadditional test for declaration tag of a class extension.
Fariborz Jahanian [Tue, 4 Dec 2012 18:25:34 +0000 (18:25 +0000)]
additional test for declaration tag of a class extension.
// rdar://12378714

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

11 years agoError recovery part 2
Alexander Kornienko [Tue, 4 Dec 2012 17:27:50 +0000 (17:27 +0000)]
Error recovery part 2

Summary: Adds recovery for structural errors in clang-format.

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, silvas
Differential Revision: http://llvm-reviews.chandlerc.com/D164

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

11 years agoobjective-c blocks: Consider padding due to alignment
Fariborz Jahanian [Tue, 4 Dec 2012 17:20:57 +0000 (17:20 +0000)]
objective-c blocks: Consider padding due to alignment
after the fixed size block header when generating
captured block variable info. // rdar://12773256

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

11 years agoClang-format error recovery part 1
Alexander Kornienko [Tue, 4 Dec 2012 15:40:36 +0000 (15:40 +0000)]
Clang-format error recovery part 1

Reviewers: klimek

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

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

11 years agoc-index-test.c: Make C89-compliant.
NAKAMURA Takumi [Tue, 4 Dec 2012 15:32:03 +0000 (15:32 +0000)]
c-index-test.c: Make C89-compliant.

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

11 years agolibclang: Add a function to libclang for retrieving the bit width value
Dmitri Gribenko [Tue, 4 Dec 2012 15:13:46 +0000 (15:13 +0000)]
libclang: Add a function to libclang for retrieving the bit width value

Patch by Jyun-Yan You.

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

11 years agoMake parenthesis counting and aligning a bit saner.
Daniel Jasper [Tue, 4 Dec 2012 14:54:30 +0000 (14:54 +0000)]
Make parenthesis counting and aligning a bit saner.

Review: http://llvm-reviews.chandlerc.com/D162

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

11 years agoEnum formatting implementation
Alexander Kornienko [Tue, 4 Dec 2012 14:46:19 +0000 (14:46 +0000)]
Enum formatting implementation

Reviewers: djasper, klimek

Reviewed By: klimek

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

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

11 years agoFix spelling I ran over while proof-reading tests.
Manuel Klimek [Tue, 4 Dec 2012 14:42:08 +0000 (14:42 +0000)]
Fix spelling I ran over while proof-reading tests.

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

11 years agoToolChains.cpp: Fixup r169260, clang/Config/config.h needs to be listed *last*, or...
NAKAMURA Takumi [Tue, 4 Dec 2012 14:31:59 +0000 (14:31 +0000)]
ToolChains.cpp: Fixup r169260, clang/Config/config.h needs to be listed *last*, or llvm/Config/llvm-config.h could not be read in header files.

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

11 years agoFixes crash in isDerivedFrom for recursive templates.
Manuel Klimek [Tue, 4 Dec 2012 13:40:29 +0000 (13:40 +0000)]
Fixes crash in isDerivedFrom for recursive templates.

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

11 years agoSmall fixes to unary operator recognition and handling of include
Daniel Jasper [Tue, 4 Dec 2012 13:02:32 +0000 (13:02 +0000)]
Small fixes to unary operator recognition and handling of include
directives.

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

11 years agoAutotools has the same include guard for both Clang and LLVM's config.h.
Chandler Carruth [Tue, 4 Dec 2012 12:24:59 +0000 (12:24 +0000)]
Autotools has the same include guard for both Clang and LLVM's config.h.
Shuffling order causes the wrong one to win.

CMake didn't exhibit this problem because Clang's has *no* guards.

I'll fix this properly tomorrow when Eric and I can check both build
systems and get them to DTRT, but for now unbreak some bots by hoisting
this header.

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

11 years agoUpdate matcher documentation with script.
Daniel Jasper [Tue, 4 Dec 2012 12:08:08 +0000 (12:08 +0000)]
Update matcher documentation with script.

We still need to make the python script understand some of the new
matchers, but this should be an improvement.

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

11 years agoAdd parameterCountIs() matcher.
Daniel Jasper [Tue, 4 Dec 2012 11:54:27 +0000 (11:54 +0000)]
Add parameterCountIs() matcher.

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

11 years agoReplace workarounds with correct fixes.
Daniel Jasper [Tue, 4 Dec 2012 10:50:12 +0000 (10:50 +0000)]
Replace workarounds with correct fixes.

Also fix header guard.

http://llvm-reviews.chandlerc.com/D159

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

11 years agoSort the #include lines under utils/...
Chandler Carruth [Tue, 4 Dec 2012 09:53:39 +0000 (09:53 +0000)]
Sort the #include lines under utils/...

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

11 years agoReally sort the #include lines in unittests/...
Chandler Carruth [Tue, 4 Dec 2012 09:53:37 +0000 (09:53 +0000)]
Really sort the #include lines in unittests/...

I forgot to re-sort after fixing main module headers.

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

11 years agoSort the #include lines for unittests/...
Chandler Carruth [Tue, 4 Dec 2012 09:45:34 +0000 (09:45 +0000)]
Sort the #include lines for unittests/...

I've tried to place sensible headers at the top as main-module headers.

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