]> granicus.if.org Git - clang/log
clang
11 years agoNuke SetUpBuildDumpLog.
Sean Silva [Sun, 20 Jan 2013 01:58:28 +0000 (01:58 +0000)]
Nuke SetUpBuildDumpLog.

Also, it was the only reason that `argc` and `argv` were being passed
into createDiagnostics, so remove those parameters and clean up callers.

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

11 years agoFix what appears to be a copy-paste error.
Sean Silva [Sun, 20 Jan 2013 01:58:26 +0000 (01:58 +0000)]
Fix what appears to be a copy-paste error.

This looks like it was copied from SetUpBuildDumpLog, which dumps to the
file `DiagOpts->DumpBuildInformation`. There is another member
`DiagOpts->DiagnosticLogFile` which appears to be unused. The fact that
this feature doesn't even print to the output file specified on the
command line makes me think that it should be ripped out.

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

11 years agoThe last of PR14471: Debug info support for inline in-class initializer for float...
David Blaikie [Sun, 20 Jan 2013 01:19:17 +0000 (01:19 +0000)]
The last of PR14471: Debug info support for inline in-class initializer for float static members

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

11 years agoFixed trailing whitespace.
Michael Gottesman [Sun, 20 Jan 2013 01:04:14 +0000 (01:04 +0000)]
Fixed trailing whitespace.

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

11 years agoadd back a #include needed on some builders.
Chris Lattner [Sun, 20 Jan 2013 00:57:52 +0000 (00:57 +0000)]
add back a #include needed on some builders.

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

11 years agofinish converting the normal cases in ASTReader to use the new BitstreamCursor APIs.
Chris Lattner [Sun, 20 Jan 2013 00:56:42 +0000 (00:56 +0000)]
finish converting the normal cases in ASTReader to use the new BitstreamCursor APIs.

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

11 years ago[cindex.py]: Use spaces instead of tabs
Tobias Grosser [Sun, 20 Jan 2013 00:42:16 +0000 (00:42 +0000)]
[cindex.py]: Use spaces instead of tabs

The tabs slipped in accidentally.

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

11 years agoconvert some more stuff over to use new cursor APIs.
Chris Lattner [Sun, 20 Jan 2013 00:00:22 +0000 (00:00 +0000)]
convert some more stuff over to use new cursor APIs.

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

11 years agoActually update the test, fixup for r172923
Dmitri Gribenko [Sat, 19 Jan 2013 22:11:28 +0000 (22:11 +0000)]
Actually update the test, fixup for r172923

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

11 years agoUse llvm::hexDigitValue in comment lexer
Dmitri Gribenko [Sat, 19 Jan 2013 22:06:05 +0000 (22:06 +0000)]
Use llvm::hexDigitValue in comment lexer

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

11 years agoComment parsing: add more tests for html character references
Dmitri Gribenko [Sat, 19 Jan 2013 22:04:44 +0000 (22:04 +0000)]
Comment parsing: add more tests for html character references

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

11 years agoswitch a bunch of ASTReader to use the new BitstreamCursor::advance* methods,
Chris Lattner [Sat, 19 Jan 2013 21:39:22 +0000 (21:39 +0000)]
switch a bunch of ASTReader to use the new BitstreamCursor::advance* methods,
which hide a bunch of private details of the cursor from clients and simplify
their code.  More to come.

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

11 years agorandom tidying
Chris Lattner [Sat, 19 Jan 2013 21:35:35 +0000 (21:35 +0000)]
random tidying

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

11 years ago[analyzer] Don't show "Entered 'foo'" if 'foo' is implicit.
Jordan Rose [Sat, 19 Jan 2013 19:52:57 +0000 (19:52 +0000)]
[analyzer] Don't show "Entered 'foo'" if 'foo' is implicit.

Before:
  Calling implicit default constructor for 'Foo'  (where Foo is constructed)
  Entered call from 'test'  (at "=default" or 'Foo' declaration)
  Calling default constructor for 'Bar'  (at "=default" or 'Foo' declaration)

After:
  Calling implicit default constructor for 'Foo'  (where Foo is constructed)
  Calling default constructor for 'Bar'  (at "=default" or 'Foo' declaration)

This only affects the plist diagnostics; this note is never shown in the
other diagnostics.

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

11 years agoEmit the function type of member function pointer types the same as member functions.
David Blaikie [Sat, 19 Jan 2013 19:20:56 +0000 (19:20 +0000)]
Emit the function type of member function pointer types the same as member functions.

