]> granicus.if.org Git - clang/log
clang
11 years agoComment parsing: fold named character references test into other HTML tests
Dmitri Gribenko [Wed, 30 Jan 2013 14:44:47 +0000 (14:44 +0000)]
Comment parsing: fold named character references test into other HTML tests

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

11 years agoComment parsing: resolve more named character references
Dmitri Gribenko [Wed, 30 Jan 2013 14:29:28 +0000 (14:29 +0000)]
Comment parsing: resolve more named character references

This reimplements r173850 with a better approach:
(1) use a TableGen-generated matcher instead of doing a linear search;
(2) avoid allocations for new strings by converting code points to string
    iterals with TableGen.

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

11 years agoRevert unintended change
Dmitri Gribenko [Wed, 30 Jan 2013 12:40:40 +0000 (12:40 +0000)]
Revert unintended change

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

11 years agoIndex/special-html-characters.m: mark this as XFAIL for valgrind
Dmitri Gribenko [Wed, 30 Jan 2013 12:17:33 +0000 (12:17 +0000)]
Index/special-html-characters.m: mark this as XFAIL for valgrind

Fix is being discussed on cfe-dev.

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

11 years agoMove UTF conversion routines from clang/lib/Basic to llvm/lib/Support
Dmitri Gribenko [Wed, 30 Jan 2013 12:06:08 +0000 (12:06 +0000)]
Move UTF conversion routines from clang/lib/Basic to llvm/lib/Support

This is required to use them in TableGen.

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

11 years agoAlso promote fp16 types to double when they're anonymous variadic arguments.
Tim Northover [Wed, 30 Jan 2013 09:46:55 +0000 (09:46 +0000)]
Also promote fp16 types to double when they're anonymous variadic arguments.

__fp16 isn't covered by the standard, but this resolves the oddity that float
gets promoted when passed variadically, but not the smaller type. This is
required by the AArch64 ABI, and a sane action elsewhere.

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

11 years agoDon't generate no-op replacements.
Daniel Jasper [Wed, 30 Jan 2013 09:46:12 +0000 (09:46 +0000)]
Don't generate no-op replacements.

No functional changes.

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

11 years agoAdd "instancetype" as a code completion result for the return type of
Douglas Gregor [Wed, 30 Jan 2013 07:11:43 +0000 (07:11 +0000)]
Add "instancetype" as a code completion result for the return type of
an Objective-C method. Fixes <rdar://problem/13069990>.

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

11 years agoThe instance methods of the root class of an Objective-C hieararchy
Douglas Gregor [Wed, 30 Jan 2013 06:58:39 +0000 (06:58 +0000)]
The instance methods of the root class of an Objective-C hieararchy
can be messaged via the metaclass. Provide code completions for this
case. Fixes <rdar://problem/12560296>.

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

11 years agoC11: Provide the missing half of <stdalign.h>
Richard Smith [Wed, 30 Jan 2013 06:33:54 +0000 (06:33 +0000)]
C11: Provide the missing half of <stdalign.h>

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

11 years agoFix test failure from previous change.
Richard Smith [Wed, 30 Jan 2013 06:27:44 +0000 (06:27 +0000)]
Fix test failure from previous change.

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

11 years agoSemantic analysis and CodeGen support for C11's _Noreturn. This is modeled as
Richard Smith [Wed, 30 Jan 2013 05:45:05 +0000 (05:45 +0000)]
Semantic analysis and CodeGen support for C11's _Noreturn. This is modeled as
an attribute for consistency with our other noreturn mechanisms.

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

11 years agoDon't warn on fall-through from unreachable code.
Alexander Kornienko [Wed, 30 Jan 2013 03:49:44 +0000 (03:49 +0000)]
Don't warn on fall-through from unreachable code.

Summary:
A motivating example:
class ClassWithDtor {
public:
  ~ClassWithDtor() {}
};
void fallthrough3(int n) {
  switch (n) {
    case 2:
      do {
        ClassWithDtor temp;
        return;
      } while (0);  // This generates a chain of unreachable CFG blocks.
    case 3:
      break;
  }
}

Reviewers: rsmith, doug.gregor, alexfh

Reviewed By: alexfh

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

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

