]> granicus.if.org Git - clang/log
clang
11 years agoDiagnostics: name all implicit groups used more than once.
Jordan Rose [Thu, 10 Jan 2013 18:50:51 +0000 (18:50 +0000)]
Diagnostics: name all implicit groups used more than once.

This will be a new style requirement going forwards: a diagnostic can only
use the implicit InGroup<DiagGroup<"foo">> syntax if "foo" is not used by
any other diagnostics; as soon as it is, it needs an explicit group.

This also brings some stray "conversion" diagnostics into the
"Value Conversion Issue" category, instead of the more generic
"Semantic Issue" category. I consider this an improvement!
- warn_impcast_complex_scalar
- warn_impcast_float_integer
- warn_impcast_float_precision
- warn_impcast_integer_precision
- warn_impcast_vector_scalar

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

11 years agoError if an anonymous DiagGroup is referenced multiple times.
Jordan Rose [Thu, 10 Jan 2013 18:50:46 +0000 (18:50 +0000)]
Error if an anonymous DiagGroup is referenced multiple times.

Not only is this inefficient for TableGen, it's annoying for maintenance
when renaming warning flags (unusual) or adding those flags to a group
(more likely).

This uses the new fix-it infrastructure for LLVM's SourceMgr/SMDiagnostic,
as well as a few changes to TableGen to track more source information.

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

11 years agoPulling formatFirstToken one level up.
Manuel Klimek [Thu, 10 Jan 2013 18:45:26 +0000 (18:45 +0000)]
Pulling formatFirstToken one level up.

This prepares the code for single line optimizations and changes the
dependencies between single-line-formats to the indent of the first
token.

Conceptually, the first token is "between" the lines anyway, as the
whitespace for the first token includes the previous end-of-line, which
needs to be escaped when inside a preprocessor directive.

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

11 years agoFixes layout of right braces.
Manuel Klimek [Thu, 10 Jan 2013 15:58:26 +0000 (15:58 +0000)]
Fixes layout of right braces.

We now decide whether a newline should go before the closing brace
depending on whether a newline was inserted after the opening brace.

For example, we now insert a newline before '};' in:
static SomeClass WithALoooooooooooooooooooongName = {
  100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"
};
... while not inserting a newline here:
static SomeClass = { a, b, c, d, e, f, g, h, i, j,
                     looooooooooooooooooooooooooooooooooongname,
                     looooooooooooooooooooooooooooooong };

Also fixes the formating of (column limit 25):
int x = {
  avariable,
  b(alongervariable)
};

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

11 years agoBasic support for diagnostics.
Alexander Kornienko [Thu, 10 Jan 2013 15:05:09 +0000 (15:05 +0000)]
Basic support for diagnostics.

Summary: Uses DiagnosticsEngine to output diagnostics.

Reviewers: djasper, klimek

Reviewed By: djasper

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

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

11 years agoFixes formatting of function calls etc inside an initializer list.
Manuel Klimek [Thu, 10 Jan 2013 14:36:46 +0000 (14:36 +0000)]
Fixes formatting of function calls etc inside an initializer list.

We're now formatting (column limit 25):
int x = {
  avariable,
  b(alongervariable) };

This also fixes:
Aaa({
  int i;
}, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
                                    ccccccccccccccccc));
... where we would previously break after the '},'.

Putting the closing curly into an extra line when there's a break
directly after the first curly will be done in a subsequent patch.

Paired with djasper.

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

11 years agoDo not add newline in empty blocks.
Manuel Klimek [Thu, 10 Jan 2013 13:24:24 +0000 (13:24 +0000)]
Do not add newline in empty blocks.

void f() {}
now gets formatted in one line.

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

11 years agoImprovements to function type and ObjC block formatting.
Daniel Jasper [Thu, 10 Jan 2013 13:08:12 +0000 (13:08 +0000)]
Improvements to function type and ObjC block formatting.

Before: int (^myBlock) (int) = ^(int num) {}
        A<void ()>;
int (*b)(int);

After:  int (^myBlock)(int) = ^(int num) {}
        A<void()>;
int(*b)(int);

For function types and function pointer types, this patch only makes
the behavior consistent (for types that are keywords and other types).
For the latter function pointer type declarations, we'll probably
want to add a space after "int".

