]> granicus.if.org Git - clang/log
clang
12 years agoEmit -verify diagnostics even when we have a fatal error.
Jordan Rose [Wed, 11 Jul 2012 16:50:36 +0000 (16:50 +0000)]
Emit -verify diagnostics even when we have a fatal error.

Previously we'd halt at the fatal error as expected, but not actually emit
any -verify-related diagnostics. This lets us catch cases that emit a
/different/ fatal error from the one we expected.

This is implemented by adding a "force emit" mode to DiagnosticBuilder, which
will cause diagnostics to immediately be emitted regardless of current
suppression. Needless to say this should probably be used /very/ sparingly.

Patch by Andy Gibbs! Tests for all of Andy's -verify patches coming soon.

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

12 years agoDefault to -std=c++11 on Windows.
Nico Weber [Wed, 11 Jul 2012 16:46:17 +0000 (16:46 +0000)]
Default to -std=c++11 on Windows.

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

12 years agoRemove unused override of CompilerInvocation::setLangDefaults().
Nico Weber [Wed, 11 Jul 2012 16:15:04 +0000 (16:15 +0000)]
Remove unused override of CompilerInvocation::setLangDefaults().

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

12 years agoFix handling of curly braces in NVPTX inline asm
Justin Holewinski [Wed, 11 Jul 2012 15:34:55 +0000 (15:34 +0000)]
Fix handling of curly braces in NVPTX inline asm

Fixes bug 13322

Patch by Dmitry Mikushin

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

12 years agoTemporarily revert this to see if it brings the gdb bot back.
Eric Christopher [Wed, 11 Jul 2012 15:32:13 +0000 (15:32 +0000)]
Temporarily revert this to see if it brings the gdb bot back.

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

12 years agoFix usage instructions for clang-check.
Daniel Jasper [Wed, 11 Jul 2012 15:05:24 +0000 (15:05 +0000)]
Fix usage instructions for clang-check.

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

12 years agoHow to set up clang tools for llvm
Alexander Kornienko [Wed, 11 Jul 2012 14:27:44 +0000 (14:27 +0000)]
How to set up clang tools for llvm

Summary: How to guide for setting up clang tooling for llvm repo.

Test Plan: this is untested

Reviewers: klimek, djasper

Reviewed By: klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D3

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

12 years agoclang/test/Misc/diag-template-diffing-color.cpp: Introduce the feature 'ansi-escape...
NAKAMURA Takumi [Wed, 11 Jul 2012 11:44:00 +0000 (11:44 +0000)]
clang/test/Misc/diag-template-diffing-color.cpp: Introduce the feature 'ansi-escape-sequences'.

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

12 years agoLLVM_ON_WIN32 case: use the proper key in the UniqueFiles map.
Axel Naumann [Wed, 11 Jul 2012 09:41:34 +0000 (09:41 +0000)]
LLVM_ON_WIN32 case: use the proper key in the UniqueFiles map.

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

12 years agoDon't process #pragma visibility during instantiation. The visibility of the
Rafael Espindola [Wed, 11 Jul 2012 02:15:51 +0000 (02:15 +0000)]
Don't process #pragma visibility during instantiation. The visibility of the
instantiation depends on the template, its arguments and parameters, but not
where it is instantiated.

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

12 years agoThe end of a block doesn't necessarily need a line table entry unless
Eric Christopher [Wed, 11 Jul 2012 01:49:26 +0000 (01:49 +0000)]
The end of a block doesn't necessarily need a line table entry unless
there's something going on there. Remove the unconditional line entry
and only add one if we're emitting cleanups (any other statements
would be handled normally).

Fixes rdar://9199234

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

12 years agoFileCheck-ize.
Eric Christopher [Wed, 11 Jul 2012 01:49:24 +0000 (01:49 +0000)]
FileCheck-ize.

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

12 years ago[analyzer] Add debug.DumpCalls, which prints out any CallEvents it sees.
Jordan Rose [Tue, 10 Jul 2012 23:56:23 +0000 (23:56 +0000)]
[analyzer] Add debug.DumpCalls, which prints out any CallEvents it sees.

This is probably not so useful yet because it is not path-sensitive, though
it does try to show inlining with indentation.

This also adds a dump() method to CallEvent, which should be useful for
debugging.

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