11 years agoUnresolved lookups can have using declarations that refer to
Douglas Gregor [Wed, 30 Jan 2013 02:10:08 +0000 (02:10 +0000)]
Unresolved lookups can have using declarations that refer to
unresolved using declarations. Fixes PR14768 / <rdar://problem/13030296>.

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

11 years agoDon't warn about Unicode characters in -E mode.
Jordan Rose [Wed, 30 Jan 2013 01:52:57 +0000 (01:52 +0000)]
Don't warn about Unicode characters in -E mode.

People use the C preprocessor for things other than C files. Some of them
have Unicode characters. We shouldn't warn about Unicode characters
appearing outside of identifiers in this case.

There's not currently a way for the preprocessor to tell if it's in -E mode,
so I added a new flag, derived from the PreprocessorOutputOptions. This is
only used by the Unicode warnings for now, but could conceivably be used by
other warnings or even behavioral differences later.

<rdar://problem/13107323>

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

11 years ago[Sema] Constrain test added in r173873 with expected-error-re
David Blaikie [Wed, 30 Jan 2013 01:43:36 +0000 (01:43 +0000)]
[Sema] Constrain test added in r173873 with expected-error-re

Suggested in post-commit review by Richard Smith.

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

11 years agoProvide a fixit for constexpr non-static data members.
David Blaikie [Wed, 30 Jan 2013 01:22:18 +0000 (01:22 +0000)]
Provide a fixit for constexpr non-static data members.

If the member has an initializer, assume it was probably intended to be static
and suggest/recover with that.

If the member doesn't have an initializer, assume it was probably intended to
be const instead of constexpr and suggest that.

(if the attempt to apply these changes fails, don't make any suggestion &
produce the same diagnostic experience as before. The only case where this can
come up that I know of is with a mutable constexpr with an initializer, since
mutable is incompatible with static (but it's already incompatible with
const anyway))

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

11 years agoc: When checking on validity of sizeof passed as size of
Fariborz Jahanian [Wed, 30 Jan 2013 01:12:44 +0000 (01:12 +0000)]
c: When checking on validity of sizeof passed as size of
argument to be memset, check for its type to be complete
before calling Context.getTypeSize(PointeeTy) to prevent
crash. // rdar://13081751.

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

11 years ago[Frontend] Factor AddUnmappedPath() out of AddPath() and simplify.
Daniel Dunbar [Wed, 30 Jan 2013 01:06:03 +0000 (01:06 +0000)]
[Frontend] Factor AddUnmappedPath() out of AddPath() and simplify.

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

11 years ago[Frontend] Remove HeaderSearchOptions::Entry::IsInternal, which is unused.
Daniel Dunbar [Wed, 30 Jan 2013 00:34:26 +0000 (00:34 +0000)]
[Frontend] Remove HeaderSearchOptions::Entry::IsInternal, which is unused.

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

11 years agoclang/test/Driver/asan-ld.c: Try not to mismatch temporary file, like "tmpkcfdld".
NAKAMURA Takumi [Wed, 30 Jan 2013 00:21:41 +0000 (00:21 +0000)]
clang/test/Driver/asan-ld.c: Try not to mismatch temporary file, like "tmpkcfdld".

If we had the regular expression "\b" in FileCheck like Perl...

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

11 years ago[Frontend] Remove actual ImplicitExternC member variable.
Daniel Dunbar [Wed, 30 Jan 2013 00:20:43 +0000 (00:20 +0000)]
[Frontend] Remove actual ImplicitExternC member variable.

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

11 years ago[Frontend] Add an ExternCSystem include entry group.
Daniel Dunbar [Wed, 30 Jan 2013 00:19:24 +0000 (00:19 +0000)]
[Frontend] Add an ExternCSystem include entry group.

 - The only group where it makes sense for the "ExternC" bit is System, so this
   simplifies having to have the extra isCXXAware (or ImplicitExternC, depending
   on what code you talk to) bit caried around.

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

11 years agoRemoved couple of html named character references in
Fariborz Jahanian [Wed, 30 Jan 2013 00:10:09 +0000 (00:10 +0000)]
Removed couple of html named character references in
my last patch.

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

