]> granicus.if.org Git - clang/log
clang
12 years ago[clang.py] Implement Token API
Gregory Szorc [Thu, 12 Jul 2012 07:21:12 +0000 (07:21 +0000)]
[clang.py] Implement Token API

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

12 years ago[clang.py] Add TranslationUnit.get_{file,source_location,source_range}
Gregory Szorc [Thu, 12 Jul 2012 05:05:56 +0000 (05:05 +0000)]
[clang.py] Add TranslationUnit.get_{file,source_location,source_range}

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

12 years ago[clang.py] Refactor how ctypes functions are registered
Gregory Szorc [Thu, 12 Jul 2012 04:56:46 +0000 (04:56 +0000)]
[clang.py] Refactor how ctypes functions are registered

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

12 years agoProcess #pragma visibility early in the parsing of class definitions. Fixes
Rafael Espindola [Thu, 12 Jul 2012 04:47:34 +0000 (04:47 +0000)]
Process #pragma visibility early in the parsing of class definitions. Fixes
pr13338.

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

12 years agoIgnore visibility attributes after definitions. This matches newer (4.7) gcc's
Rafael Espindola [Thu, 12 Jul 2012 04:32:30 +0000 (04:32 +0000)]
Ignore visibility attributes after definitions. This matches newer (4.7) gcc's
behavior and is the first step in fixing pr13338.

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

12 years agoRevert r160052, "Default to -std=c++11 on Windows.", for now.
NAKAMURA Takumi [Thu, 12 Jul 2012 03:14:56 +0000 (03:14 +0000)]
Revert r160052, "Default to -std=c++11 on Windows.", for now.

Failing Tests (3):
    Clang :: Index/complete-cxx-inline-methods.cpp
    Clang :: Index/recursive-cxx-member-calls.cpp
    Clang :: SemaTemplate/inject-templated-friend-post.cpp

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

12 years agoAdd the ObjFW runtime. Patch by Jonathan Schleifer!
John McCall [Thu, 12 Jul 2012 02:07:58 +0000 (02:07 +0000)]
Add the ObjFW runtime.  Patch by Jonathan Schleifer!

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

12 years agoAST/CommentSema.cpp: Fix signess in abs() to appease msvc. It would not make sense...
NAKAMURA Takumi [Thu, 12 Jul 2012 00:45:08 +0000 (00:45 +0000)]
AST/CommentSema.cpp: Fix signess in abs() to appease msvc. It would not make sense to pass (unsigned)-(unsigned) to abs().

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

12 years agoclang/lib/Basic/CMakeLists.txt: Add missing dependency, ClangDiagnosticComment.
NAKAMURA Takumi [Thu, 12 Jul 2012 00:27:55 +0000 (00:27 +0000)]
clang/lib/Basic/CMakeLists.txt: Add missing dependency, ClangDiagnosticComment.

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

12 years ago[analyzer] Don't inline virtual calls unless we can devirtualize properly.
Jordan Rose [Thu, 12 Jul 2012 00:16:25 +0000 (00:16 +0000)]
[analyzer] Don't inline virtual calls unless we can devirtualize properly.

Previously we were using the static type of the base object to inline
methods, whether virtual or non-virtual. Now, we try to see if the base
object has a known type, and if so ask for its implementation of the method.

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

12 years agoAdd OpenCL metadata for kernel arg names. This output is controlled via a flag as...
Tanya Lattner [Wed, 11 Jul 2012 23:02:10 +0000 (23:02 +0000)]
Add OpenCL metadata for kernel arg names. This output is controlled via a flag as noted in the OpenCL Spec.
Includes a test case.

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

12 years agoDon't try to do RVO on block variables that refer to an enclosing local.
Nico Weber [Wed, 11 Jul 2012 22:50:15 +0000 (22:50 +0000)]
Don't try to do RVO on block variables that refer to an enclosing local.

Fixes PR13314, clang crashing on blocks refering to an enclosing local
when the enclosing function returns void.

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

12 years agoStop instantiating a class if we hit a static_assert failure. Also, if the
Richard Smith [Wed, 11 Jul 2012 22:37:56 +0000 (22:37 +0000)]
Stop instantiating a class if we hit a static_assert failure. Also, if the
static_assert fails when parsing the template, don't diagnose it again on every
instantiation.

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

12 years agoFix warning.
Richard Smith [Wed, 11 Jul 2012 22:33:59 +0000 (22:33 +0000)]
Fix warning.

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

12 years agoEnable comment parsing and semantic analysis to emit diagnostics. A few
Dmitri Gribenko [Wed, 11 Jul 2012 21:38:39 +0000 (21:38 +0000)]
Enable comment parsing and semantic analysis to emit diagnostics.  A few
diagnostics implemented -- see testcases.