12 years ago[analyzer] Guard against C++ member functions that look like system functions.
Jordan Rose [Tue, 10 Jul 2012 23:13:01 +0000 (23:13 +0000)]
[analyzer] Guard against C++ member functions that look like system functions.

C++ method calls and C function calls both appear as CallExprs in the AST.
This was causing crashes for an object that had a 'free' method.

<rdar://problem/11822244>

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

12 years agoFix crash when constant-evaluating a CXXConstructExpr representing
Richard Smith [Tue, 10 Jul 2012 22:12:55 +0000 (22:12 +0000)]
Fix crash when constant-evaluating a CXXConstructExpr representing
value-initialization for an array of class type with a trivial default
constructor.

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

12 years ago[analyzer] Construct stack variables directly in their VarDecl.
Jordan Rose [Tue, 10 Jul 2012 22:08:01 +0000 (22:08 +0000)]
[analyzer] Construct stack variables directly in their VarDecl.

Also contains a number of tweaks to inlining that are necessary
for constructors and destructors. (I have this enabled on a private
branch, but it is very much unstable.)

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

12 years ago[analyzer] Use CallEvent for building inlined stack frames.
Jordan Rose [Tue, 10 Jul 2012 22:07:57 +0000 (22:07 +0000)]
[analyzer] Use CallEvent for building inlined stack frames.

In order to accomplish this, we now build the callee's stack frame
as part of the CallEnter node, rather than the subsequent BlockEdge node.
This should not have any effect on perceived behavior or diagnostics.

This makes it safe to re-enable inlining of member overloaded operators.

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

12 years ago[analyzer] Make CallEnter, CallExitBegin, and CallExitEnd not be StmtPoints
Jordan Rose [Tue, 10 Jul 2012 22:07:52 +0000 (22:07 +0000)]
[analyzer] Make CallEnter, CallExitBegin, and CallExitEnd not be StmtPoints

These ProgramPoints are used in inlining calls,
and not all calls have associated statements anymore.

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

12 years ago[analyzer] Add a CXXDestructorCall CallEvent.
Jordan Rose [Tue, 10 Jul 2012 22:07:47 +0000 (22:07 +0000)]
[analyzer] Add a CXXDestructorCall CallEvent.

While this work is still fairly tentative (destructors are still left out of
the CFG by default), we now handle destructors in the same way as any other
calls, instead of just automatically trying to inline them.

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

12 years ago[analyzer] Add new PreImplicitCall and PostImplicitCall ProgramPoints.
Jordan Rose [Tue, 10 Jul 2012 22:07:42 +0000 (22:07 +0000)]
[analyzer] Add new PreImplicitCall and PostImplicitCall ProgramPoints.

These are currently unused, but are intended to be used in lieu of PreStmt
and PostStmt when the call is implicit (e.g. an automatic object destructor).

This also modifies the Data1 field of ProgramPoints to allow storing any
pointer-sized value, as opposed to only aligned pointers. This is necessary
to store SourceLocations.

There is currently no BugReporter support for these; they should be skipped
over in any diagnostic output.

This commit also tags checkers that currently rely on function calls only
occurring at StmtPoints.

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

12 years agoThread safety analysis: impove handling of trylock expressions.
DeLesley Hutchins [Tue, 10 Jul 2012 21:47:55 +0000 (21:47 +0000)]
Thread safety analysis: impove handling of trylock expressions.

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

12 years ago80-column violations and whitespace.
Chad Rosier [Tue, 10 Jul 2012 21:35:27 +0000 (21:35 +0000)]
80-column violations and whitespace.

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

12 years ago Add more matchers and do cleanups.
Daniel Jasper [Tue, 10 Jul 2012 20:20:19 +0000 (20:20 +0000)]
Add more matchers and do cleanups.

    Reviewers: klimek

    Differential Revision: http://ec2-50-18-127-156.us-west-1.compute.amazonaws.com/D2

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

12 years agoDisable death tests on platforms which don't support them.
Benjamin Kramer [Tue, 10 Jul 2012 17:30:44 +0000 (17:30 +0000)]
Disable death tests on platforms which don't support them.

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

12 years agoAdds support for auto-detection of compilation databases, looking in a directory...
Arnaud A. de Grandmaison [Tue, 10 Jul 2012 16:56:35 +0000 (16:56 +0000)]
Adds support for auto-detection of compilation databases, looking in a directory and all its parents.

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