Adding the pseudo first parameter to a member function pointer's function type
and mark it as artificial.

Combined with a fix to GDB ( http://sourceware.org/bugzilla/show_bug.cgi?id=14998 )
this fixes gdb.cp/member-ptr.exp with Clang.

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

11 years agolibclangSerialization also depends on the bitreader.
Benjamin Kramer [Sat, 19 Jan 2013 19:10:12 +0000 (19:10 +0000)]
libclangSerialization also depends on the bitreader.

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

11 years agoupdate header comment.
Chris Lattner [Sat, 19 Jan 2013 18:47:35 +0000 (18:47 +0000)]
update header comment.

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

11 years agofix the unit tests too.
Chris Lattner [Sat, 19 Jan 2013 18:30:39 +0000 (18:30 +0000)]
fix the unit tests too.

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

11 years agothese now depend on the bitcode reader too.
Chris Lattner [Sat, 19 Jan 2013 18:28:24 +0000 (18:28 +0000)]
these now depend on the bitcode reader too.

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

11 years agothis depends on the bitcode reader, since it is using it.
Chris Lattner [Sat, 19 Jan 2013 18:24:13 +0000 (18:24 +0000)]
this depends on the bitcode reader, since it is using it.

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

11 years ago[cindex.py] Add cache for CompletionChunk spellings
Tobias Grosser [Sat, 19 Jan 2013 11:03:44 +0000 (11:03 +0000)]
[cindex.py] Add cache for CompletionChunk spellings

Most of the CompletionChunks represent braces, colons or other one
character spellings. There is no need to call libclang, to figure out
how to write a colon. Instead we use an internal cache to retrieve the
correct spelling. As function calls from python are very expensive and
this is a performance critical part of auto completion this patch makes
formatting of auto completion results a lot faster.

Formatting time changes from 0.57 to 0.45 seconds

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

11 years ago[cindex.py] Replace CachedProperty with our own implementation
Tobias Grosser [Sat, 19 Jan 2013 11:03:42 +0000 (11:03 +0000)]
[cindex.py] Replace CachedProperty with our own implementation

This is a very performance critical point for auto completion. The manual
implementation gives a large speedup. As it does not complicate the code a lot,
I figured it is worth the change. If anybody understands why the CachedProperty
is here so much slower, I am very interested in working on an improvement of
CachedProperty.

Formatting time changes from 0.72 to 0.57 seconds.

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

11 years ago[cindex.py]: Speed up lookup of the completion kind
Tobias Grosser [Sat, 19 Jan 2013 11:03:40 +0000 (11:03 +0000)]
[cindex.py]: Speed up lookup of the completion kind

We can directly the number of the kind instead of going through the
completionChunkKindMap.

Formatting time changes from 0.84 to 0.72 seconds.

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

11 years agoRe-sort all the headers. Lots of regressions have crept in here.
Chandler Carruth [Sat, 19 Jan 2013 08:09:44 +0000 (08:09 +0000)]
Re-sort all the headers. Lots of regressions have crept in here.
Manually fix the order of UnwrappedLineParser.cpp as that one didn't
have its associated header as the first header.

This also uncovered a subtle inclusion order dependency as CLog.h didn't
include LLVM.h to pick up using declarations it relied upon.

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

11 years agoMove an input header file under an Inputs directory to be consistent
Chandler Carruth [Sat, 19 Jan 2013 06:31:24 +0000 (06:31 +0000)]
Move an input header file under an Inputs directory to be consistent
with other auxilliary test inputs and simplify the identification of
inputs to tests.

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

11 years agoReapply r172878 with test case.
Ted Kremenek [Sat, 19 Jan 2013 04:33:14 +0000 (04:33 +0000)]
Reapply r172878 with test case.

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

11 years agoFix five more cases of tokens which can legally follow a type specifier.
Richard Smith [Sat, 19 Jan 2013 03:48:05 +0000 (03:48 +0000)]
Fix five more cases of tokens which can legally follow a type specifier.

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

11 years ago[PCH/Modules] Revert r172843, it caused a module to fail building.
Argyrios Kyrtzidis [Sat, 19 Jan 2013 03:14:56 +0000 (03:14 +0000)]
[PCH/Modules] Revert r172843, it caused a module to fail building.

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

11 years ago[analyzer] Suppress warnings coming out of macros defined in sys/queue.h
Anna Zaks [Sat, 19 Jan 2013 02:18:15 +0000 (02:18 +0000)]
[analyzer] Suppress warnings coming out of macros defined in sys/queue.h

Suppress the warning by just not emitting the report. The sink node
would get generated, which is fine since we did reach a bad state.

Motivation

Due to the way code is structured in some of these macros, we do not
reason correctly about it and report false positives. Specifically, the
following loop reports a use-after-free. Because of the way the code is
structured inside of the macro, the analyzer assumes that the list can
have cycles, so you end up with use-after-free in the loop, that is
safely deleting elements of the list. (The user does not have a way to
teach the analyzer about shape of data structures.)

SLIST_FOREACH_SAFE(item, &ctx->example_list, example_le, tmpitem) {
if (item->index == 3) { // if you remove each time, no complaints
assert((&ctx->example_list)->slh_first == item);
SLIST_REMOVE(&ctx->example_list, item, example_s, example_le);
free(item);
}
}

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

11 years agoWhitespace.
NAKAMURA Takumi [Sat, 19 Jan 2013 01:54:35 +0000 (01:54 +0000)]
Whitespace.

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

11 years agoRevert r172878, "Reword warning about using a *static* variable within its own initia...
NAKAMURA Takumi [Sat, 19 Jan 2013 01:47:46 +0000 (01:47 +0000)]
Revert r172878, "Reword warning about using a *static* variable within its own initialization."

It broke, at least, linux, msvc and mingw bots.

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

11 years agoReword warning about using a *static* variable within its own initialization.
Ted Kremenek [Sat, 19 Jan 2013 00:49:00 +0000 (00:49 +0000)]
Reword warning about using a *static* variable within its own initialization.

The warning is still under -Wuninitialized (although technically this
is defined behavior), but under a subgroup -Wstatic-self-init.

This addresses PR 10265.

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

11 years ago-Wuninitialized: warn about uninitialized values resulting from ?: that evaluate...
Ted Kremenek [Sat, 19 Jan 2013 00:25:06 +0000 (00:25 +0000)]
-Wuninitialized: warn about uninitialized values resulting from ?: that evaluate to lvalues (in C++).

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

11 years agoRemove windows line endings.
David Blaikie [Fri, 18 Jan 2013 23:03:15 +0000 (23:03 +0000)]
Remove windows line endings.

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

11 years agoRemove unused variable
Matt Beaumont-Gay [Fri, 18 Jan 2013 22:34:17 +0000 (22:34 +0000)]
Remove unused variable

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

11 years agoAdopt llvm::hexDigitValue.
Jordan Rose [Fri, 18 Jan 2013 22:33:58 +0000 (22:33 +0000)]
Adopt llvm::hexDigitValue.

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

11 years agoFix mismatched #endif.
Jordan Rose [Fri, 18 Jan 2013 22:33:54 +0000 (22:33 +0000)]
Fix mismatched #endif.

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

11 years agoOnce we've collected the template arguments for a
Douglas Gregor [Fri, 18 Jan 2013 22:27:09 +0000 (22:27 +0000)]
Once we've collected the template arguments for a
partially-substituted parameter pack in a template, forget about the
partially-substituted parameter pack: it is now completed. Fixes
<rdar://problem/12176336>.

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

11 years agoThread-safety analysis: ignore edges from throw expressions in CFG.
DeLesley Hutchins [Fri, 18 Jan 2013 22:15:45 +0000 (22:15 +0000)]
Thread-safety analysis: ignore edges from throw expressions in CFG.

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

11 years agoInclude ubsan runtime even when building a shared library. We don't require the execu...
Richard Smith [Fri, 18 Jan 2013 22:09:26 +0000 (22:09 +0000)]
Include ubsan runtime even when building a shared library. We don't require the executable to be linked with UBSan.

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

11 years ago[mips] Enable inlining of atomic ops on mips32 and mips64.
Akira Hatanaka [Fri, 18 Jan 2013 21:58:11 +0000 (21:58 +0000)]
[mips] Enable inlining of atomic ops on mips32 and mips64.

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

11 years agoUse the AttributeSet query method instead of the Attribute method.
Bill Wendling [Fri, 18 Jan 2013 21:26:07 +0000 (21:26 +0000)]
Use the AttributeSet query method instead of the Attribute method.

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

11 years ago[PCH/Modules] Re-apply r172620 and r172629, now with 100% less infinite loops!
Argyrios Kyrtzidis [Fri, 18 Jan 2013 20:59:01 +0000 (20:59 +0000)]
[PCH/Modules] Re-apply r172620 and r172629, now with 100% less infinite loops!

Makes sure that a deserialized macro is only added to the preprocessor macro definitions only once.
Unfortunately I couldn't get a reduced test case.

rdar://13016031

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

11 years agoFix parsing of class specifiers before '\n' 'operator'.
Nico Weber [Fri, 18 Jan 2013 18:41:42 +0000 (18:41 +0000)]
Fix parsing of class specifiers before '\n' 'operator'.

r159549 / r159164 regressed clang to reject

  struct s {};
  struct s
  operator++(struct s a)
  { return a; }

This fixes the regression. Richard, pleas check if this looks right.

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

11 years ago[analyzer] Special path notes for C++ special member functions.
Jordan Rose [Fri, 18 Jan 2013 18:27:21 +0000 (18:27 +0000)]
[analyzer] Special path notes for C++ special member functions.

Examples:
  Calling implicit default constructor for Foo
  Calling defaulted move constructor for Foo
  Calling copy constructor for Foo
  Calling implicit destructor for Foo
  Calling defaulted move assignment operator for Foo
  Calling copy assignment operator for Foo

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

11 years ago[analyzer] Do a better job describing C++ member functions in the call stack.
Jordan Rose [Fri, 18 Jan 2013 18:27:14 +0000 (18:27 +0000)]
[analyzer] Do a better job describing C++ member functions in the call stack.

Examples:
  Calling constructor for 'Foo'
  Entered call from 'Foo::create'

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

11 years agoFix comment.
Manuel Klimek [Fri, 18 Jan 2013 18:24:28 +0000 (18:24 +0000)]
Fix comment.

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

11 years agoFixes issues around pulling in the next line in simple if statements.
Manuel Klimek [Fri, 18 Jan 2013 14:46:43 +0000 (14:46 +0000)]
Fixes issues around pulling in the next line in simple if statements.

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

11 years agoclang/test/CodeGen: Suppress a couple of tests on win32. It seems -fsanitize-blacklis...
NAKAMURA Takumi [Fri, 18 Jan 2013 14:11:04 +0000 (14:11 +0000)]
clang/test/CodeGen: Suppress a couple of tests on win32. It seems -fsanitize-blacklist doesn't accept DOSish pathnames.

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

11 years agoFixes problems with line merging in the face of preprocessor directives.
Manuel Klimek [Fri, 18 Jan 2013 14:04:34 +0000 (14:04 +0000)]
Fixes problems with line merging in the face of preprocessor directives.

This patch prepares being able to test for and fix more problems (see
FIXME in the test for example).

Previously we would output unwrapped lines for preprocessor directives
at the point where we also parsed the hash token. Since often
projections only terminate (and thus output their own unwrapped line)
after peeking at the next token, this would lead to the formatter seeing
the preprocessor directives out-of-order (slightly earlier). To be able
to correctly identify lines to merge, the formatter needs a well-defined
order of unwrapped lines, which this patch introduces.

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

11 years agoclang-check: Introduce llvm::sys::PrintStackTraceOnErrorSignal()
NAKAMURA Takumi [Fri, 18 Jan 2013 13:46:48 +0000 (13:46 +0000)]
clang-check: Introduce llvm::sys::PrintStackTraceOnErrorSignal()

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

11 years ago[ubsan] Add support for -fsanitize-blacklist
Will Dietz [Fri, 18 Jan 2013 11:30:38 +0000 (11:30 +0000)]
[ubsan] Add support for -fsanitize-blacklist

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

11 years agoReduce penalty for splitting between ")" and ".".
Daniel Jasper [Fri, 18 Jan 2013 10:56:38 +0000 (10:56 +0000)]
Reduce penalty for splitting between ")" and ".".

').' is likely part of a builder pattern statement.
This is based upon a patch developed by Nico Weber. Thank you!

Before:
int foo() {
  return llvm::StringSwitch<Reference::Kind>(name).StartsWith(
      ".eh_frame_hdr", ORDER_EH_FRAMEHDR).StartsWith(
      ".eh_frame", ORDER_EH_FRAME).StartsWith(".init", ORDER_INIT).StartsWith(
      ".fini", ORDER_FINI).StartsWith(".hash", ORDER_HASH).Default(ORDER_TEXT);
}

After:
int foo() {
  return llvm::StringSwitch<Reference::Kind>(name)
         .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
         .StartsWith(".eh_frame", ORDER_EH_FRAME)
         .StartsWith(".init", ORDER_INIT).StartsWith(".fini", ORDER_FINI)
         .StartsWith(".hash", ORDER_HASH).Default(ORDER_TEXT);
}

Probably not ideal, but makes many cases much more readable.

The changes to overriding-ftemplate-comments.cpp don't seem better or
worse. We should address those soon.

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

11 years agoAlso align trailing line comments in include directives.
Daniel Jasper [Fri, 18 Jan 2013 09:19:33 +0000 (09:19 +0000)]
Also align trailing line comments in include directives.

Before:
  #include <a> // for x
  #include <a/b/c> // for yz
After:
  #include <a>     // for x
  #include <a/b/c> // for yz

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

11 years agoLet the formatter align trailing line comments where possible.
Daniel Jasper [Fri, 18 Jan 2013 08:44:07 +0000 (08:44 +0000)]
Let the formatter align trailing line comments where possible.

Before:
int a; // comment
int bbbbb; // comment

After:
int a;     // comment
int bbbbb; // comment

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

11 years agoFormatter: After case blocks, "break" goes on the same line as the "}", PR14907.
Nico Weber [Fri, 18 Jan 2013 05:50:57 +0000 (05:50 +0000)]
Formatter: After case blocks, "break" goes on the same line as the "}", PR14907.

Before:
switch (foo) {
case a: {
  int a = g();
  h(a);
}
  break;
}

Now:
switch (foo) {
case a: {
  int a = g();
  h(a);
} break;
}

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

11 years agoFormatter: Enable @encode test.
Nico Weber [Fri, 18 Jan 2013 05:11:47 +0000 (05:11 +0000)]
Formatter: Enable @encode test.

This doesn't work right with pointers to pointers, but that's likely just a
dupe of PR14884.

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

11 years agoRevert Clang r172620 and r172629, which caused a hang when building
Douglas Gregor [Fri, 18 Jan 2013 04:34:14 +0000 (04:34 +0000)]
Revert Clang r172620 and r172629, which caused a hang when building
complicated modules (<rdar://problem/13038265>). Unfortunately, this
un-fixes <rdar://problem/13016031>.

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

11 years agoFormatter: The contents of @selector() should be formatted as a selector.
Nico Weber [Fri, 18 Jan 2013 02:43:57 +0000 (02:43 +0000)]
Formatter: The contents of @selector() should be formatted as a selector.

Before: @selector(foo: )
Now: @selector(foo:)

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

11 years agoWhen checking the parameter types of an Objective-C method, don't
Douglas Gregor [Fri, 18 Jan 2013 01:41:40 +0000 (01:41 +0000)]
When checking the parameter types of an Objective-C method, don't
decay the parameter type immediately; let CheckParameter() do its
job. Fixes <rdar://problem/12071218>.

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

11 years ago[ms-inline asm] Test case for r172773.
Chad Rosier [Fri, 18 Jan 2013 00:51:29 +0000 (00:51 +0000)]
[ms-inline asm] Test case for r172773.

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

11 years agoOne can override an Objective-C ARC ownership qualifier that came from
Douglas Gregor [Thu, 17 Jan 2013 23:59:28 +0000 (23:59 +0000)]
One can override an Objective-C ARC ownership qualifier that came from
a template parameter; make that also include one that came from
'auto'. Fixes <rdar://problem/12078752>.

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

11 years agoSome builtins do not evaluate their arguments. Teach EvaluatedExprVisitor not
Richard Smith [Thu, 17 Jan 2013 23:46:04 +0000 (23:46 +0000)]
Some builtins do not evaluate their arguments. Teach EvaluatedExprVisitor not
to visit them.

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

11 years agoIn Objective-C ARC, completely ignore ownership qualifiers on the
Douglas Gregor [Thu, 17 Jan 2013 23:36:45 +0000 (23:36 +0000)]
In Objective-C ARC, completely ignore ownership qualifiers on the
return type of a function by canonicalizing them away. They are
useless anyway, and conflict with our rules for template argument
deduction and __strong. Fixes <rdar://problem/12367446>.

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

11 years ago[analyzer] DirectIvarAssignment: allow suppression annotation on Ivars.
Anna Zaks [Thu, 17 Jan 2013 23:24:58 +0000 (23:24 +0000)]
[analyzer] DirectIvarAssignment: allow suppression annotation on Ivars.

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

11 years agoDefer checking for unsequenced operations on the RHS of && and || in order to
Richard Smith [Thu, 17 Jan 2013 23:18:09 +0000 (23:18 +0000)]
Defer checking for unsequenced operations on the RHS of && and || in order to
reduce stack usage and hopefully bring back the linux x86_64 buildbot.

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

11 years agoFormat strings: don't ever convert %+d to %lu.
Jordan Rose [Thu, 17 Jan 2013 22:34:10 +0000 (22:34 +0000)]
Format strings: don't ever convert %+d to %lu.

Presumably, if the printf format has the sign explicitly requested, the user
wants to treat the data as signed.

This is a fix-up for r172739, and also includes several test changes that
didn't make it into that commit.

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

11 years agoParsing support for C11's _Noreturn keyword. No semantics yet.
Richard Smith [Thu, 17 Jan 2013 22:16:11 +0000 (22:16 +0000)]
Parsing support for C11's _Noreturn keyword. No semantics yet.

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

11 years ago-Wunsequenced: if the LHS of an &&, || or ?: is not constant, check for
Richard Smith [Thu, 17 Jan 2013 22:06:26 +0000 (22:06 +0000)]
-Wunsequenced: if the LHS of an &&, || or ?: is not constant, check for
unsequenced operations in the RHS. We don't compare the RHS with the rest of
the expression yet; such checks will need care to avoid diagnosing unsequenced
operations which are both in conditionally-evaluated subexpressions which
actually can't occur together, such as in '(b && ++x) + (!b && ++x)'.

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

11 years agoWe want the dwarf AT_producer for assembly source files to match clang's
Kevin Enderby [Thu, 17 Jan 2013 21:38:06 +0000 (21:38 +0000)]
We want the dwarf AT_producer for assembly source files to match clang's
AT_producer.  Which includes clang's version information so we can tell
which version of the compiler was used.

This is second of the two steps to allow us to do this.  The first was a
change to llvm-mc with revision 172630 to provide a method to set the
AT_producer string.  This second step has the clang driver passing the value
of getClangFullVersion() via the new flag -dwarf-debug-producer when invoking
the integrated assembler on assembly source files.  Then using the new
setDwarfDebugProducer() method to set the AT_producer string.

rdar://12888242

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

11 years agoDo not pass -pie flag to linker if -shared specified. This matches
Peter Collingbourne [Thu, 17 Jan 2013 20:17:16 +0000 (20:17 +0000)]
Do not pass -pie flag to linker if -shared specified.  This matches
the gcc driver and makes it possible to add -pie to $CC or similar and
have it apply in the right places.

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

11 years ago[ms-inline asm] Updates and test case for r172743.
Chad Rosier [Thu, 17 Jan 2013 19:22:48 +0000 (19:22 +0000)]
[ms-inline asm] Updates and test case for r172743.
Part of rdar://12576868

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

11 years ago[ms-inline asm] Extend the Sema interface to get the size and length of a
Chad Rosier [Thu, 17 Jan 2013 19:21:24 +0000 (19:21 +0000)]
[ms-inline asm] Extend the Sema interface to get the size and length of a
VarDecl.
Part of rdar://12576868

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

11 years agoFormat strings: correct signedness if already correcting width (%d,%u).
Jordan Rose [Thu, 17 Jan 2013 18:47:16 +0000 (18:47 +0000)]
Format strings: correct signedness if already correcting width (%d,%u).

It is valid to do this:
  printf("%u", (int)x);

But if we see this:
  printf("%lu", (int)x);

...our fixit should suggest %d, not %u.

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

11 years agoConvert test/FixIt/format-darwin.m to use relative line numbers.
Jordan Rose [Thu, 17 Jan 2013 18:47:12 +0000 (18:47 +0000)]
Convert test/FixIt/format-darwin.m to use relative line numbers.

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

11 years agoAdd some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are not...
Joey Gouly [Thu, 17 Jan 2013 17:35:00 +0000 (17:35 +0000)]
Add some semantic checks for OpenCL. Variadic macros, VLAs and bitfields are not supported.

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

11 years agoFormatter: Get bit tests in ifs right.
Nico Weber [Thu, 17 Jan 2013 17:17:19 +0000 (17:17 +0000)]
Formatter: Get bit tests in ifs right.

It's generally not possible to know if 'a' '*' 'b' is a multiplication
expression or a variable declaration with a purely lexer-based approach. The
formatter currently uses a heuristic that classifies this token sequence as a
multiplication in rhs contexts (after '=' or 'return') and as a declaration
else.

Because of this, it gets bit tests in ifs, such as "if (a & b)" wrong. However,
declarations in ifs always have to be followed by '=', so this patch changes
the formatter to classify '&' as an operator if it's at the start of an if
statement.

Before:
  if (a& b)
  if (int* b = f())

Now:
  if (a & b)
  if (int* b = f())

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

11 years agoDocumentation: formatting
Dmitri Gribenko [Thu, 17 Jan 2013 17:04:54 +0000 (17:04 +0000)]
Documentation: formatting

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

11 years agoAllow breaking after the trailing const after a function declaration.
Daniel Jasper [Thu, 17 Jan 2013 13:31:52 +0000 (13:31 +0000)]
Allow breaking after the trailing const after a function declaration.

Before:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) const GUARDED_BY(
    aaaaaaaaaaaaa);

After:
void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) const
    GUARDED_BY(aaaaaaaaaaaaa);

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