Also added LangOpts.Bool = 1, so we handle "A<bool()>" appropriately
Moved the LangOpts-settings to a public place for use by tests
and clang-format binary.

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

11 years ago[Mips] Pass a combination of +soft-float and -mips16-hard-float flags to
Simon Atanasyan [Thu, 10 Jan 2013 12:36:19 +0000 (12:36 +0000)]
[Mips] Pass a combination of +soft-float and -mips16-hard-float flags to
the backend if hard float ABI is selected under -mips16 mode.

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

11 years agoFix layout of blocks inside statements.
Manuel Klimek [Thu, 10 Jan 2013 11:52:21 +0000 (11:52 +0000)]
Fix layout of blocks inside statements.

Previously, we would not indent:
SOME_MACRO({
  int i;
});
correctly. This is fixed by adding the trailing }); to the unwrapped
line starting with SOME_MACRO({, so the formatter can correctly match
the braces and indent accordingly.

Also fixes incorrect parsing of initializer lists, like:
int a[] = { 1 };

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

11 years agoImprove clang-format's understanding of casts.
Daniel Jasper [Thu, 10 Jan 2013 11:14:08 +0000 (11:14 +0000)]
Improve clang-format's understanding of casts.

This fixes llvm.org/PR14684.

Before: int *pa = (int *) & a;
After:  int *pa = (int *)&a;

We still don't understand all kinds of casts. I added a FIXME to
address that.

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

11 years agor172047 lacked a test (due to incomplete OpenCL support in clang). Use a modified
David Tweed [Thu, 10 Jan 2013 10:42:08 +0000 (10:42 +0000)]
r172047 lacked a test (due to incomplete OpenCL support in clang). Use a modified
version of a test by Joey Gouly to use attributes to materialise the unsupported
types and test vector shifts.

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

11 years agoEnable intel_ocl_bicc for x86_64 target only. Remove fix from 171969 that enabled...
Guy Benyei [Thu, 10 Jan 2013 10:41:05 +0000 (10:41 +0000)]
Enable intel_ocl_bicc for x86_64 target only. Remove fix from 171969 that enabled this extension for multiple targets.

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

11 years agoIntroduce a define to switch on debug output.
Manuel Klimek [Thu, 10 Jan 2013 10:05:08 +0000 (10:05 +0000)]
Introduce a define to switch on debug output.

After re-writing the same loop multiple times, we deicided it's time to
add this as an optional debugging help.

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

11 years agoDo more error checking for '{}'.
Daniel Jasper [Thu, 10 Jan 2013 09:26:47 +0000 (09:26 +0000)]
Do more error checking for '{}'.

This fixes llvm.org/PR14883, where clang-format would run into an
assertion on:

void f() { return } 42

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

11 years agoTesting with a full OpenCL compiler (based on clang) reveals r71734 missed
David Tweed [Thu, 10 Jan 2013 09:11:33 +0000 (09:11 +0000)]
Testing with a full OpenCL compiler (based on clang) reveals r71734 missed
difference between type widths of a vector and the width of one of its elements
in the case of vector shifts. Use correct witdth in the vector case.

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

11 years agoclang-c/Index.h: Clarify empty argument with (void) for C89.
NAKAMURA Takumi [Thu, 10 Jan 2013 02:12:38 +0000 (02:12 +0000)]
clang-c/Index.h: Clarify empty argument with (void) for C89.

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

11 years agoBe more careful about updating the failed-modules set
Douglas Gregor [Thu, 10 Jan 2013 02:04:18 +0000 (02:04 +0000)]
Be more careful about updating the failed-modules set

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

11 years agoDon't assert in codegen on static data members which have NoLinkage. Fixes
Nick Lewycky [Thu, 10 Jan 2013 01:46:29 +0000 (01:46 +0000)]
Don't assert in codegen on static data members which have NoLinkage. Fixes
PR14825!

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

11 years agoRework the realpath nonsense for framework lookups to deal more
Douglas Gregor [Thu, 10 Jan 2013 01:43:00 +0000 (01:43 +0000)]
Rework the realpath nonsense for framework lookups to deal more
uniformly with symlinks between top-level and embedded frameworks.

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

11 years agoFormatter: Remove unused @-formatting code.
Nico Weber [Thu, 10 Jan 2013 00:42:07 +0000 (00:42 +0000)]
Formatter: Remove unused @-formatting code.

@optional @property is put on two different unwrapped lines now, so this is no
longer necessary.

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

11 years agoFormatter: @optional and @required go on their own line.
Nico Weber [Thu, 10 Jan 2013 00:25:19 +0000 (00:25 +0000)]
Formatter: @optional and @required go on their own line.

Previously:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional - (void) optional;
@required - (void) required;
@end

Now:
@protocol myProtocol
- (void)mandatoryWithInt:(int)i;
@optional
- (void)optional;
@required
- (void)required;
@end

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

11 years agoFormatter: Add support for @implementation.
Nico Weber [Wed, 9 Jan 2013 23:25:37 +0000 (23:25 +0000)]
Formatter: Add support for @implementation.

Just reuse the @interface code for this. It accepts slightly more than
necessary (@implementation cannot have protocol lists), but that's ok.

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

11 years ago[PreprocessingRecord] A macro expansion can be reported out-of-order in cases when
Argyrios Kyrtzidis [Wed, 9 Jan 2013 23:22:20 +0000 (23:22 +0000)]
[PreprocessingRecord] A macro expansion can be reported out-of-order in cases when
there are macro expansions inside macro arguments where the arguments are
not expanded in the same order as listed; don't assert that all macro expansions
are in source order.

rdar://12397063

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

11 years ago[utils/ClangDataFormat.py] Don't use lldb.frame directly, get the frame from the...
Argyrios Kyrtzidis [Wed, 9 Jan 2013 23:22:08 +0000 (23:22 +0000)]
[utils/ClangDataFormat.py] Don't use lldb.frame directly, get the frame from the value.

Some lldb changes made lldb.frame not set until a script is invoked, which made the
formatters not working after a restart.

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

11 years agoIssue warning when case value is too large to fit
Fariborz Jahanian [Wed, 9 Jan 2013 23:04:56 +0000 (23:04 +0000)]
Issue warning when case value is too large to fit
in case condition type. // rdar://11577384.
Test is conditionalized on x86_64-apple triple as
I am not sure if the INT_MAX/LONG_MAX values in the test
will pass this test for other hosts.

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

11 years agoClangTools.rst: spelling and formatting
Dmitri Gribenko [Wed, 9 Jan 2013 22:22:51 +0000 (22:22 +0000)]
ClangTools.rst: spelling and formatting

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

11 years agoClangFormat.rst: improve formatting
Dmitri Gribenko [Wed, 9 Jan 2013 22:18:55 +0000 (22:18 +0000)]
ClangFormat.rst: improve formatting

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

11 years agoRemove the unused Parser::ParseTranslationUnit function
Hal Finkel [Wed, 9 Jan 2013 21:49:51 +0000 (21:49 +0000)]
Remove the unused Parser::ParseTranslationUnit function

Parser::ParseTranslationUnit is now dead because the loop over
ParseTopLevelDecl is in ParseAST.

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

11 years agoAdd documentation for clang-format.
Daniel Jasper [Wed, 9 Jan 2013 21:49:28 +0000 (21:49 +0000)]
Add documentation for clang-format.

This adds documentation for both LibFormat as well as the standalone
tools and integrations built on top of it. It slightly restructures
the ClangTools documentation.

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

11 years agoFormatter: Make parseObjCUntilAtEnd() actually work.
Nico Weber [Wed, 9 Jan 2013 21:42:32 +0000 (21:42 +0000)]
Formatter: Make parseObjCUntilAtEnd() actually work.

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

11 years agoFormatting: Add support for @protocol.
Nico Weber [Wed, 9 Jan 2013 21:15:03 +0000 (21:15 +0000)]
Formatting: Add support for @protocol.

Pull pieces of the @interface code into reusable methods.

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

11 years agoFix test after r171995.
Nico Weber [Wed, 9 Jan 2013 20:36:10 +0000 (20:36 +0000)]
Fix test after r171995.

I wasn't aware libFormat is used elsewhere already. Let me know if rebasing
is not the right thing to do here.

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

11 years agoFormatter: Add support for @interface.
Nico Weber [Wed, 9 Jan 2013 20:25:35 +0000 (20:25 +0000)]
Formatter: Add support for @interface.

Previously:
@interface Foo + (id)init; @end

Now:
@interface Foo
+ (id)init;
@end

Some tweaking remains, but this is a good first step.

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

11 years agounwind.h: Add include guards and don't mess with visibility if HIDE_EXPORTS is specified.
Benjamin Kramer [Wed, 9 Jan 2013 19:54:57 +0000 (19:54 +0000)]
unwind.h: Add include guards and don't mess with visibility if HIDE_EXPORTS is specified.

For GCC compatibility.

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

11 years agoDo not model loads from complex types, since we don't accurately model the imaginary...
Ted Kremenek [Wed, 9 Jan 2013 18:46:17 +0000 (18:46 +0000)]
Do not model loads from complex types, since we don't accurately model the imaginary and real parts yet.

Fixes false positive reported in <rdar://problem/12964481>.

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

11 years agoSuppress GCC -Wreturn warning.
David Blaikie [Wed, 9 Jan 2013 17:48:41 +0000 (17:48 +0000)]
Suppress GCC -Wreturn warning.

Modified from a patch by David Greene.

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

11 years agoHandle static functions being redeclared in function scope.
Rafael Espindola [Wed, 9 Jan 2013 16:34:58 +0000 (16:34 +0000)]
Handle static functions being redeclared in function scope.

Fixes pr14861.

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

11 years agoEnables layouting unwrapped lines around preprocessor directives.
Manuel Klimek [Wed, 9 Jan 2013 15:25:02 +0000 (15:25 +0000)]
Enables layouting unwrapped lines around preprocessor directives.

Previously, we'd always start at indent level 0 after a preprocessor
directive, now we layout the following snippet (column limit 69) as
follows:

functionCallTo(someOtherFunction(
    withSomeParameters, whichInSequence,
    areLongerThanALine(andAnotherCall,
  B
                       withMoreParamters,
                       whichStronglyInfluenceTheLayout),
    andMoreParameters),
               trailing);

Note that the different jumping indent is a different issue that will be
addressed separately.

This is the first step towards handling #ifdef->#else->#endif chains
correctly.

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

11 years agoEnable intel_ocl_bicc for x86_64 target. This was missed in r171056.
Guy Benyei [Wed, 9 Jan 2013 12:21:44 +0000 (12:21 +0000)]
Enable intel_ocl_bicc for x86_64 target. This was missed in r171056.

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

11 years agoOnly align after assignments on the top level.
Daniel Jasper [Wed, 9 Jan 2013 10:40:23 +0000 (10:40 +0000)]
Only align after assignments on the top level.

This fixes llvm.org/PR14870 and we no longer mess up:
template <typename T1, typename T2 = char, typename T3 = char,
          typename T4 = char>
void f();

It removes the nice aligment for assignments inside other expressions,
but I am not sure those are actually practically relevant. If so, we can
fix those later.

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

11 years agoDon't simply give up when exceeding 80cols, choose an "ok" option.
Daniel Jasper [Wed, 9 Jan 2013 10:16:05 +0000 (10:16 +0000)]
Don't simply give up when exceeding 80cols, choose an "ok" option.

This addresses llvm.org/PR14847.

We can now format something like:
int aaaaaaaaaaaaaaaaaaaaaaaaaaa =
    // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

clang-format unavoidably exceeds the column limit, but does not just
flush everything into a single line. Moreover, it tries to minimize the
number of characters beyond the column limit.

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

11 years agoCorrectly format wrapped function call parameters in templated functions.
Daniel Jasper [Wed, 9 Jan 2013 09:50:48 +0000 (09:50 +0000)]
Correctly format wrapped function call parameters in templated functions.

This fixes llvm.org/PR14846.

Before:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
        int aaaaaaaaaaaaaaaaa);

After:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    int aaaaaaaaaaaaaaaaa);

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