12 years agoImprove r159256 following Chandler's comments:
Axel Naumann [Tue, 10 Jul 2012 16:50:27 +0000 (16:50 +0000)]
Improve r159256 following Chandler's comments:
Implement UniqueFileContainer::erase(), camelCase, add comment on future optimizations of the cache versus de-optimizations of invalidations.

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

12 years ago[analyzer] Remove redundant check (scalar type is a superset of integer)
Anna Zaks [Tue, 10 Jul 2012 16:27:55 +0000 (16:27 +0000)]
[analyzer] Remove redundant check (scalar type is a superset of integer)

PR13319 Reported by Jozsef Mihalicza.

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

12 years agoClear diagnostic counts after processing the diagnostics.
Axel Naumann [Tue, 10 Jul 2012 16:24:07 +0000 (16:24 +0000)]
Clear diagnostic counts after processing the diagnostics.
The consumer might see multiple input files (e.g. for cling) and since r159977 the count is maintained across input files.

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

12 years agoFixes the MSVC build.
Manuel Klimek [Tue, 10 Jul 2012 14:21:30 +0000 (14:21 +0000)]
Fixes the MSVC build.

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

12 years agoAdds support for auto-detection of compilation databases
Manuel Klimek [Tue, 10 Jul 2012 13:10:51 +0000 (13:10 +0000)]
Adds support for auto-detection of compilation databases
from a source file and changes clang-check to make use of this.

This makes clang-check just work on in-tree builds, and allows
easy setup via a symlink per source directory to make clang-check
work without any extra configuration.

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

12 years agoUpdate the docs with specifics about escaping of compile commands.
Manuel Klimek [Tue, 10 Jul 2012 08:05:54 +0000 (08:05 +0000)]
Update the docs with specifics about escaping of compile commands.

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

12 years agoJordan points out that this was incorrect: clang should recover from
Chris Lattner [Tue, 10 Jul 2012 05:03:05 +0000 (05:03 +0000)]
Jordan points out that this was incorrect: clang should recover from
*errors* with fixits on them by following the recovery advised by the
fixit, but if it is a fixit on a warning, then obviously the AST
should be for the code as-written.

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

12 years agoAllow -verify directives to specify a min and max count, not just "+".
Jordan Rose [Tue, 10 Jul 2012 02:57:26 +0000 (02:57 +0000)]
Allow -verify directives to specify a min and max count, not just "+".

  void f(); // expected-note 0+ {{previous declaration is here}}
  void g(); // expected-note 0-1 {{previous declaration is here}}

The old "+" syntax is still an alias for "1+", and single numbers still work.

Patch by Andy Gibbs!

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

12 years agoAllow line numbers on -verify directives.
Jordan Rose [Tue, 10 Jul 2012 02:57:03 +0000 (02:57 +0000)]
Allow line numbers on -verify directives.

// expected-warning@10 {{some text}}

The line number may be absolute (as above), or relative to the current
line by prefixing the number with either '+' or '-'.

Patch by Andy Gibbs!

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

12 years agoClean up VerifyDiagnosticsConsumer in preparation for upcoming enhancements.
Jordan Rose [Tue, 10 Jul 2012 02:56:15 +0000 (02:56 +0000)]
Clean up VerifyDiagnosticsConsumer in preparation for upcoming enhancements.

Patch by Andy Gibbs!

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

12 years agoProperly update the FormattedArgs vector when the template type diffing falls
Richard Trieu [Tue, 10 Jul 2012 01:46:04 +0000 (01:46 +0000)]
Properly update the FormattedArgs vector when the template type diffing falls
back to regular type printing.

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

12 years agoAdd an explanation of -Wobjc-literal-compare to the "Objective-C Literals" page
Jordan Rose [Tue, 10 Jul 2012 00:20:57 +0000 (00:20 +0000)]
Add an explanation of -Wobjc-literal-compare to the "Objective-C Literals" page

(per Jean-Daniel's suggestion to keep around an explanation of why
direct comparisons on ObjC literals are a bad idea)

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

12 years ago[cindex.py] Make CompileCommand.arguments usage consistent with CompileCommand.direct...
Arnaud A. de Grandmaison [Tue, 10 Jul 2012 00:00:05 +0000 (00:00 +0000)]
[cindex.py] Make CompileCommand.arguments usage consistent with CompileCommand.directory and the rest of the python binding