11 years agoAdd initial rough support for synthesizing linker options when passed
Chandler Carruth [Thu, 17 Jan 2013 13:19:29 +0000 (13:19 +0000)]
Add initial rough support for synthesizing linker options when passed
-fopenmp in the link step on Linux. There is probably more tweaking that
will need to take place to get good support for linking the relevant
libraries on all Linux distributions and/or on other platforms, but this
get's the ball moving and allows Clang to build programs which contain
OpenMP pragmas that can be safely ignored by a compiler that doesn't
implement them, and yet makes direct calls into the OpenMP runtime.

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

11 years agoImprove handling of comments in static initializers.
Daniel Jasper [Thu, 17 Jan 2013 12:53:34 +0000 (12:53 +0000)]
Improve handling of comments in static initializers.

Also adding more tests.

We can now keep the formatting of something like:

static SomeType type = { aaaaaaaaaaaaaaaaaaaa, /* comment */
                         aaaaaaaaaaaaaaaaaaaa /* comment */,
                         /* comment */ aaaaaaaaaaaaaaaaaaaa,
                         aaaaaaaaaaaaaaaaaaaa, // comment
                         aaaaaaaaaaaaaaaaaaaa };

Note that the comment in the first line is handled like a trailing line comment
as that is likely what the user intended.

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