11 years agoFixes dump_ast_matchers to parse all matcher macros and updates the
Manuel Klimek [Wed, 9 Jan 2013 09:38:21 +0000 (09:38 +0000)]
Fixes dump_ast_matchers to parse all matcher macros and updates the
docs.

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

11 years agoAllow comments in the middle of statements to be on their own line.
Daniel Jasper [Wed, 9 Jan 2013 09:33:39 +0000 (09:33 +0000)]
Allow comments in the middle of statements to be on their own line.

This fixes llvm.org/PR14860.

Before, we messed up the format of:
if (DeclaratorInfo.isFunctionDeclarator() &&
    //getDeclSpecContextFromDeclaratorContext(Context) == DSC_top_level &&
    Tok.is(tok::semi) && NextToken().is(tok::l_brace)) {
}

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

11 years agoFix ObjC block declarations.
Daniel Jasper [Wed, 9 Jan 2013 08:36:49 +0000 (08:36 +0000)]
Fix ObjC block declarations.

Before: int ( ^ Block1) (int, int) = ^ (int i, int j)
After:  int (^Block1) (int, int) = ^(int i, int j)

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

11 years agoImprove formatting of conditional operators.
Daniel Jasper [Wed, 9 Jan 2013 07:06:56 +0000 (07:06 +0000)]
Improve formatting of conditional operators.