Patch by David Röthlisberger

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

12 years agoRevert 159966 since Tanya temporarily updated the test case.
Chad Rosier [Mon, 9 Jul 2012 23:04:15 +0000 (23:04 +0000)]
Revert 159966 since Tanya temporarily updated the test case.

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

12 years agoTEMPORARY. I will fix this properly shortly.
Tanya Lattner [Mon, 9 Jul 2012 23:01:07 +0000 (23:01 +0000)]
TEMPORARY. I will fix this properly shortly.
Silence buildbot so I can figure out the right flag to put this warning under.

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

12 years agoPut new warning in r159965 under a flag to appease buildbots. Someone please
Chad Rosier [Mon, 9 Jul 2012 22:59:22 +0000 (22:59 +0000)]
Put new warning in r159965 under a flag to appease buildbots.  Someone please
verify this is the correct grouping.

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

12 years agoPatch by Anton Lokhmotov to add OpenCL work group size attributes.
Tanya Lattner [Mon, 9 Jul 2012 22:06:01 +0000 (22:06 +0000)]
Patch by Anton Lokhmotov to add OpenCL work group size attributes.

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

12 years agoComment lexing: fix lexing to actually work in non-error cases.
Dmitri Gribenko [Mon, 9 Jul 2012 21:32:40 +0000 (21:32 +0000)]
Comment lexing: fix lexing to actually work in non-error cases.

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

12 years agoThe delete argument should not be converted to void*.
Abramo Bagnara [Mon, 9 Jul 2012 21:15:43 +0000 (21:15 +0000)]
The delete argument should not be converted to void*.

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

12 years agoobjective-c: provide fixit hint for @autoreleasepool
Fariborz Jahanian [Mon, 9 Jul 2012 20:00:35 +0000 (20:00 +0000)]
objective-c: provide fixit hint for @autoreleasepool
and similar other keywords. // rdar://10723084

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

12 years agoSilence unused variable warning in -Asserts build
Matt Beaumont-Gay [Mon, 9 Jul 2012 18:55:31 +0000 (18:55 +0000)]
Silence unused variable warning in -Asserts build

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

12 years agoTests: check for target availability for target-specific tests.
Jim Grosbach [Mon, 9 Jul 2012 18:34:21 +0000 (18:34 +0000)]
Tests: check for target availability for target-specific tests.

Lots of tests are using an explicit target triple w/o first checking that the
target is actually available. Add a REQUIRES clause to a bunch of them. This should
hopefully unbreak bots which don't configure w/ all targets enabled.

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

12 years agoobjective-c: yank any use of "non-fragile abi" phrase
Fariborz Jahanian [Mon, 9 Jul 2012 17:54:36 +0000 (17:54 +0000)]
objective-c: yank any use of "non-fragile abi" phrase
from diagnostics. // rdar://9657485

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

12 years ago80-column and whitespace.
Chad Rosier [Mon, 9 Jul 2012 17:31:28 +0000 (17:31 +0000)]
80-column and whitespace.

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

12 years agoBetter parser recovery in Objective-C containers.
Jordan Rose [Mon, 9 Jul 2012 16:54:53 +0000 (16:54 +0000)]
Better parser recovery in Objective-C containers.

Previously it was possible to get an infinite-loop-on-invalid with a namespace
decl within @interface. Since 'namespace' is normally a safe place to retry
top-level parsing, we just didn't consume the token.

This adds a flag that tracks whether we have temporarily left Objective-C
scope to parse a C-like declaration, and uses that to better recover from
parse problems by stopping at possible method declarations and at @end. To
fix the original problem, we do /not/ stop at 'namespace' when in an
Objective-C @interface or @protocol context (but still do in @implementation).

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

12 years ago[analyzer] When inlining, make sure we use the definition decl.
Jordan Rose [Mon, 9 Jul 2012 16:54:49 +0000 (16:54 +0000)]
[analyzer] When inlining, make sure we use the definition decl.

This was a regression introduced during the CallEvent changes; a call to
FunctionDecl::hasBody was also being used to replace the decl found by
lookup with the actual definition. To keep from making this mistake again
(particularly if/when we start inlining Objective-C methods), this commit
adds a "getDefinition()" method to CallEvent, which should do the right
thing under any circumstances.

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

