]> granicus.if.org Git - clang/log
clang
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

11 years agoComment parsing: fix test in r173626 for -fms-extensions -fms-compatibility
Dmitri Gribenko [Sun, 27 Jan 2013 22:11:38 +0000 (22:11 +0000)]
Comment parsing: fix test in r173626 for -fms-extensions -fms-compatibility

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

11 years agoDecl printer: fix CXXConstructExpr with implicit default argument
Dmitri Gribenko [Sun, 27 Jan 2013 21:28:24 +0000 (21:28 +0000)]
Decl printer: fix CXXConstructExpr with implicit default argument

Patch by Will Wilson.

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

11 years agoComment parsing: attach any tag type's documentation to its typedef if latter
Dmitri Gribenko [Sun, 27 Jan 2013 21:18:39 +0000 (21:18 +0000)]
Comment parsing: attach any tag type's documentation to its typedef if latter
does not have one of its own. // rdar://13067629

Original patch (r173586 and r173587) by Fariborz Jahanian, modified by me.

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

11 years agoPR15067: Don't assert when a UCN appears in a C90 file.
Jordan Rose [Sun, 27 Jan 2013 20:12:04 +0000 (20:12 +0000)]
PR15067: Don't assert when a UCN appears in a C90 file.

Unfortunately, we can't accept the UCN as an extension because we're
required to treat it as two tokens for preprocessing purposes.

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

11 years ago[CMake][Lit][unittests] Deprecate CMAKE_BUILD_TYPE in each build directory for unittests.
NAKAMURA Takumi [Sun, 27 Jan 2013 12:20:50 +0000 (12:20 +0000)]
[CMake][Lit][unittests] Deprecate CMAKE_BUILD_TYPE in each build directory for unittests.

For example,
cur) unittests/ADT/Release/ADTTests
new) unittests/ADT/ADTTests

RUNTIME_BUILD_MODE can be substituted to CMAKE_CFG_INTDIR.

With Make and Ninja, the tree is not built with multiple configurations.
Then, including the build type in target directory doesn't make sense.
See also "How can I build multiple modes without switching?"
http://www.cmake.org/Wiki/CMake_FAQ
CMAKE_CFG_INTDIR is set to "."

With multiple-configuration-aware build system, like Visual Studio, each unittest is built on appropriate directory, for example,
unittests/ADT/Release/ADTTests.exe
CMAKE_CFG_INTDIR is set to build system's variable, like "$(Configuration)" or "$(OutDir)".

Thus, "--param build_config" is also deprecated.

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

11 years agoRevert r173586 (and r173587) , "Attach any tag type's documentation to its typedef if"
NAKAMURA Takumi [Sun, 27 Jan 2013 11:09:41 +0000 (11:09 +0000)]
Revert r173586 (and r173587) , "Attach any tag type's documentation to its typedef if"

It caused unexpected warnings with @tparam.

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

11 years agoUse the AttributeSet instead of AttributeWithIndex.
Bill Wendling [Sun, 27 Jan 2013 02:46:53 +0000 (02:46 +0000)]
Use the AttributeSet instead of AttributeWithIndex.

In the future, AttributeWithIndex won't be used anymore. Besides, it exposes the
internals of the AttributeSet to outside users, which isn't goodness.

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

11 years agoAdd the missing line return to align parameters of printPretty.
Michael Han [Sun, 27 Jan 2013 00:06:24 +0000 (00:06 +0000)]
Add the missing line return to align parameters of printPretty.

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

11 years agolibclang: refactor CXStringPool: make it a class
Dmitri Gribenko [Sat, 26 Jan 2013 22:44:19 +0000 (22:44 +0000)]
libclang: refactor CXStringPool: make it a class

We are not exposing the pool or string buffers to libclang users, so no need to
maintain a procedural interface.

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

11 years agoPR14566: Debug Info: avoid top level lexical blocks in functions
David Blaikie [Sat, 26 Jan 2013 22:16:26 +0000 (22:16 +0000)]
PR14566: Debug Info: avoid top level lexical blocks in functions