11 years ago[Frontend] Make the include dir group independent from the "use sysroot" bit.
Daniel Dunbar [Tue, 29 Jan 2013 23:59:45 +0000 (23:59 +0000)]
[Frontend] Make the include dir group independent from the "use sysroot" bit.

 - This slightly decouples the path handling, since before the group sometimes
   dominated the "use sysroot" bit, but it was still passed in via the API.

 - No functionality change.

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

11 years ago[Frontend] Rename a member variable to clarify its intent.
Daniel Dunbar [Tue, 29 Jan 2013 23:59:43 +0000 (23:59 +0000)]
[Frontend] Rename a member variable to clarify its intent.

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

11 years ago[Frontend] Factor out helper function, for clarity.
Daniel Dunbar [Tue, 29 Jan 2013 23:59:37 +0000 (23:59 +0000)]
[Frontend] Factor out helper function, for clarity.

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

11 years ago[driver] Clear the FailureResultFiles when initializing clang diagnostics. Also,
Chad Rosier [Tue, 29 Jan 2013 23:57:10 +0000 (23:57 +0000)]
[driver] Clear the FailureResultFiles when initializing clang diagnostics. Also,
minor cleanup.

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

11 years ago[Doc parsing] Patch to parse Doxygen-supported HTML character
Fariborz Jahanian [Tue, 29 Jan 2013 23:42:26 +0000 (23:42 +0000)]
[Doc parsing] Patch to parse Doxygen-supported HTML character
references to their UTIF-8 encoding. Reviewed offline by Doug.
// rdar://12392215

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

11 years ago[ubsan] Implement the -fcatch-undefined-behavior flag using a trapping
Chad Rosier [Tue, 29 Jan 2013 23:31:22 +0000 (23:31 +0000)]
[ubsan] Implement the -fcatch-undefined-behavior flag using a trapping
implementation; this is much more inline with the original implementation
(i.e., pre-ubsan) and does not require run-time library support.

The trapping implementation can be invoked using either '-fcatch-undefined-behavior'
or '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error', with the latter
being preferred.  Eventually, the -fcatch-undefined-behavior' flag will be removed.

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

11 years agoclang/test/Index/getcursor-preamble.m: Formatting.
NAKAMURA Takumi [Tue, 29 Jan 2013 23:03:22 +0000 (23:03 +0000)]
clang/test/Index/getcursor-preamble.m: Formatting.

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

11 years agoclang/test/Index/getcursor-preamble.m: Tweak for win32. env(1) is required to change...
NAKAMURA Takumi [Tue, 29 Jan 2013 23:03:16 +0000 (23:03 +0000)]
clang/test/Index/getcursor-preamble.m: Tweak for win32. env(1) is required to change variables locally.

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

11 years agoMove -Wstatic-float-init fixit into a note & don't recover as if constexpr
David Blaikie [Tue, 29 Jan 2013 22:26:08 +0000 (22:26 +0000)]
Move -Wstatic-float-init fixit into a note & don't recover as if constexpr

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

11 years agoDon't fixit/recover from -Wstatic-float-init when it's not an error.
David Blaikie [Tue, 29 Jan 2013 21:40:37 +0000 (21:40 +0000)]
Don't fixit/recover from -Wstatic-float-init when it's not an error.

Fix to change r173414 that lead to Clang changing const to constexpr even under
-Wno-static-float-init.

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

11 years agoMove the token annotator into separate files.
Daniel Jasper [Tue, 29 Jan 2013 21:01:14 +0000 (21:01 +0000)]
Move the token annotator into separate files.

No functional changes. Also removed experimental-warning from all of
clang-format's files, as it is no longer accurate.

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

11 years ago[Preprocessor] When checking if we can concatenate two tokens, check
Argyrios Kyrtzidis [Tue, 29 Jan 2013 20:28:24 +0000 (20:28 +0000)]
[Preprocessor] When checking if we can concatenate two tokens, check
if they were already concatenated in source using the spelling locations
even if they came from a macro expansion.

This fixes an issue where a GUID passed as macro argument ends up
malformed after preprocessing because we added spaces inside it.

rdar://13016645

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

11 years ago[driver] Refactor the driver so that a failing commands doesn't prevent
Chad Rosier [Tue, 29 Jan 2013 20:15:05 +0000 (20:15 +0000)]
[driver] Refactor the driver so that a failing commands doesn't prevent
subsequent commands from being executed.