12 years agoDowngrade the "direct comparison" error for ObjC literals to a warning.
Jordan Rose [Mon, 9 Jul 2012 16:54:44 +0000 (16:54 +0000)]
Downgrade the "direct comparison" error for ObjC literals to a warning.

Chris pointed out that while the comparison is certainly problematic
and does not have well-defined behavior, it isn't any worse than some
of the other abuses that we merely warn about and doesn't need to make
the compilation fail.

Revert the release notes change (r159766) now that this is just a new warning.

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

12 years ago[CMake] Get rid of unconditional dependency to ClangDiagnosticCommon. Only clangBasic...
NAKAMURA Takumi [Mon, 9 Jul 2012 14:12:20 +0000 (14:12 +0000)]
[CMake] Get rid of unconditional dependency to ClangDiagnosticCommon. Only clangBasic and clangASTMatchers need it.

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

12 years ago[cindex.py] fix infinite iteration of compilation database CompileCommands
Arnaud A. de Grandmaison [Mon, 9 Jul 2012 11:57:30 +0000 (11:57 +0000)]
[cindex.py] fix infinite iteration of compilation database CompileCommands

Patch by David Röthlisberger

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

12 years agoInline storage of attributes in AttributedStmt.
Alexander Kornienko [Mon, 9 Jul 2012 10:04:07 +0000 (10:04 +0000)]
Inline storage of attributes in AttributedStmt.

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

12 years agoLinks to the python CXCompilationDatabase documentation.
Manuel Klimek [Mon, 9 Jul 2012 05:17:45 +0000 (05:17 +0000)]
Links to the python CXCompilationDatabase documentation.
Patch contributed by David Roethlisberger.

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

12 years agoPR13136:
Richard Smith [Mon, 9 Jul 2012 03:07:20 +0000 (03:07 +0000)]
PR13136:

 * When substituting a reference to a non-type template parameter pack where the
   corresponding argument is a pack expansion, transform into an expression
   which contains an unexpanded parameter pack rather than into an expression
   which contains a pack expansion. This causes the SubstNonTypeTemplateParmExpr
   to be inside the PackExpansionExpr, rather than outside, so the expression
   still looks like a pack expansion and can be deduced.

 * Teach MarkUsedTemplateParameters that we can deduce a reference to a template
   parameter if it's wrapped in a SubstNonTypeTemplateParmExpr (such nodes are
   added during alias template substitution).

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

12 years agoHalve template depth in an attempt to get this test passing on mingw32.
Richard Smith [Sun, 8 Jul 2012 21:06:29 +0000 (21:06 +0000)]
Halve template depth in an attempt to get this test passing on mingw32.

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

12 years agoAdd missing options for -m(no-){pclmul,fma,xop}.
Benjamin Kramer [Sun, 8 Jul 2012 09:45:00 +0000 (09:45 +0000)]
Add missing options for -m(no-){pclmul,fma,xop}.

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

12 years agotest/SemaTemplate/instantiation-depth-defarg.cpp: Mark as XFAIL:mingw for now.
NAKAMURA Takumi [Sun, 8 Jul 2012 09:35:16 +0000 (09:35 +0000)]
test/SemaTemplate/instantiation-depth-defarg.cpp: Mark as XFAIL:mingw for now.

I'll try to increase stack size later.

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

12 years agoMIPS: Range check __builtin_mips_wrdsp / __builtin_mips_rddsp arguments against the...
Simon Atanasyan [Sun, 8 Jul 2012 09:30:00 +0000 (09:30 +0000)]
MIPS: Range check __builtin_mips_wrdsp / __builtin_mips_rddsp arguments against the upper/lower values.

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

12 years agoMIPS: Mark arguments of __builtin_mips_wrdsp / __builtin_mips_rddsp as a constant...
Simon Atanasyan [Sun, 8 Jul 2012 09:10:14 +0000 (09:10 +0000)]
MIPS: Mark arguments of __builtin_mips_wrdsp / __builtin_mips_rddsp as a constant expression.

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