11 years agoImprove -Wreorder to handle cases of anonymous class member ordering
David Blaikie [Thu, 17 Jan 2013 08:49:22 +0000 (08:49 +0000)]
Improve -Wreorder to handle cases of anonymous class member ordering

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

11 years agoclang/test/Index/code-completion-skip-bodies.cpp: Check stdout and stderr individuall...
NAKAMURA Takumi [Thu, 17 Jan 2013 07:27:55 +0000 (07:27 +0000)]
clang/test/Index/code-completion-skip-bodies.cpp: Check stdout and stderr individually, rather than mixed output of stdout and stderr with 2>&1.

XFAIL(s) are removed.

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

11 years agoRevert most of r172140.
Nico Weber [Thu, 17 Jan 2013 06:14:50 +0000 (06:14 +0000)]
Revert most of r172140.

r172140 changed the formatter to produce "-(id) foo" instead of "- (id)foo"
in google style, with a link to
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions
as reference.  But now that I look at that link again, it seems I didn't
read it very carefully the first time round.

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

11 years agoArrayRef-ize some ctor initializer related APIs
David Blaikie [Thu, 17 Jan 2013 05:26:25 +0000 (05:26 +0000)]
ArrayRef-ize some ctor initializer related APIs

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

11 years agoRemove some unnecessary casts
David Blaikie [Thu, 17 Jan 2013 05:26:21 +0000 (05:26 +0000)]
Remove some unnecessary casts

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