The diagnostics generation isn't designed for this use case, so add a note to
fix this in the very near future.  For now, just generated the diagnostics for
the first failing command.
Part of rdar://12984531

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

11 years agoImprove formatting of code with comments.
Daniel Jasper [Tue, 29 Jan 2013 19:41:55 +0000 (19:41 +0000)]
Improve formatting of code with comments.

Before:
aaaaaaa(aaaaaa( // comment
                aaaaaaa));
<big mess>

After:
aaaaaaa(aaaaaa( // comment
    aaaaaaaa));
function(/* parameter 1 */ aaaaaaa,
         /* parameter 2 */ aaaaaaa,
         /* parameter 3 */ aaaaaaa,
         /* parameter 4 */ aaaaaaa);

(the latter example was only wrong in the one-arg-per-line mode, e.g. in
Google style).

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

11 years agoMark a struct definition in an objc container with the TopLevelDeclInObjCContainer...
Argyrios Kyrtzidis [Tue, 29 Jan 2013 18:00:54 +0000 (18:00 +0000)]
Mark a struct definition in an objc container with the TopLevelDeclInObjCContainer bit.

Fixes accurately getting a cursor inside an objc container containing a struct definition,
from a PCH/preamble file.

rdar://12584613

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

11 years agoAllow all parameters on next line for function calls in Chrome.
Daniel Jasper [Tue, 29 Jan 2013 16:03:49 +0000 (16:03 +0000)]
Allow all parameters on next line for function calls in Chrome.

The style guide only forbids this for function declarations. So,
now

someFunction(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

Is allowed in Chromium mode.

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

11 years agoSplit ">>" in "A<B<C> >" in Chromium style.
Daniel Jasper [Tue, 29 Jan 2013 15:19:38 +0000 (15:19 +0000)]
Split ">>" in "A<B<C> >" in Chromium style.

It needs to be compatible with C++03.

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

11 years agoFix uninitialized error caused by r173801.
Daniel Jasper [Tue, 29 Jan 2013 15:15:59 +0000 (15:15 +0000)]
Fix uninitialized error caused by r173801.

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

11 years agoFix a crash in OpenCL code by using the proper (RHS) bit-width.
Joey Gouly [Tue, 29 Jan 2013 15:09:40 +0000 (15:09 +0000)]
Fix a crash in OpenCL code by using the proper (RHS) bit-width.

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

11 years agoCalculate the split penalty upfront.
Daniel Jasper [Tue, 29 Jan 2013 15:03:01 +0000 (15:03 +0000)]
Calculate the split penalty upfront.

This is
a) More efficient.
b) Important as we move forward with further metrics for penalty.

No functional changes intended.

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

11 years agoFix a comment and reformat clang-format with clang-format
Daniel Jasper [Tue, 29 Jan 2013 11:27:30 +0000 (11:27 +0000)]
Fix a comment and reformat clang-format with clang-format

Not all changes might be ideal, but IMO all are acceptable.

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

11 years agoInitial support for multiple variable declarations.
Daniel Jasper [Tue, 29 Jan 2013 11:21:01 +0000 (11:21 +0000)]
Initial support for multiple variable declarations.

Before:
  SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(),
      aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa();
After:
  SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(),
           aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa();

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

11 years agoAdd a diagnostic for an OpenCL kernel with a pointer pointer argument.
Joey Gouly [Tue, 29 Jan 2013 10:54:06 +0000 (10:54 +0000)]
Add a diagnostic for an OpenCL kernel with a pointer pointer argument.
Also refactor the surrounding code a little.

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

11 years agoTest update missed in r173789.
Richard Smith [Tue, 29 Jan 2013 10:18:33 +0000 (10:18 +0000)]
Test update missed in r173789.

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

11 years agoProduce a diagnostic if alignas is applied to an expression. Neither C11 nor
Richard Smith [Tue, 29 Jan 2013 10:18:18 +0000 (10:18 +0000)]
Produce a diagnostic if alignas is applied to an expression. Neither C11 nor
C++11 allows that.

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

11 years agoDowngrade 'attribute ignored when parsing type' from error to warning, to match
Richard Smith [Tue, 29 Jan 2013 10:02:16 +0000 (10:02 +0000)]
Downgrade 'attribute ignored when parsing type' from error to warning, to match
the diagnostic's warn_ name. Switch some places (notably C++11 attributes)
which really wanted an error over to a different diagnostic. Finally, suppress
the diagnostic entirely for __ptr32, __ptr64 and __w64, to avoid producing
diagnostics in important system headers.

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