12 years agoPR13243: When deducing a non-type template parameter which is specified as an
Richard Smith [Sun, 8 Jul 2012 04:37:51 +0000 (04:37 +0000)]
PR13243: When deducing a non-type template parameter which is specified as an
expression, skip over any SubstNonTypeTemplateParmExprs which alias templates
may have inserted before checking for a DeclRefExpr referring to a non-type
template parameter declaration.

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

12 years agoPR13293: Defer deduction of an auto type with a dependent declarator, such as "auto...
Richard Smith [Sun, 8 Jul 2012 04:13:07 +0000 (04:13 +0000)]
PR13293: Defer deduction of an auto type with a dependent declarator, such as "auto (*f)(T t)".

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

12 years agoPR9793: Treat substitution as an instantiation step for the purpose of the
Richard Smith [Sun, 8 Jul 2012 02:38:24 +0000 (02:38 +0000)]
PR9793: Treat substitution as an instantiation step for the purpose of the
-ftemplate-depth limit.  There are various ways to get an infinite (or merely
huge) stack of substitutions with no intervening instantiations. This is also
consistent with gcc's behavior.

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

12 years agoASTMatchers/CMakeLists.txt: Add dependencies to generated headers, or "make clean...
NAKAMURA Takumi [Sat, 7 Jul 2012 23:13:30 +0000 (23:13 +0000)]
ASTMatchers/CMakeLists.txt: Add dependencies to generated headers, or "make clean; make ASTMatchers" would fail.

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

12 years agoReject 'int a[1][];' in Sema rather than crashing in IR generation. Found by a
Richard Smith [Sat, 7 Jul 2012 23:00:31 +0000 (23:00 +0000)]
Reject 'int a[1][];' in Sema rather than crashing in IR generation. Found by a
misreduction of PR13290.

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

12 years agoPR13290: Constant-evaluation support for CXXConstructExprs which construct a
Richard Smith [Sat, 7 Jul 2012 22:48:24 +0000 (22:48 +0000)]
PR13290: Constant-evaluation support for CXXConstructExprs which construct a
multidimensional array of class type. Also, preserve zero-initialization when
evaluating an initializer list for an array, in case the initializers refer to
later elements (which have preceding zero-initialization).

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

12 years agoclang/test/CodeGenCXX/cxx0x-initializer-constructors.cpp: Fixup for -Asserts.
NAKAMURA Takumi [Sat, 7 Jul 2012 10:25:42 +0000 (10:25 +0000)]
clang/test/CodeGenCXX/cxx0x-initializer-constructors.cpp: Fixup for -Asserts.

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

12 years agoWire up -mrdrnd for X86.
Benjamin Kramer [Sat, 7 Jul 2012 09:39:18 +0000 (09:39 +0000)]
Wire up -mrdrnd for X86.

For some reason GCC decided to call the feature rdrnd instead of rdrand,
which requires translating it for LLVM.

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

12 years agoPR12670: Support for initializing an array of non-aggregate class type from an
Richard Smith [Sat, 7 Jul 2012 08:35:56 +0000 (08:35 +0000)]
PR12670: Support for initializing an array of non-aggregate class type from an
initializer list. Patch by Olivier Goffart, with extra testcases by Meador Inge
and Daniel Lunow.

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

12 years agoWhen marking virtual functions as used for a class' vtable, mark all functions
Richard Smith [Sat, 7 Jul 2012 06:59:51 +0000 (06:59 +0000)]
When marking virtual functions as used for a class' vtable, mark all functions
which will appear in the vtable as used, not just those ones which were
declared within the class itself. Fixes an issue reported as comment#3 in
PR12763 -- we sometimes assert in codegen if we try to emit a reference to a
function declaration which we've not marked as referenced. This also matches
gcc's observed behavior.

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

12 years agoDistinguish more carefully between free functions and C++ instance methods
John McCall [Sat, 7 Jul 2012 06:41:13 +0000 (06:41 +0000)]
Distinguish more carefully between free functions and C++ instance methods
in the ABI arrangement, and leave a hook behind so that we can easily
tweak CCs on platforms that use different CCs by default for C++
instance methods.

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

12 years agoEnhance 'diagtool list-warnings' to report number of diagnostics covered directly...
Ted Kremenek [Sat, 7 Jul 2012 06:30:31 +0000 (06:30 +0000)]
Enhance 'diagtool list-warnings' to report number of diagnostics covered directly under -Wpedantic, and enhance warning-flags.c test to test that this set does not grow.

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