11 years agoAdd test for PR12938, fixed by Richard Smith in r172691
David Blaikie [Thu, 17 Jan 2013 02:43:00 +0000 (02:43 +0000)]
Add test for PR12938, fixed by Richard Smith in r172691

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

11 years agoSuppress all -Wunused-value warnings from macro body expansions.
Matt Beaumont-Gay [Thu, 17 Jan 2013 02:06:08 +0000 (02:06 +0000)]
Suppress all -Wunused-value warnings from macro body expansions.

This is inspired by a number of false positives in real code, including
PR14968. I've added test cases reduced from these false positives to
test/Sema/unused-expr.c, as well as corresponding test cases that pass the
offending expressions as arguments to a no-op macro to ensure that we do warn
there.

This also removes my previous tweak from r166522/r166534, so that we warn on
unused cast expressions in macro arguments.

There were several test cases that were using -Wunused-value to test general
diagnostic emission features; I changed those to use other warnings or warn on
a macro argument expression. I stared at the test case for PR14399 for a while
with Richard Smith and we believe the new test case exercises the same
codepaths as before.

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

11 years agoAdd a comment for Daniel
Douglas Gregor [Thu, 17 Jan 2013 01:58:31 +0000 (01:58 +0000)]
Add a comment for Daniel

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

11 years agoTest that we correctly handle reversion of line splicing etc in raw string
Richard Smith [Thu, 17 Jan 2013 01:46:13 +0000 (01:46 +0000)]
Test that we correctly handle reversion of line splicing etc in raw string
literals. As suggested by Sean Silva.

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