11 years agoReverting changes from r173785 (removing empty lines before "}").
Daniel Jasper [Tue, 29 Jan 2013 10:00:16 +0000 (10:00 +0000)]
Reverting changes from r173785 (removing empty lines before "}").

This needs some more thinking, e.g. for namespaces, chains of if-else
if, ...

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

11 years agoRemove empty lines before "}".
Daniel Jasper [Tue, 29 Jan 2013 09:42:11 +0000 (09:42 +0000)]
Remove empty lines before "}".

Those empty lines waste vertical whitespace and almost never
increase readability.

Before:
void f() {
  DoSomething();

}

After:
void f() {
  DoSomething();
}

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

11 years agoImplement C++11 [dcl.align]p1 and C11 6.7.5/2 rules for alignas and _Alignas.
Richard Smith [Tue, 29 Jan 2013 09:02:09 +0000 (09:02 +0000)]
Implement C++11 [dcl.align]p1 and C11 6.7.5/2 rules for alignas and _Alignas.

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

11 years agoC++11 status:
Richard Smith [Tue, 29 Jan 2013 04:55:18 +0000 (04:55 +0000)]
C++11 status:
 * Mark 'sequence points' as done now we have a warning for unsequenced operations
 * Mark 'memory model' as done now we correctly model bitfield operations

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

11 years agoPropagate the spelling list index for an attribute across template instantiation.
Richard Smith [Tue, 29 Jan 2013 04:21:28 +0000 (04:21 +0000)]
Propagate the spelling list index for an attribute across template instantiation.

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

11 years agoPR15017: A '>' can appear after a type-specifier in a template-argument-list.
Richard Smith [Tue, 29 Jan 2013 04:13:32 +0000 (04:13 +0000)]
PR15017: A '>' can appear after a type-specifier in a template-argument-list.
It turns out that there's no correctness bug here (because we can't have a type
definition in this location), but there was a diagnostic bug.

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

11 years agoAdd a test case for attribute print.
Michael Han [Tue, 29 Jan 2013 04:13:20 +0000 (04:13 +0000)]
Add a test case for attribute print.

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

11 years agoModify the tests for the (sorted) order that the attributes come out as now.
Bill Wendling [Tue, 29 Jan 2013 03:21:00 +0000 (03:21 +0000)]
Modify the tests for the (sorted) order that the attributes come out as now.

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

11 years agoPR15100: look through type sugar when determining whether we have one of the
Richard Smith [Tue, 29 Jan 2013 02:49:47 +0000 (02:49 +0000)]
PR15100: look through type sugar when determining whether we have one of the
forms of 'main' which we accept as an extension.

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

11 years agoFold tests for C++ 'main' into a single file.
Richard Smith [Tue, 29 Jan 2013 02:42:09 +0000 (02:42 +0000)]
Fold tests for C++ 'main' into a single file.

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

11 years agoTest that we print MS keyword attributes without a __declspec(...) adornment.
Richard Smith [Tue, 29 Jan 2013 02:31:57 +0000 (02:31 +0000)]
Test that we print MS keyword attributes without a __declspec(...) adornment.

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

11 years agoTreat alignas and _Alignas as keyword attributes. This allows us to
Richard Smith [Tue, 29 Jan 2013 01:48:07 +0000 (01:48 +0000)]
Treat alignas and _Alignas as keyword attributes. This allows us to
pretty-print them properly (modulo the more general badness in alignment
attribute printing).

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

11 years agoActually remove the hack which was blocking the Borland-style attributes from
Richard Smith [Tue, 29 Jan 2013 01:38:41 +0000 (01:38 +0000)]
Actually remove the hack which was blocking the Borland-style attributes from
working, and add the missing attribute spellings. This brings _pascal,
_fastcall, _stdcall and _cdecl to life in -fborland-extensions mode.

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

11 years agoDon't crash while printing APValues that are lvalues casted to a
Douglas Gregor [Tue, 29 Jan 2013 01:26:43 +0000 (01:26 +0000)]
Don't crash while printing APValues that are lvalues casted to a
decidedly non-reference, non-pointer type. Fixes <rdar://problem/13090123>.

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