This addresses llvm.org/PR14864.

We used to completely mess this up and now format as:
Diag(NewFD->getLocation(),
     getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class :
         diag::err_function_specialization_in_class)
    << NewFD->getDeclName();

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

11 years agoDon't mention -fno-diagnostics-print-source-range-info in manual.
Nico Weber [Wed, 9 Jan 2013 05:06:41 +0000 (05:06 +0000)]
Don't mention -fno-diagnostics-print-source-range-info in manual.

Clang doesn't understand it.

If someone wants to teach clang about that flag instead, please also add
support for -fno-diagnostics-parseable-fixits for consistency.

Until then, let the documentation match the current behavior.

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

11 years ago[ubsan] Make static check data non-const so it can be used for deduplication.
Will Dietz [Wed, 9 Jan 2013 03:39:41 +0000 (03:39 +0000)]
[ubsan] Make static check data non-const so it can be used for deduplication.

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

11 years agoMake sure clang puts tokens from different files on separate lines in "-E -P" mode...
Eli Friedman [Wed, 9 Jan 2013 03:16:42 +0000 (03:16 +0000)]
Make sure clang puts tokens from different files on separate lines in "-E -P" mode.  <rdar://problem/12774044>

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

11 years agoMake __has_include a bit more resilient in the presence of macros. <rdar://problem...
Eli Friedman [Wed, 9 Jan 2013 02:20:00 +0000 (02:20 +0000)]
Make __has_include a bit more resilient in the presence of macros.  <rdar://problem/12748859>.

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