11 years agoAttempt to work around bug in older GCCs to fix buildbot.
Richard Smith [Thu, 17 Jan 2013 01:40:50 +0000 (01:40 +0000)]
Attempt to work around bug in older GCCs to fix buildbot.

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

11 years ago[IRgen] Update modules autolink metadata to use module flags (as now specified
Daniel Dunbar [Thu, 17 Jan 2013 01:35:06 +0000 (01:35 +0000)]
[IRgen] Update modules autolink metadata to use module flags (as now specified
in the LangRef).

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

11 years agoImplement C++11 semantics for [[noreturn]] attribute. This required splitting
Richard Smith [Thu, 17 Jan 2013 01:30:42 +0000 (01:30 +0000)]
Implement C++11 semantics for [[noreturn]] attribute. This required splitting
it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their
semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as
affecting the function type, whereas [[noreturn]] does not).

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

11 years agoAdd -Wunsequenced (with compatibility alias -Wsequence-point) to warn on
Richard Smith [Thu, 17 Jan 2013 01:17:56 +0000 (01:17 +0000)]
Add -Wunsequenced (with compatibility alias -Wsequence-point) to warn on
expressions which have undefined behavior due to multiple unsequenced
modifications or an unsequenced modification and use of a variable.

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

11 years agoclang/test/Modules/compiler_builtins.m: Mark this as XFAIL:win32 for now. Investigating.
NAKAMURA Takumi [Thu, 17 Jan 2013 01:07:09 +0000 (01:07 +0000)]
clang/test/Modules/compiler_builtins.m: Mark this as XFAIL:win32 for now. Investigating.

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