12 years agoRe-apply r159875 with fixes.
Ted Kremenek [Sat, 7 Jul 2012 05:53:30 +0000 (05:53 +0000)]
Re-apply r159875 with fixes.

- Split pedantic driver flag test into separate test file, and XFAIL on cygwin,mingw32
- Fix bug in tablegen logic where a missing '{' caused errors to be included in -Wpedantic.

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

12 years agoRevert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything...
NAKAMURA Takumi [Sat, 7 Jul 2012 02:48:02 +0000 (02:48 +0000)]
Revert rr159875, "Implement -Wpedantic and --no-pedantic to complement -Weverything." It broke several builds.

I suspect FileCheck might match assertion failure, even if clang/test/Misc/warning-flags.c passed the test.

> 0. Program arguments: bin/./clang -### -pedantic -Wpedantic clang/test/Driver/warning-options.cpp

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

12 years agoRestrict the set of declaration kinds for which we allow trailing comments.
Dmitri Gribenko [Fri, 6 Jul 2012 23:27:33 +0000 (23:27 +0000)]
Restrict the set of declaration kinds for which we allow trailing comments.

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

12 years agoImplement -Wpedantic and --no-pedantic to complement -Weverything.
Ted Kremenek [Fri, 6 Jul 2012 23:07:31 +0000 (23:07 +0000)]
Implement -Wpedantic and --no-pedantic to complement -Weverything.

This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

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

12 years ago[analyzer] Fix mis-committed test. No functionality change.
Jordan Rose [Fri, 6 Jul 2012 22:10:39 +0000 (22:10 +0000)]
[analyzer] Fix mis-committed test. No functionality change.

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

12 years agoConstify the argument to SourceLocation::getFromPtrEncoding.
Jordan Rose [Fri, 6 Jul 2012 22:00:04 +0000 (22:00 +0000)]
Constify the argument to SourceLocation::getFromPtrEncoding.

This allows SourceLocations to be stored in generic "data" fields
that are typed as "const void *" and are also used to point to
const objects.

Really we should probably be returning a const pointer from
getPtrEncoding as well, but in some places we want to store
SourceLocations in the same generic "data" field as proper
pointers to /mutable/ objects. Oh well.

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

12 years ago[analyzer] Add comments to Calls.h.
Jordan Rose [Fri, 6 Jul 2012 22:00:01 +0000 (22:00 +0000)]
[analyzer] Add comments to Calls.h.

No functionality change.

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

12 years ago[analyzer] Be careful about LazyCompoundVals, which may be for the first field.
Jordan Rose [Fri, 6 Jul 2012 21:59:56 +0000 (21:59 +0000)]
[analyzer] Be careful about LazyCompoundVals, which may be for the first field.

We use LazyCompoundVals to avoid copying the contents of structs and arrays
around in the store, and when we need to pass a struct around that already
has a LazyCompoundVal we just use the original one. However, it's possible
that the first field of a struct may have a LazyCompoundVal of its own, and
we currently can't distinguish a LazyCompoundVal for the first element of a
struct from a LazyCompoundVal for the entire struct. In this case we should
just drop the optimization and make a new LazyCompoundVal that encompasses
the old one.

PR13264 / <rdar://problem/11802440>

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

12 years agoSprinkle llvm_unreachable around to placate GCC's -Wreturn-type.
Matt Beaumont-Gay [Fri, 6 Jul 2012 21:13:09 +0000 (21:13 +0000)]
Sprinkle llvm_unreachable around to placate GCC's -Wreturn-type.

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

12 years agoobjc-arc: warn when assigning retained object to
Fariborz Jahanian [Fri, 6 Jul 2012 21:09:27 +0000 (21:09 +0000)]
objc-arc: warn when assigning retained object to
a 'weak' property just as we do the same for
'weak' variables. // rdar://11814185

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

12 years agoobjective-c++11: extend c++11 range-based loop to iterate
Fariborz Jahanian [Fri, 6 Jul 2012 19:04:04 +0000 (19:04 +0000)]
objective-c++11: extend c++11 range-based loop to iterate
over objective-c container collection. // rdar://9293227

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