One of the gotchas (see changes to CodeGenFunction) was due to the fix in
r139416 (for PR10829). This only worked previously because the top level
lexical block would set the location to the end of the function, the debug
location would be updated (as per r139416), the location would be set to
the end of the function again (but that would no-op, since it was the same
as the previous location), then the return instruction would be emitted using
the debug location.

Once the top level lexical block was no longer emitted, the end-of-function
location change was causing the debug loc to be updated, regressing that bug.

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

11 years agolibclang: type safety for CXTranslationUnitImpl::CIdx
Dmitri Gribenko [Sat, 26 Jan 2013 21:49:50 +0000 (21:49 +0000)]
libclang: type safety for CXTranslationUnitImpl::CIdx

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

11 years agolibclang: type safety for CXTranslationUnitImpl::FormatContext
Dmitri Gribenko [Sat, 26 Jan 2013 21:39:50 +0000 (21:39 +0000)]
libclang: type safety for CXTranslationUnitImpl::FormatContext

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

11 years agolibclang: some type safety for CXTranslationUnitImpl's internals
Dmitri Gribenko [Sat, 26 Jan 2013 21:32:42 +0000 (21:32 +0000)]
libclang: some type safety for CXTranslationUnitImpl's internals

There is no reason to store pointers as 'void*' in CXTranslationUnitImpl, since
it does not affect libclang ABI.

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

11 years agoFix comment.
Fariborz Jahanian [Sat, 26 Jan 2013 20:50:23 +0000 (20:50 +0000)]
Fix comment.

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

11 years agoAttach any tag type's documentation to its typedef if
Fariborz Jahanian [Sat, 26 Jan 2013 20:49:30 +0000 (20:49 +0000)]
Attach any tag type's documentation to its typedef if
latter does not have one of its own. // rdar://13067629

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

11 years agolibclang: factor out the frequent pattern static_cast<ASTUnit *>(TU->TUData)
Dmitri Gribenko [Sat, 26 Jan 2013 18:53:38 +0000 (18:53 +0000)]
libclang: factor out the frequent pattern static_cast<ASTUnit *>(TU->TUData)
into a getter cxtu::getASTUnit(TU)

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

11 years agolibclang: make getCursorParentDecl() return 'const Decl *'
Dmitri Gribenko [Sat, 26 Jan 2013 18:12:08 +0000 (18:12 +0000)]
libclang: make getCursorParentDecl() return 'const Decl *'

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

11 years agolibclang: change getCursorAttr() to return 'const Attr *'
Dmitri Gribenko [Sat, 26 Jan 2013 18:08:08 +0000 (18:08 +0000)]
libclang: change getCursorAttr() to return 'const Attr *'

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

11 years agoMigrate tests to -verify
Dmitri Gribenko [Sat, 26 Jan 2013 17:11:39 +0000 (17:11 +0000)]
Migrate tests to -verify

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

11 years agoAdded ASTContext methods getIntPtrType and getUIntPtrType.
Enea Zaffanella [Sat, 26 Jan 2013 17:08:37 +0000 (17:08 +0000)]
Added ASTContext methods getIntPtrType and getUIntPtrType.

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

11 years ago<limits.h> includes <linux/limits.h> on Linux, no need to special-case it
Dmitri Gribenko [Sat, 26 Jan 2013 16:29:36 +0000 (16:29 +0000)]
<limits.h> includes <linux/limits.h> on Linux, no need to special-case it

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

11 years agolibclang: make getCursorStmt() and getCursorExpr() return const pointers
Dmitri Gribenko [Sat, 26 Jan 2013 15:29:08 +0000 (15:29 +0000)]
libclang: make getCursorStmt() and getCursorExpr() return const pointers

Also change EnqueueVisitor to use ConstStmtVisitor as a consequence.

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

11 years agoSpecify non-GNU-ARM triples for key-function test.
Tim Northover [Sat, 26 Jan 2013 15:27:54 +0000 (15:27 +0000)]
Specify non-GNU-ARM triples for key-function test.

Since ARM has diverging ABIs on this detail, it's probably worth
testing both it and a "normal" Itanium system.

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

11 years agoConstify getOptionalExplicitTemplateArgs()
Dmitri Gribenko [Sat, 26 Jan 2013 15:24:56 +0000 (15:24 +0000)]
Constify getOptionalExplicitTemplateArgs()

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