11 years agoReplace AS_MSTypespec with AS_Keyword, for representing any attribute spelled
Richard Smith [Tue, 29 Jan 2013 01:24:26 +0000 (01:24 +0000)]
Replace AS_MSTypespec with AS_Keyword, for representing any attribute spelled
as a keyword. Rationalize existing attributes to use it as appropriate, and to
not lie about some __declspec attributes being GNU attributes. In passing,
remove a gross hack which was discarding attributes which we could handle. This
results in us actually respecting the __pascal keyword again.

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

11 years agoAbstract the behavior of when to use base-class tail padding.
John McCall [Tue, 29 Jan 2013 01:14:22 +0000 (01:14 +0000)]
Abstract the behavior of when to use base-class tail padding.

For fun, I added a comedy "actually obey the C++11 POD rules" option
which nobody is allowed to use.

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

11 years agoFinish semantic analysis for [[carries_dependency]] attribute.
Richard Smith [Mon, 28 Jan 2013 22:42:45 +0000 (22:42 +0000)]
Finish semantic analysis for [[carries_dependency]] attribute.

This required plumbing through a new flag to determine whether a ParmVarDecl is
actually a parameter of a function declaration (as opposed to a function
typedef etc, where the attribute is prohibited). Weirdly, this attribute (just
like [[noreturn]]) cannot be applied to a function type, just to a function
declaration (and its parameters).

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

11 years agoFileCheck'ize tests
Dmitri Gribenko [Mon, 28 Jan 2013 21:43:46 +0000 (21:43 +0000)]
FileCheck'ize tests

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

11 years agoFileCheck'ize a test
Dmitri Gribenko [Mon, 28 Jan 2013 21:04:29 +0000 (21:04 +0000)]
FileCheck'ize a test

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

11 years agoMigrate a test to -verify
Dmitri Gribenko [Mon, 28 Jan 2013 20:55:54 +0000 (20:55 +0000)]
Migrate a test to -verify

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

11 years ago[driver] Revise this test to remove the dependency on the integrate assembler.
Chad Rosier [Mon, 28 Jan 2013 20:51:27 +0000 (20:51 +0000)]
[driver] Revise this test to remove the dependency on the integrate assembler.

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

11 years agoFileCheck'ize and merge tests
Dmitri Gribenko [Mon, 28 Jan 2013 20:40:50 +0000 (20:40 +0000)]
FileCheck'ize and merge tests

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

11 years agoUndo my re-wording of the "ARC forbids Objective-C objects in ..."
Douglas Gregor [Mon, 28 Jan 2013 20:13:44 +0000 (20:13 +0000)]
Undo my re-wording of the "ARC forbids Objective-C objects in ..."
error. Jordan is right.

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

11 years agoForbid the use of objects in unions in Objective-C++ ARC. Fixes
Douglas Gregor [Mon, 28 Jan 2013 19:08:09 +0000 (19:08 +0000)]
Forbid the use of objects in unions in Objective-C++ ARC. Fixes
<rdar://problem/13098104>.

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

11 years agoEnable the global module index by default. Introduce the
Douglas Gregor [Mon, 28 Jan 2013 18:38:02 +0000 (18:38 +0000)]
Enable the global module index by default. Introduce the
-fno-modules-global-index -cc1 option to allow one to disable the
index for performance testing purposes, but with a 10% win in
-fsyntax-only time, there is no reason a user would do this.

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

11 years agoASTReader and profiling statistics indicate that implementing a method
Douglas Gregor [Mon, 28 Jan 2013 18:29:39 +0000 (18:29 +0000)]
ASTReader and profiling statistics indicate that implementing a method
pool in the global module index is not worthwhile. Update comments to
limit the scope of the global module index to identifiers.

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

11 years agoTests: remove disabled llvm-gcc invocations
Dmitri Gribenko [Mon, 28 Jan 2013 18:01:33 +0000 (18:01 +0000)]
Tests: remove disabled llvm-gcc invocations

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

11 years agoAdd some more ASTReader statistics for global method pool lookups.
Douglas Gregor [Mon, 28 Jan 2013 17:54:36 +0000 (17:54 +0000)]
Add some more ASTReader statistics for global method pool lookups.

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