12 years agoDon't store pointers into a std::vector (RawCommentList::Comments). Although
Dmitri Gribenko [Fri, 6 Jul 2012 18:19:34 +0000 (18:19 +0000)]
Don't store pointers into a std::vector (RawCommentList::Comments).  Although
currently we take address of std::vector's contents only after we finished
adding all comments (so no reallocation can happen), this will change in
future.

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

12 years agoStop using new[] on llvm::BumpPtrAllocator.
Dmitri Gribenko [Fri, 6 Jul 2012 16:41:59 +0000 (16:41 +0000)]
Stop using new[] on llvm::BumpPtrAllocator.

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

12 years agoUse C++ cast.
Dmitri Gribenko [Fri, 6 Jul 2012 15:40:08 +0000 (15:40 +0000)]
Use C++ cast.

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

12 years agoRemove unreachable default case to pacify clang's -Wcovered-switch-default.
Benjamin Kramer [Fri, 6 Jul 2012 15:27:25 +0000 (15:27 +0000)]
Remove unreachable default case to pacify clang's -Wcovered-switch-default.

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

12 years agoASTContext.cpp: Appease msvc to cast NULL to typed pointer, or msvc mistakes NULL...
NAKAMURA Takumi [Fri, 6 Jul 2012 11:51:12 +0000 (11:51 +0000)]
ASTContext.cpp: Appease msvc to cast NULL to typed pointer, or msvc mistakes NULL as int.

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

12 years agoclang/test/CodeGen/fp-contract.c: It requires ppc32!
NAKAMURA Takumi [Fri, 6 Jul 2012 11:11:27 +0000 (11:11 +0000)]
clang/test/CodeGen/fp-contract.c: It requires ppc32!

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

12 years ago[cindex.py] Fix erroneous comment for CompileCommands
Arnaud A. de Grandmaison [Fri, 6 Jul 2012 08:22:05 +0000 (08:22 +0000)]
[cindex.py] Fix erroneous comment for CompileCommands

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

12 years agoAnother fix for the configure build: correct order of dependencies.
Manuel Klimek [Fri, 6 Jul 2012 08:13:45 +0000 (08:13 +0000)]
Another fix for the configure build: correct order of dependencies.

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

12 years agoBuild-fix: Remove non-existent directories from Makefiles.
Manuel Klimek [Fri, 6 Jul 2012 06:00:30 +0000 (06:00 +0000)]
Build-fix: Remove non-existent directories from Makefiles.

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

12 years agoAdds the AST Matcher library, which provides a in-C++ DSL to express
Manuel Klimek [Fri, 6 Jul 2012 05:48:52 +0000 (05:48 +0000)]
Adds the AST Matcher library, which provides a in-C++ DSL to express
matches on interesting parts of the AST, and callback mechanisms to
act on them.

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

12 years agoCommentParser.cpp: remove unused variable.
Dmitri Gribenko [Fri, 6 Jul 2012 01:14:58 +0000 (01:14 +0000)]
CommentParser.cpp: remove unused variable.

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

12 years agoForgot to rename one use of FPContractModeTy
Lang Hames [Fri, 6 Jul 2012 01:10:46 +0000 (01:10 +0000)]
Forgot to rename one use of FPContractModeTy

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

12 years agoAdd -ffp-contract = { fast | on | off } command line option support.
Lang Hames [Fri, 6 Jul 2012 00:59:19 +0000 (00:59 +0000)]
Add -ffp-contract = { fast | on | off }   command line option support.

This flag sets the 'fp-contract' mode, which controls the formation of fused
floating point operations. Available modes are:

- Fast: Form fused operations anywhere.
- On: Form fused operations where allowed by FP_CONTRACT. This is the default
      mode.
- Off: Don't form fused operations (in future this may be relaxed to forming
       fused operations where it can be proved that the result won't be
       affected).

Currently clang doesn't support the FP_CONTRACT pragma, so the 'On' and 'Off'
modes are equivalent.

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

12 years agoComment.h: correct identation
Dmitri Gribenko [Fri, 6 Jul 2012 00:45:54 +0000 (00:45 +0000)]
Comment.h: correct identation

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

12 years agoAdded a new memberfor Parser, to be used soon
Fariborz Jahanian [Fri, 6 Jul 2012 00:42:20 +0000 (00:42 +0000)]
Added a new memberfor Parser, to be used soon
for doing delayed parsing of c++ method defined in
objc class implementations.

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