11 years agoWhen name lookup for a redeclaration finds declarations that are known
Douglas Gregor [Wed, 9 Jan 2013 00:47:56 +0000 (00:47 +0000)]
When name lookup for a redeclaration finds declarations that are known
(because they are part of some module) but have not been made visible
(because they are in a submodule that wasn't imported), filter out
those declarations unless both the old declaration and the new
declaration have external linkage. When one or both has internal
linkage, there should be no conflict unless both are imported.

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

11 years agoput back diagnostics when flexible members are captured
Fariborz Jahanian [Wed, 9 Jan 2013 00:09:15 +0000 (00:09 +0000)]
put back diagnostics when flexible members are captured
in lambdas.

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

11 years agoRemoved extra "`" from ARC documentation.
Michael Gottesman [Tue, 8 Jan 2013 23:55:10 +0000 (23:55 +0000)]
Removed extra "`" from ARC documentation.

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

11 years ago[ms-inline asm] Add a test case for the offset operator where the operand is a
Chad Rosier [Tue, 8 Jan 2013 23:51:48 +0000 (23:51 +0000)]
[ms-inline asm] Add a test case for the offset operator where the operand is a
global variable.

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

11 years agoFix typo (again).
Fariborz Jahanian [Tue, 8 Jan 2013 23:48:48 +0000 (23:48 +0000)]
Fix typo (again).

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

11 years agoRemove lambda from my last patch.
Fariborz Jahanian [Tue, 8 Jan 2013 23:40:08 +0000 (23:40 +0000)]
Remove lambda from my last patch.

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

11 years agoFixes typo in comment.
Fariborz Jahanian [Tue, 8 Jan 2013 23:21:22 +0000 (23:21 +0000)]
Fixes typo in comment.

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

11 years agoobjectiveC blocks: It is impractical to capture
Fariborz Jahanian [Tue, 8 Jan 2013 23:17:51 +0000 (23:17 +0000)]
objectiveC blocks: It is impractical to capture
struct variables with flexiable array members in
blocks (and lambdas). Issue error instead of
crashing in IRGen. // rdar://12655829

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

11 years agoPR14855: don't silently swallow a nested-name-specifier after a type name.
Richard Smith [Tue, 8 Jan 2013 22:43:49 +0000 (22:43 +0000)]
PR14855: don't silently swallow a nested-name-specifier after a type name.

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

11 years agoClear LV cache when dropping availability attributes.
Rafael Espindola [Tue, 8 Jan 2013 22:31:36 +0000 (22:31 +0000)]
Clear LV cache when dropping availability attributes.

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

11 years agoTighten types a bit. No functionality change.
Rafael Espindola [Tue, 8 Jan 2013 22:04:34 +0000 (22:04 +0000)]
Tighten types a bit. No functionality change.

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

11 years agoDon't crash when trying to apply the availability attribute to a block.
Rafael Espindola [Tue, 8 Jan 2013 21:30:32 +0000 (21:30 +0000)]
Don't crash when trying to apply the availability attribute to a block.

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

11 years agoTighten types a bit. No functionality change.
Rafael Espindola [Tue, 8 Jan 2013 21:00:12 +0000 (21:00 +0000)]
Tighten types a bit. No functionality change.

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

11 years agoTighten types a bit. No functionality change.
Rafael Espindola [Tue, 8 Jan 2013 20:44:06 +0000 (20:44 +0000)]
Tighten types a bit. No functionality change.

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

11 years agoRemove on-by-default warning from -Wmost.
David Blaikie [Tue, 8 Jan 2013 20:28:13 +0000 (20:28 +0000)]
Remove on-by-default warning from -Wmost.

-Wint-to-pointer-cast, added to match GCC's warning by the same name, doesn't
need to be in any other groups (as it isn't in any groups in GCC either).

Found in post-commit review by Ted Kremenek.

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

11 years agoFormatter: More tests for already-passing ObjC bits.
Nico Weber [Tue, 8 Jan 2013 20:16:23 +0000 (20:16 +0000)]
Formatter: More tests for already-passing ObjC bits.

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

11 years ago[analyzer] Bump down the max size of functions being analyzed.
Anna Zaks [Tue, 8 Jan 2013 20:09:00 +0000 (20:09 +0000)]
[analyzer] Bump down the max size of functions being analyzed.

With the new setting, we are not going to inline any functions that are
more than 50 basic blocks. (The analyzer is 20% faster on several
especially bad benchmarks with the new default.)

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

11 years agoDon't break after unary operators.
Daniel Jasper [Tue, 8 Jan 2013 20:03:18 +0000 (20:03 +0000)]
Don't break after unary operators.

Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *
                                                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaa, *aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

11 years agoMove loop variable update.
Rafael Espindola [Tue, 8 Jan 2013 19:58:34 +0000 (19:58 +0000)]
Move loop variable update.
Thanks to Dmitri Gribenko for the suggestion.

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

11 years agoMark all subsequent decls used.
Rafael Espindola [Tue, 8 Jan 2013 19:43:34 +0000 (19:43 +0000)]
Mark all subsequent decls used.

In the source

  static void f();
  static void f();
  template<typename T>
  static void g() {
    f();
  }
  static void f() {
  }
  void h() {
    g<int>();
  }

the call to f refers to the second decl, but it is only marked used at the end
of the translation unit during instantiation, after the third f decl has been
linked in.

With this patch we mark all subsequent decls used, so that it is easy to check
if a symbol is used or not.

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

11 years agoFormatter: Format @ literals better. Array and dictionary literals need more work.
Nico Weber [Tue, 8 Jan 2013 19:40:21 +0000 (19:40 +0000)]
Formatter: Format @ literals better. Array and dictionary literals need more work.

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

11 years agoVarious tweaks and updates to the analyzer website.
Jordan Rose [Tue, 8 Jan 2013 19:29:37 +0000 (19:29 +0000)]
Various tweaks and updates to the analyzer website.

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

11 years ago[analyzer] Only include uniqueling location as issue_hash when available
Anna Zaks [Tue, 8 Jan 2013 19:19:46 +0000 (19:19 +0000)]
[analyzer] Only include uniqueling location as issue_hash when available

This makes us more optimistic when matching reports in a changing code
base. Addresses Jordan's feedback for r171825.

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

11 years agoFormatter: More ObjC tests.
Nico Weber [Tue, 8 Jan 2013 19:15:23 +0000 (19:15 +0000)]
Formatter: More ObjC tests.

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

11 years ago[libclang] In clang_equalCursors, clear out the "FirstInDeclGroup" part in a declarat...
Argyrios Kyrtzidis [Tue, 8 Jan 2013 18:23:28 +0000 (18:23 +0000)]
[libclang] In clang_equalCursors, clear out the "FirstInDeclGroup" part in a declaration cursor
before doing the comparison.

This is because we can't set "FirstInDeclGroup" consistently; for example, when visiting a DeclStmt we will set
it but we don't set it on the result of clang_getCursorDefinition for a reference of the same declaration.

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

11 years agoUse Decl::getAvailability() rather than checking for the "unavailable"
Douglas Gregor [Tue, 8 Jan 2013 18:16:18 +0000 (18:16 +0000)]
Use Decl::getAvailability() rather than checking for the "unavailable"
attribute when determining whether we need to see an implementation of
a property. Fixes <rdar://problem/12958191>.

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

11 years agoFormatter: Add tests for some ObjC bits that happen to be formatted correctly.
Nico Weber [Tue, 8 Jan 2013 17:56:31 +0000 (17:56 +0000)]
Formatter: Add tests for some ObjC bits that happen to be formatted correctly.

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

11 years agoRepost checker-270, which for some reason got deleted.
Ted Kremenek [Tue, 8 Jan 2013 17:33:58 +0000 (17:33 +0000)]
Repost checker-270, which for some reason got deleted.

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

11 years agoclang-format can now format #defines.
Manuel Klimek [Tue, 8 Jan 2013 16:33:20 +0000 (16:33 +0000)]
clang-format can now format #defines.

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

11 years agoDon't put spaces around ##.
Daniel Jasper [Tue, 8 Jan 2013 16:17:54 +0000 (16:17 +0000)]
Don't put spaces around ##.

In Clang/LLVM this seems to be the more common formatting for ##s. There
might still be case that we miss, but we'll fix those as we go along.

Before:

  #define A(X)
    void function ## X();

After:

  #define A(X)
    void function##X();

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

11 years agoAdd missing spaces. This doesn't cause problems in practice because we only warn
Rafael Espindola [Tue, 8 Jan 2013 16:09:04 +0000 (16:09 +0000)]
Add missing spaces. This doesn't cause problems in practice because we only warn
about _Static_assert with -pedantic.

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

11 years agoClear the LV cache when setting the instantiated from link.
Rafael Espindola [Tue, 8 Jan 2013 14:58:32 +0000 (14:58 +0000)]
Clear the LV cache when setting the instantiated from link.
Fixes pr14835.

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

11 years agoChange the data structure used in clang-format.
Daniel Jasper [Tue, 8 Jan 2013 14:56:18 +0000 (14:56 +0000)]
Change the data structure used in clang-format.

This is a first step towards supporting more complex structures such
as #ifs inside unwrapped lines. This patch mostly converts the array-based
UnwrappedLine into a linked-list-based UnwrappedLine. Future changes will
allow multiple children for each Token turning the UnwrappedLine into a
tree.

No functional changes intended.

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

11 years agoCodeGen/compound-assign-overflow.c: include stdint.h in freestanding mode
Dmitri Gribenko [Tue, 8 Jan 2013 14:47:41 +0000 (14:47 +0000)]
CodeGen/compound-assign-overflow.c: include stdint.h in freestanding mode

This hopefully fixes the ARM buildbot.

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

11 years agodocs: "clang tools" are not a different interface.
Sean Silva [Tue, 8 Jan 2013 04:42:09 +0000 (04:42 +0000)]
docs: "clang tools" are not a different interface.

I spotted someone confused about this, so remove the heading to make it
clear that they really are a part of Tooling.

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

11 years agoClear the LV cache when merging the availability attribute.
Rafael Espindola [Tue, 8 Jan 2013 04:04:30 +0000 (04:04 +0000)]
Clear the LV cache when merging the availability attribute.

The availability implies default visibility, so it can change the computed
visibility.

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

11 years agoAdd a test to make sure that vector output happens for debug info.
Eric Christopher [Tue, 8 Jan 2013 01:54:13 +0000 (01:54 +0000)]
Add a test to make sure that vector output happens for debug info.

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

11 years agoDon't warn about undefined varargs argument behavior in unreachable code.
Ted Kremenek [Tue, 8 Jan 2013 01:50:40 +0000 (01:50 +0000)]
Don't warn about undefined varargs argument behavior in unreachable code.

Fixes <rdar://problem/12322000>.

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

11 years agoAdd [artificial] debug info annotation to test matching r171826
David Blaikie [Tue, 8 Jan 2013 01:12:59 +0000 (01:12 +0000)]
Add [artificial] debug info annotation to test matching r171826

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

11 years ago[arcmt] Follow-up for r171484; make sure when adding brackets enclosing case statements,
Argyrios Kyrtzidis [Tue, 8 Jan 2013 00:58:25 +0000 (00:58 +0000)]
[arcmt] Follow-up for r171484; make sure when adding brackets enclosing case statements,
that the case does not "contain" a declaration that is referenced "outside" of it,
otherwise we will emit un-compilable code.

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

11 years agoMove ref qualifiers from Type bitfields into FunctionProtoType, stealing two
Richard Smith [Tue, 8 Jan 2013 00:50:27 +0000 (00:50 +0000)]
Move ref qualifiers from Type bitfields into FunctionProtoType, stealing two
bits from the number of parameters. This brings the bitfields down from 33 bits
to 32 bits, reducing the size of Types by 4 bytes on 32-bit systems.

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

11 years ago[analyzer] Include the bug uniqueing location in the issue_hash.
Anna Zaks [Tue, 8 Jan 2013 00:25:29 +0000 (00:25 +0000)]
[analyzer] Include the bug uniqueing location in the issue_hash.

The issue here is that if we have 2 leaks reported at the same line for
which we cannot print the corresponding region info, they will get
treated as the same by issue_hash+description. We need to AUGMENT the
issue_hash with the allocation info to differentiate the two issues.

Add the "hash" (offset from the beginning of a function) representing
allocation site to solve the issue.

We might want to generalize solution in the future when we decide to
track more than just the 2 locations from the diagnostics.

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

11 years ago[analyzer] Plist: change the type of issue_hash from int to string.
Anna Zaks [Tue, 8 Jan 2013 00:25:22 +0000 (00:25 +0000)]
[analyzer] Plist: change the type of issue_hash from int to string.

This gives more flexibility to what could be stored as issue_hash.

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

11 years ago[analyzer] Extend the Representing Values section of the dev manual.
Anna Zaks [Tue, 8 Jan 2013 00:25:14 +0000 (00:25 +0000)]
[analyzer] Extend the Representing Values section of the dev manual.

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

11 years agoclang/test/CodeGenOpenCL/shifts.cl: Fixup for -Asserts.
NAKAMURA Takumi [Tue, 8 Jan 2013 00:15:53 +0000 (00:15 +0000)]
clang/test/CodeGenOpenCL/shifts.cl: Fixup for -Asserts.

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

11 years agoPR14838: When a member reference is bound to a temporary, don't forget to
Richard Smith [Tue, 8 Jan 2013 00:08:23 +0000 (00:08 +0000)]
PR14838: When a member reference is bound to a temporary, don't forget to
perform the semantic checks associated with the destruction of that temporary.
It'll be destroyed at the end of the constructor.

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

11 years agoBack out my no-op change from r171783.
Douglas Gregor [Tue, 8 Jan 2013 00:01:45 +0000 (00:01 +0000)]
Back out my no-op change from r171783.

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

11 years agoCorrect OpenBSD profiling test
Dmitri Gribenko [Mon, 7 Jan 2013 23:55:47 +0000 (23:55 +0000)]
Correct OpenBSD profiling test

The test should be looking for gcrt0.o not crt0.o.  Clang was already printing
"gcrt0", but the test was looking for "{{.*}}crt0.o", and the .* regexp
consumed "g".

Patch by Brad Smith.

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

11 years agoExtract the instance-method case for debug info out into a separate function.
David Blaikie [Mon, 7 Jan 2013 23:06:35 +0000 (23:06 +0000)]
Extract the instance-method case for debug info out into a separate function.

This is in preparation for using this to construct the function type for
pointers to member functions to include the implicit/artificial 'this'
parameter in that case as well. (feedback from GDB indicates that this might be
all that's necessary to get it to behave well with Clang's pointer-to-member
function debug output)

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