11 years agoConstify some getters of DesignatedInitExpr
Dmitri Gribenko [Sat, 26 Jan 2013 15:15:52 +0000 (15:15 +0000)]
Constify some getters of DesignatedInitExpr

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

11 years agoclang/test/Misc/diag-template-diffing-color.cpp: Symbolize color sequences in FileCheck.
NAKAMURA Takumi [Sat, 26 Jan 2013 06:13:05 +0000 (06:13 +0000)]
clang/test/Misc/diag-template-diffing-color.cpp: Symbolize color sequences in FileCheck.

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

11 years ago[libclang] Introduce clang_getFileUniqueID which returns a struct
Argyrios Kyrtzidis [Sat, 26 Jan 2013 04:52:52 +0000 (04:52 +0000)]
[libclang] Introduce clang_getFileUniqueID which returns a struct
for a CXFile containing device/inode/modification time.

Intended to be useful as a key associated with a unique file across
an indexing session.

rdar://13091837

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

11 years agoclang/test/Misc/ast-dump-color.cpp: Symbolize color sequences in FileCheck.
NAKAMURA Takumi [Sat, 26 Jan 2013 03:48:55 +0000 (03:48 +0000)]
clang/test/Misc/ast-dump-color.cpp: Symbolize color sequences in FileCheck.

FIXME: If FileCheck had expressions something predefined well-known...

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

11 years ago[analyzer] C++ initializers may require cleanups; look through these.
Jordan Rose [Sat, 26 Jan 2013 03:16:31 +0000 (03:16 +0000)]
[analyzer] C++ initializers may require cleanups; look through these.

When the analyzer sees an initializer, it checks if the initializer
contains a CXXConstructExpr. If so, it trusts that the CXXConstructExpr
does the necessary work to initialize the object, and performs no further
initialization.

This patch looks through any implicit wrapping expressions like
ExprWithCleanups to find the CXXConstructExpr inside.

Fixes PR15070.

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

11 years agoGive a more informative error message when the dot or arrow operator is used
Richard Trieu [Sat, 26 Jan 2013 02:31:38 +0000 (02:31 +0000)]
Give a more informative error message when the dot or arrow operator is used
on a type.  Currently, it gives a generic "expected unqualified-id" error.
The new error message is "cannot use (dot|arrow) operator on a type".

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

11 years agoFix mismatch between pointer and pointee type when diagnosing an incorrect
Richard Smith [Sat, 26 Jan 2013 02:07:32 +0000 (02:07 +0000)]
Fix mismatch between pointer and pointee type when diagnosing an incorrect
object argument type for a member call.

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

11 years agoFix test case by being more lenient on what to accept as a path name.
Richard Trieu [Sat, 26 Jan 2013 01:54:31 +0000 (01:54 +0000)]
Fix test case by being more lenient on what to accept as a path name.

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

11 years agoRemove function that is newly dead as of r173538.
Nick Lewycky [Sat, 26 Jan 2013 01:36:54 +0000 (01:36 +0000)]
Remove function that is newly dead as of r173538.

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

11 years agoHopefuly unbreak buldbot.
Fariborz Jahanian [Sat, 26 Jan 2013 01:35:28 +0000 (01:35 +0000)]
Hopefuly unbreak buldbot.

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

11 years agoHighlight various parts of the AST dump with color. Colors are controlled by
Richard Trieu [Sat, 26 Jan 2013 01:31:20 +0000 (01:31 +0000)]
Highlight various parts of the AST dump with color.  Colors are controlled by
-f(no-)color-diagnostics.  In addition, dumpColor() function calls are added
to force color printing.  No structural changes to -ast-dump.

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

11 years ago[analyzer] Track null object lvalues back through C++ method calls.
Jordan Rose [Sat, 26 Jan 2013 01:28:23 +0000 (01:28 +0000)]
[analyzer] Track null object lvalues back through C++ method calls.

The expression 'a->b.c()' contains a call to the 'c' method of 'a->b'.
We emit an error if 'a' is NULL, but previously didn't actually track
the null value back through the 'a->b' expression, which caused us to
miss important false-positive-suppression cases, including
<rdar://problem/12676053>.

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