11 years agoTreat hidden Objective-C protocol definitions as if they were
Douglas Gregor [Thu, 17 Jan 2013 00:38:46 +0000 (00:38 +0000)]
Treat hidden Objective-C protocol definitions as if they were
undefined, and don't find methods or protocols within those protocol
definitions. This completes <rdar://problem/10634711>.

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

11 years agoImplement a fixit for -Wmain-return-type
Dmitri Gribenko [Thu, 17 Jan 2013 00:26:13 +0000 (00:26 +0000)]
Implement a fixit for -Wmain-return-type

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

11 years agoobjC block layout: Patch reorders block layout to
Fariborz Jahanian [Thu, 17 Jan 2013 00:25:06 +0000 (00:25 +0000)]
objC block layout: Patch reorders block layout to
produce more inline layout metadata. // rdar://12752901

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

11 years agoFix a typo introduced in r172665.
Matt Beaumont-Gay [Thu, 17 Jan 2013 00:21:55 +0000 (00:21 +0000)]
Fix a typo introduced in r172665.

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

11 years ago[objcmt] Rewrite a NSDictionary dictionaryWithObjects:forKeys: to a dictionary literal
Argyrios Kyrtzidis [Wed, 16 Jan 2013 23:54:48 +0000 (23:54 +0000)]
[objcmt] Rewrite a NSDictionary dictionaryWithObjects:forKeys: to a dictionary literal
if we can see the elements of the arrays.

for example:

 NSDictionary *dict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"1", @"2", nil] forKeys:[NSArray arrayWithObjects:@"A", @"B", nil]];

-->

 NSDictionary *dict = @{ @"A" : @"1", @"B" : @"2" };

rdar://12428166

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