11 years agoPR15067 (again): Don't warn about UCNs in C90 if we're raw-lexing.
Jordan Rose [Mon, 28 Jan 2013 17:49:02 +0000 (17:49 +0000)]
PR15067 (again): Don't warn about UCNs in C90 if we're raw-lexing.

Fixes a crash. Thanks, Richard.

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

11 years agoFix comment.
Eric Christopher [Mon, 28 Jan 2013 17:39:03 +0000 (17:39 +0000)]
Fix comment.

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

11 years agoFileCheck'ize and merge tests
Dmitri Gribenko [Mon, 28 Jan 2013 17:31:40 +0000 (17:31 +0000)]
FileCheck'ize and merge tests

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

11 years agoFileCheck'ize test
Dmitri Gribenko [Mon, 28 Jan 2013 17:30:37 +0000 (17:30 +0000)]
FileCheck'ize test

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

11 years agoFix a bug that would lead to bad line break decisions in for loops.
Daniel Jasper [Mon, 28 Jan 2013 17:30:17 +0000 (17:30 +0000)]
Fix a bug that would lead to bad line break decisions in for loops.

Before:
    for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa = aaaaaaaaaaaaaaa
             .aaaaaaaaaaaaaaaa;
         aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {}

After:
    for (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa =
             aaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaa;
         aaaaaaaaaaa != aaaaaaaaaaaaaaaaaaa; ++aaaaaaaaaaa) {}

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

11 years agoBack out r173689. It doesn't matter when we're building with Clang anyway.
Douglas Gregor [Mon, 28 Jan 2013 17:26:34 +0000 (17:26 +0000)]
Back out r173689. It doesn't matter when we're building with Clang anyway.

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

11 years agoEliminate memory allocation from most invocations of
Douglas Gregor [Mon, 28 Jan 2013 16:46:33 +0000 (16:46 +0000)]
Eliminate memory allocation from most invocations of
ModuleManager::visit() by keeping a free list of the two data
structures used to store state (a preallocated stack and a visitation
number vector). Improves -fsyntax-only performance for my modules test
case by 2.8%. Modules has pulled ahead by almost 10% with the global
module index.

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

11 years agoDon't put a function's return type on its own line in Google style.
Daniel Jasper [Mon, 28 Jan 2013 15:40:20 +0000 (15:40 +0000)]
Don't put a function's return type on its own line in Google style.

This would be against the style guide:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Declarations_and_Definitions#Function_Declarations_and_Definitions

Not sure what to do as a last resort if the function signature does not
fit onto a single line in Google style ..

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

11 years agoNote that SrcMgr::SLocEntry's are POD-like, so SmallVector can do a
Douglas Gregor [Mon, 28 Jan 2013 15:39:10 +0000 (15:39 +0000)]
Note that SrcMgr::SLocEntry's are POD-like, so SmallVector can do a
better job with them. Shaves off 0.7% of -fparse-only time for a
modules test case. Sure makes you wonder...

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

11 years agoLet clang-format break after a function's return type.
Daniel Jasper [Mon, 28 Jan 2013 15:16:31 +0000 (15:16 +0000)]
Let clang-format break after a function's return type.

Before:
TypeSpecDecl *TypeSpecDecl::Create(ASTContext &C, DeclContext *DC,
                                   SourceLocation L, IdentifierInfo *II,
                                   Type *T) {}

After:
TypeSpecDecl *
TypeSpecDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L,
                     IdentifierInfo *II, Type *T) {}

This fixes llvm.org/PR14717.

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

11 years agoMake continuations in constructor initializers consistent.
Daniel Jasper [Mon, 28 Jan 2013 13:31:35 +0000 (13:31 +0000)]
Make continuations in constructor initializers consistent.

Before:
Constructor
    : LooooooooooooooooooooongVariable(
        LooooooooooooooooooooongValue) {}

After:
Constructor
    : LooooooooooooooooooooongVariable(
          LooooooooooooooooooooongValue) {}

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

11 years agoInitial support for formatting range-based for-loops.
Daniel Jasper [Mon, 28 Jan 2013 13:21:16 +0000 (13:21 +0000)]
Initial support for formatting range-based for-loops.

Before (in good cases):
for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
     : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
for (auto aaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa,
aaaa)) {}