11 years ago[analyzer] bugreporter::getDerefExpr now takes a Stmt, not an ExplodedNode.
Jordan Rose [Sat, 26 Jan 2013 01:28:19 +0000 (01:28 +0000)]
[analyzer] bugreporter::getDerefExpr now takes a Stmt, not an ExplodedNode.

This allows it to be used in places where the interesting statement
doesn't match up with the current node. No functionality change.

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

11 years ago[analyzer] Add 'prune-paths' config option to disable path pruning.
Jordan Rose [Sat, 26 Jan 2013 01:28:15 +0000 (01:28 +0000)]
[analyzer] Add 'prune-paths' config option to disable path pruning.

This should be used for testing only. Path pruning is still on by default.

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

11 years ago[analyzer] Rename PruneNullReturnPaths to SuppressNullReturnPaths.
Jordan Rose [Sat, 26 Jan 2013 01:28:09 +0000 (01:28 +0000)]
[analyzer] Rename PruneNullReturnPaths to SuppressNullReturnPaths.

"Prune" is the term for eliminating pieces of a path that are not
relevant to the user. "Suppress" means don't show that path at all.

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

11 years agoFix up the test.
Fariborz Jahanian [Sat, 26 Jan 2013 01:25:32 +0000 (01:25 +0000)]
Fix up the test.
for // rdar://11861085

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

11 years agoSince we're stuck with realpath for the header <-> module mapping,
Douglas Gregor [Sat, 26 Jan 2013 00:55:12 +0000 (00:55 +0000)]
Since we're stuck with realpath for the header <-> module mapping,
factor the realpath calls into FileManager::getCanonicalName() so we
can cache the results of this epically slow operation. 5% speedup on
my modules test, and realpath drops out of the profile.

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

11 years agoRevert r172285 (suppressing a 'redundant' -Wc++98-compat warning) and add a
Richard Smith [Sat, 26 Jan 2013 00:39:02 +0000 (00:39 +0000)]
Revert r172285 (suppressing a 'redundant' -Wc++98-compat warning) and add a
testcase for a situation it caused us to miss.

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

11 years agoComment parsing: actually check for a block command after "\param x"
Dmitri Gribenko [Sat, 26 Jan 2013 00:36:14 +0000 (00:36 +0000)]
Comment parsing: actually check for a block command after "\param x"

This fixes PR15068.

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

11 years agoPreserve Sema::UndefinedInternals across PCH boundaries. Fixes
Nick Lewycky [Sat, 26 Jan 2013 00:35:08 +0000 (00:35 +0000)]
Preserve Sema::UndefinedInternals across PCH boundaries. Fixes
-Wundefined-internal warnings with PCH.

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

11 years agopatch for PR9027 and // rdar://11861085
Fariborz Jahanian [Fri, 25 Jan 2013 23:57:05 +0000 (23:57 +0000)]
patch for PR9027 and // rdar://11861085
Title: [PR9027] volatile struct bug: member is not loaded at -O;
This is caused by last flag passed to @llvm.memcpy being false,
not honoring that aggregate has at least one 'volatile' data member
(even though aggregate itself has not been qualified as 'volatile'.
As a result, optimization optimizes away the memcpy altogether.
Patch review by John MaCall (I still need to fix up a test though).

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

11 years agoclang/test/Index/annotate-comments-typedef.m: Remove CommentXMLValid in CHECKs. Don...
NAKAMURA Takumi [Fri, 25 Jan 2013 23:56:54 +0000 (23:56 +0000)]
clang/test/Index/annotate-comments-typedef.m: Remove CommentXMLValid in CHECKs. Don't assume libxml2 here.

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

11 years agoARM says that the array cookie should always be eight bytes.
John McCall [Fri, 25 Jan 2013 23:36:19 +0000 (23:36 +0000)]
ARM says that the array cookie should always be eight bytes.
ARM is not thinking about over-aligned structures.
Overrule ARM in both our generic-ARM and iOS ABI implementations.

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

11 years agoMove the decision about the kind of CGCXXABI to make inside
John McCall [Fri, 25 Jan 2013 23:36:14 +0000 (23:36 +0000)]
Move the decision about the kind of CGCXXABI to make inside
the family-specific files.

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