I created a new TableGen file for comment diagnostics,
DiagnosticCommentKinds.td, because comment diagnostics don't logically
fit into AST diagnostics file.  But I don't feel strongly about it.

This also implements support for self-closing HTML tags in comment
lexer and parser (for example, <br />).

In order to issue precise diagnostics CommentSema needs to know the
declaration the comment is attached to.  There is no easy way to find a decl by
comment, so we match comments and decls in lockstep: after parsing one
declgroup we check if we have any new, not yet attached comments.  If we do --
then we do the usual comment-finding process.

It is interesting that this automatically handles trailing comments.
We pick up not only comments that precede the declaration, but also
comments that *follow* the declaration -- thanks to the lookahead in
the lexer: after parsing the declgroup we've consumed the semicolon
and looked ahead through comments.

Added -Wdocumentation-html flag for semantic HTML errors to allow the user to
disable only HTML warnings (but not HTML parse errors, which we emit as
warnings in -Wdocumentation).

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

12 years agoIntroduce a flag in SourceManager to treat non-system source files
Argyrios Kyrtzidis [Wed, 11 Jul 2012 20:59:04 +0000 (20:59 +0000)]
Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may
change while we are trying to use them.

This flag is only enabled by libclang.
Currently "volatile" source files will be stat'ed immediately
before opening them, because the file size stat info
may not be accurate since when we got it (e.g. from the PCH).
This avoids crashes when trying to reference mmap'ed memory
from a file whose size is not what we expect.

Note that there's still a window for a racing issue to occur
but the window for it should be way smaller than before.
We can consider later on to avoid mmap completely on such files.

rdar://11612916

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

12 years agoStart testing some commented-out cases of badly-formed __has_include.
Jordan Rose [Wed, 11 Jul 2012 20:12:19 +0000 (20:12 +0000)]
Start testing some commented-out cases of badly-formed __has_include.

Filed PR13334 for the cases that cause the compiler to crash, and
PR13335 for the cases where we should be recovering more gracefully.

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

12 years agoAllow -verify directives to be filtered by preprocessing.
Jordan Rose [Wed, 11 Jul 2012 19:58:23 +0000 (19:58 +0000)]
Allow -verify directives to be filtered by preprocessing.

This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler,
which then only reads the -verify directives that are actually in live
blocks of code. It also makes it simpler to handle -verify directives that
appear in header files, though we still have to manually reparse some files
depending on how they are generated.

This requires some test changes. In particular, all PCH tests now have their
-verify directives outside the "header" portion of the file, using the @line
syntax added in r159978. Other tests have been modified mostly to make it
clear what is being tested, and to prevent polluting the expected output with
the directives themselves.

Patch by Andy Gibbs! (with slight modifications)

The new Frontend/verify-* tests exercise the functionality of this commit,
as well as r159978, r159979, and r160053 (Andy's other -verify enhancements).

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

12 years agoMove CompileAssert into namespace clang::ast_matchers:: to avoid naming
Daniel Jasper [Wed, 11 Jul 2012 19:22:37 +0000 (19:22 +0000)]
Move CompileAssert into namespace clang::ast_matchers:: to avoid naming
collisions until it is properly integrated in llvm/Support.

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

12 years agoAdd a hook to supply a custom CompilationDatabase. To add a custom CompilationDatabas...
Daniel Jasper [Wed, 11 Jul 2012 19:13:13 +0000 (19:13 +0000)]
Add a hook to supply a custom CompilationDatabase. To add a custom CompilationDatabase, make it implement findCompilationDatabaseForDirectory in CustomCompilationDatabase.h and set USE_COSTUM_COMPILATION_DATABASE.

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

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

12 years ago[driver] Fix so that clang can find correct path prefix for libc object files
Chad Rosier [Wed, 11 Jul 2012 19:08:21 +0000 (19:08 +0000)]
[driver] Fix so that clang can find correct path prefix for libc object files
from GNU binutils supporting multi-arch folder for ARM target.
Patch by Jiangning Liu <jiangning.liu@arm.com>.

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

12 years agoHandle #pragma visibility in explicit specializations and enums.
Rafael Espindola [Wed, 11 Jul 2012 18:14:09 +0000 (18:14 +0000)]
Handle #pragma visibility in explicit specializations and enums.

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

12 years agoMention -fms-compatibility and -fdelayed-template-parsing in UsersManual.
Nico Weber [Wed, 11 Jul 2012 16:56:28 +0000 (16:56 +0000)]
Mention -fms-compatibility and -fdelayed-template-parsing in UsersManual.

Also mention that -std=c++11 is now on by default on windows.

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

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