After:
for (auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa :
     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
for (auto aaaaaaaaaaaaaaaaaaaa :
     aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaa)) {}

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

11 years agoImprove formatting of conditional expressions.
Daniel Jasper [Mon, 28 Jan 2013 12:45:14 +0000 (12:45 +0000)]
Improve formatting of conditional expressions.

Before we did not really systematically format those. Now, we format the
different cases as:

- 1 Line:  a ? b : c;
- 2 Lines: short ? loooooooooong
                 : loooooooooong
- 2 Lines: loooooooooooooooong
               ? short : short
- 3 Lines: loooooooooooooooong
               ? loooooooooooooong
               : loooooooooooooong

Not sure whether "?" and ":" should go on the new line, but it seems to
be the most consistent approach.

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

11 years agoSeveral small changes in formatting decisions.
Daniel Jasper [Mon, 28 Jan 2013 09:35:24 +0000 (09:35 +0000)]
Several small changes in formatting decisions.

1. Use a hanging ident for function calls nested in binary expressions.
   E.g.:
   int aaaaa = aaaaaaaaa && aaaaaaaaaa(
                                aaaaaaaaaa);

2. Slightly improve heuristic for builder type expressions and reduce
   penalty for breaking before "." and "->" in those.

3. Remove  mostly obsolete metric of decreasing indent level. This
   fixes: llvm.org/PR14931.

Changes #1 and #2 were necessary to keep tests passing after #3.

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

11 years agoImprove indentation after breaking at nested name specifiers.
Daniel Jasper [Mon, 28 Jan 2013 07:43:15 +0000 (07:43 +0000)]
Improve indentation after breaking at nested name specifiers.

These always represent a continuation and we should increase the ident.

Before:
aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa::
          aaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa::
              aaaaaaaaaaaaaaaaaaaa);

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

11 years agoAvoid confusing identations for multi-parameter functions.
Daniel Jasper [Mon, 28 Jan 2013 07:35:34 +0000 (07:35 +0000)]
Avoid confusing identations for multi-parameter functions.

Before:
aaaaaaaa(aaaaaaaaa(
    aaaaaaaaaa(),
         aaaaaaaaa);

After:
aaaaaaaa(aaaaaaaaa(
             aaaaaaaaaa(),
         aaaaaaaaa);

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

11 years agoPrint warning instead of error if optional ASan features are enabled w/o specifying...
Alexey Samsonov [Mon, 28 Jan 2013 07:20:44 +0000 (07:20 +0000)]
Print warning instead of error if optional ASan features are enabled w/o specifying -fsanitize=address

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

11 years agoFix a typo in the name of a tooling unit test
Hal Finkel [Mon, 28 Jan 2013 04:37:38 +0000 (04:37 +0000)]
Fix a typo in the name of a tooling unit test

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

11 years agoFix the indentation of the first line of preprocessor output
Hal Finkel [Mon, 28 Jan 2013 04:37:37 +0000 (04:37 +0000)]
Fix the indentation of the first line of preprocessor output

The -E output from clang did not produce the correct indentation on the first line.
This is because MoveToLine returned false, and when this happens,
the regular process for producing initial indentation is skipped.

Thanks to Eli for suggesting a way to simplify this to a one-line change.

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

11 years agoSince ObjCARC has been refactored into its own library with its own declaration heade...
Michael Gottesman [Mon, 28 Jan 2013 01:36:00 +0000 (01:36 +0000)]
Since ObjCARC has been refactored into its own library with its own declaration header, we need to include the declaration header alongside Scalar.h in BackendUtil.

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

11 years agoTests and a minor bugfix for [dcl.attr.depend]p1 (C++11 [[carries_dependency]]
Richard Smith [Mon, 28 Jan 2013 01:15:38 +0000 (01:15 +0000)]
Tests and a minor bugfix for [dcl.attr.depend]p1 (C++11 [[carries_dependency]]
attribute).

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

11 years agoAdd a -pedantic warning: an anonymous union within an anonymous union is not
Richard Smith [Mon, 28 Jan 2013 00:54:05 +0000 (00:54 +0000)]
Add a -pedantic warning: an anonymous union within an anonymous union is not
permitted in standard C++, despite being silently accepted by many (all?) major
C++ implementations.

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