]> granicus.if.org Git - clang/log
clang
13 years agoReverts the Tooling changes as requested by Chris.
Manuel Klimek [Thu, 2 Jun 2011 16:58:33 +0000 (16:58 +0000)]
Reverts the Tooling changes as requested by Chris.

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

13 years agoImplement -fgnu89-inline. Fixes PR10041.
Rafael Espindola [Thu, 2 Jun 2011 16:13:27 +0000 (16:13 +0000)]
Implement -fgnu89-inline. Fixes PR10041.

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

13 years agoTweak code completions for Objective-C Key-Value Observing. The
Douglas Gregor [Thu, 2 Jun 2011 04:02:27 +0000 (04:02 +0000)]
Tweak code completions for Objective-C Key-Value Observing. The
+keyPathsForValuesAffecting<Key> completion was mislabeled as an
instance method, and +automaticallyNotifiesObserversOf<Key> was
missing entirely. Fixes <rdar://problem/9516762>.

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

13 years agoFix 80-column violation.
Francois Pichet [Thu, 2 Jun 2011 00:47:27 +0000 (00:47 +0000)]
Fix 80-column violation.

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

13 years agoRevert r132426; this test passes more often than not, and we don't have a way to...
Eli Friedman [Thu, 2 Jun 2011 00:42:47 +0000 (00:42 +0000)]
Revert r132426; this test passes more often than not, and we don't have a way to mark tests as intermittently failing at the moment.

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

13 years agoAdd stuff for o32 ABI conformance.
Akira Hatanaka [Thu, 2 Jun 2011 00:09:17 +0000 (00:09 +0000)]
Add stuff for o32 ABI conformance.

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

13 years agoImprove the readability of the "Expressive Diagnostics" page, from Dave Yost!
Douglas Gregor [Wed, 1 Jun 2011 22:45:49 +0000 (22:45 +0000)]
Improve the readability of the "Expressive Diagnostics" page, from Dave Yost!

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

13 years agoFix an incorrect warning about explicit template specializations for
Douglas Gregor [Wed, 1 Jun 2011 22:37:07 +0000 (22:37 +0000)]
Fix an incorrect warning about explicit template specializations for
nested types, from Michael Han!

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

13 years agoXFAIL the test on windows.
Argyrios Kyrtzidis [Wed, 1 Jun 2011 21:52:17 +0000 (21:52 +0000)]
XFAIL the test on windows.

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

13 years agoAdd the necessary -L option for finding libprofile_rt.a. It might be a good
Rafael Espindola [Wed, 1 Jun 2011 21:37:00 +0000 (21:37 +0000)]
Add the necessary -L option for finding libprofile_rt.a. It might be a good
idea at some point to split out the directories where we install our runtime
libraries.

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

13 years agoRename -Wunknown-attributes to -Wattributes to match GCC.
Ted Kremenek [Wed, 1 Jun 2011 20:09:40 +0000 (20:09 +0000)]
Rename -Wunknown-attributes to -Wattributes to match GCC.

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

13 years agoRemove derelict documentation.
Ted Kremenek [Wed, 1 Jun 2011 17:45:02 +0000 (17:45 +0000)]
Remove derelict documentation.

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

13 years agoDon't use stdint.h; including it directly is not allowed from LLVM code because it...
Eli Friedman [Wed, 1 Jun 2011 16:57:54 +0000 (16:57 +0000)]
Don't use stdint.h; including it directly is not allowed from LLVM code because it doesn't exist on MSVC.

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

13 years agoThe expression in a noexcept exception-specification is a
Douglas Gregor [Wed, 1 Jun 2011 15:55:51 +0000 (15:55 +0000)]
The expression in a noexcept exception-specification is a
constant-expression, and, therefore, an unevaluated operand. Make it
so.

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

13 years agoImplement comparisons between nullptr and Objective-C object
Douglas Gregor [Wed, 1 Jun 2011 15:12:24 +0000 (15:12 +0000)]
Implement comparisons between nullptr and Objective-C object
pointers. Fixes PR10052.

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

13 years agoRemove pointless assert, N is unsigned.
Benjamin Kramer [Wed, 1 Jun 2011 08:57:04 +0000 (08:57 +0000)]
Remove pointless assert, N is unsigned.

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

13 years agoChange a name for consistency and hopefully unbreak builds with gcc 4.6.
Benjamin Kramer [Wed, 1 Jun 2011 08:56:20 +0000 (08:56 +0000)]
Change a name for consistency and hopefully unbreak builds with gcc 4.6.

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

13 years agoEven a return statement of an expression with a dependent type in a void
Nick Lewycky [Wed, 1 Jun 2011 07:44:31 +0000 (07:44 +0000)]
Even a return statement of an expression with a dependent type in a void
function might need to clean up its temporaries. Fixes PR10057.

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

13 years ago[PCH] Be conservative and check all the files the PCH references to see if
Argyrios Kyrtzidis [Wed, 1 Jun 2011 05:43:53 +0000 (05:43 +0000)]
[PCH] Be conservative and check all the files the PCH references to see if
a file was modified since the time the PCH was created.

The parser is not fit to deal with stale PCHs, too many invariants do not hold up. rdar://9530587.

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

13 years agoMicrosoft friend acting as a forward declaration; try#2. Now only 2 lines.
Francois Pichet [Wed, 1 Jun 2011 04:14:20 +0000 (04:14 +0000)]
Microsoft friend acting as a forward declaration; try#2. Now only 2 lines.

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

13 years agoFix broken test on windows. To get operator new working, we need size_t, for which...
Manuel Klimek [Wed, 1 Jun 2011 03:59:13 +0000 (03:59 +0000)]
Fix broken test on windows. To get operator new working, we need size_t, for which we need to figure out a way to resolve standard include paths in the test.

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

13 years agoFixes Makefile based build for examples/Tooling.
Manuel Klimek [Wed, 1 Jun 2011 01:21:01 +0000 (01:21 +0000)]
Fixes Makefile based build for examples/Tooling.

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

13 years agoPut Parse before Sema on the link line since parse depends on sema.
Nick Lewycky [Wed, 1 Jun 2011 00:59:36 +0000 (00:59 +0000)]
Put Parse before Sema on the link line since parse depends on sema.

Also reflow these lines to fit in 80-col.

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

13 years agoFix test breakage due to example not being built.
Manuel Klimek [Wed, 1 Jun 2011 00:18:08 +0000 (00:18 +0000)]
Fix test breakage due to example not being built.

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

13 years agoThis patch implements an AST matching framework that allows to write
Manuel Klimek [Tue, 31 May 2011 23:49:32 +0000 (23:49 +0000)]
This patch implements an AST matching framework that allows to write
tools that match on the C++ ASTs. The main interface is in ASTMatchers.h,
an example implementation of a tool that removes redundant .c_str() calls
is in the example RemoveCStrCalls.cpp.

Various contributions:
Zhanyong Wan, Chandler Carruth, Marcin Kowalczyk, Wei Xu, James Dennett.

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

13 years agoFix test, check for stable strings in the output.
Devang Patel [Tue, 31 May 2011 22:37:03 +0000 (22:37 +0000)]
Fix test, check for stable strings in the output.

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

13 years agoRevert 132332 (Microsoft friend as a forward declaration), John McCall pointed out...
Francois Pichet [Tue, 31 May 2011 22:36:05 +0000 (22:36 +0000)]
Revert 132332 (Microsoft friend as a forward declaration), John McCall pointed out a better/simpler way to do it.

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

13 years agoRobustify objc method type description (subroutine type) by walking parameters directly.
Devang Patel [Tue, 31 May 2011 22:21:11 +0000 (22:21 +0000)]
Robustify objc method type description (subroutine type) by walking parameters directly.

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

13 years agoList objective-c ineterfaces as public types in dwarf debug info output.
Devang Patel [Tue, 31 May 2011 21:18:50 +0000 (21:18 +0000)]
List objective-c ineterfaces as public types in dwarf debug info output.

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

13 years agoList c++ class type as public type in dwarf debug info output.
Devang Patel [Tue, 31 May 2011 20:46:46 +0000 (20:46 +0000)]
List c++ class type as public type in dwarf debug info output.

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

13 years agoEnsure we enter an unevaluated context when instantiating a noexcept
Sean Hunt [Tue, 31 May 2011 19:54:49 +0000 (19:54 +0000)]
Ensure we enter an unevaluated context when instantiating a noexcept
expression. Fixes bug raised by hhinnant to cfe-dev

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

13 years agoDriver/Clang: Simplify code to use arch enumerations.
Daniel Dunbar [Tue, 31 May 2011 15:58:55 +0000 (15:58 +0000)]
Driver/Clang: Simplify code to use arch enumerations.

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

13 years agoRecreate the DeclContext before adding the implicit friend forward declaration. This...
Francois Pichet [Tue, 31 May 2011 12:44:46 +0000 (12:44 +0000)]
Recreate the DeclContext before adding the implicit friend forward declaration. This should fix the asserting buildbot.

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

13 years agoFor compatibility with MSVC, a friend declaration also act as a forward declaration...
Francois Pichet [Tue, 31 May 2011 11:44:00 +0000 (11:44 +0000)]
For compatibility with MSVC, a friend declaration also act as a forward declaration if the tag name is not already declared. The tag name is declared in the next outermost non record scope.
Example:

class A {
  friend class B;
  B* b;
};
B* global_b;

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

13 years agoWhenever we instantiate a static data member, make sure to define any new
Nick Lewycky [Tue, 31 May 2011 07:58:42 +0000 (07:58 +0000)]
Whenever we instantiate a static data member, make sure to define any new
vtables! Fixes PR10020

This also allows us to revert the part of r130023 which added a big loop around
the template instantiation.

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

13 years agoNow with the right line endings.
Galina Kistanova [Tue, 31 May 2011 07:19:08 +0000 (07:19 +0000)]
Now with the right line endings.

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

13 years agoFix linking of clang-wpa.
Zhongxing Xu [Tue, 31 May 2011 07:13:36 +0000 (07:13 +0000)]
Fix linking of clang-wpa.

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

13 years agoExpand the coverage of the warning for constants on the RHS of logical operands:
Chandler Carruth [Tue, 31 May 2011 05:41:42 +0000 (05:41 +0000)]
Expand the coverage of the warning for constants on the RHS of logical operands:

  return f() || -1;

where the user meant to write '|'.

This bootstraps without any additional warnings.

Patch by Richard Trieu.

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

13 years agoUtilize PackedVector, introduced with llvm commit r132325.
Argyrios Kyrtzidis [Tue, 31 May 2011 03:56:09 +0000 (03:56 +0000)]
Utilize PackedVector, introduced with llvm commit r132325.

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

13 years agoJust one for now to see how it will fly.
Galina Kistanova [Tue, 31 May 2011 00:34:37 +0000 (00:34 +0000)]
Just one for now to see how it will fly.

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

13 years agoFor X86 specific tests.
Galina Kistanova [Tue, 31 May 2011 00:32:43 +0000 (00:32 +0000)]
For X86 specific tests.

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

13 years agoPreparations for separating target-specific clang tests.
Galina Kistanova [Tue, 31 May 2011 00:29:49 +0000 (00:29 +0000)]
Preparations for separating target-specific clang tests.

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

13 years agoFix another incorrect type bug.
David Chisnall [Mon, 30 May 2011 12:00:26 +0000 (12:00 +0000)]
Fix another incorrect type bug.

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

13 years agoAdd a new warning on NULL pointer constant to integer conversion.
Richard Trieu [Sun, 29 May 2011 19:59:02 +0000 (19:59 +0000)]
Add a new warning on NULL pointer constant to integer conversion.

This path was reviewed by Chandler Carruth at http://codereview.appspot.com/4538074/

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

13 years agoFix a regression in the source locations for unary trait expressions.
Chandler Carruth [Sun, 29 May 2011 07:32:14 +0000 (07:32 +0000)]
Fix a regression in the source locations for unary trait expressions.
I tried to use an assert to prove that I could remove each of the
arguments I did, but ended up writing my assert with inverted logic.
Doh! Reported by Xi Wang on cfe-dev. I have manually verified the source
locations and ranges for these using -ast-dump. I tried writing a test
case that would catch these, but these expressions aren't exposed in the
c-index-test's token annotation utility.

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

13 years agoConvert Clang over to resuming from landing pads with llvm.eh.resume.
John McCall [Sat, 28 May 2011 21:13:02 +0000 (21:13 +0000)]
Convert Clang over to resuming from landing pads with llvm.eh.resume.
It's quite likely that this will explode, but I need to know how. :)

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

13 years agomake this a bit less confusing
Chris Lattner [Sat, 28 May 2011 17:53:17 +0000 (17:53 +0000)]
make this a bit less confusing

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

13 years agoEliminate temporary argument vectors.
Benjamin Kramer [Sat, 28 May 2011 14:26:31 +0000 (14:26 +0000)]
Eliminate temporary argument vectors.

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

13 years agoFix another type mismatch.
David Chisnall [Sat, 28 May 2011 14:23:43 +0000 (14:23 +0000)]
Fix another type mismatch.

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

13 years agoFix missing cast.
David Chisnall [Sat, 28 May 2011 14:09:01 +0000 (14:09 +0000)]
Fix missing cast.

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

13 years agoAdd support for ARM ldrexd/strexd builtins
Bruno Cardoso Lopes [Sat, 28 May 2011 04:11:33 +0000 (04:11 +0000)]
Add support for ARM ldrexd/strexd builtins

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

13 years agoAdd a couple of helper methods in the SourceManager API, isAtStartOfMacroInstantiatio...
Argyrios Kyrtzidis [Sat, 28 May 2011 03:56:11 +0000 (03:56 +0000)]
Add a couple of helper methods in the SourceManager API, isAtStartOfMacroInstantiation/isAtEndOfMacroInstantiation
useful only for source locations that point at a macro token.

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

13 years agoClean up a C++0x/C++03 conditional check.
Douglas Gregor [Fri, 27 May 2011 23:15:17 +0000 (23:15 +0000)]
Clean up a C++0x/C++03 conditional check.

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

13 years agoAdd unnamed_addr to internal globals which are only used as an operand to memcpy...
Eli Friedman [Fri, 27 May 2011 22:32:55 +0000 (22:32 +0000)]
Add unnamed_addr to internal globals which are only used as an operand to memcpy. (Spotted by looking at IR.)

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

13 years agoMatch llvm-gcc's string literals alignment by forcing alignment on string literals...
Eli Friedman [Fri, 27 May 2011 22:13:20 +0000 (22:13 +0000)]
Match llvm-gcc's string literals alignment by forcing alignment on string literals to 1.  This can significantly impact the size of the string data, and as far as I know, the alignment doesn't help performance.  rdar://9078969 .

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

13 years agoBack out r132209; it's breaking nightly tests.
Eli Friedman [Fri, 27 May 2011 21:32:17 +0000 (21:32 +0000)]
Back out r132209; it's breaking nightly tests.

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

13 years agoClean up my changes to jump-diagnostic handling for local variables of
Douglas Gregor [Fri, 27 May 2011 21:28:00 +0000 (21:28 +0000)]
Clean up my changes to jump-diagnostic handling for local variables of
class type (or array thereof), eliminating some redundant checks
(thanks Eli!) and adding some tests where the behavior differs in
C++98/03 vs. C++0x.

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

13 years agoImplement a new, much improved version of the cleanup hack. We just need
John McCall [Fri, 27 May 2011 20:01:14 +0000 (20:01 +0000)]
Implement a new, much improved version of the cleanup hack.  We just need
to be careful to emit landing pads that are always prepared to handle a
cleanup path.  This is correct mostly because of the fix to the LLVM
inliner, r132200.

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

13 years agoAdd assertions to verify that we are not trying to instantiate a
Sean Hunt [Fri, 27 May 2011 20:00:14 +0000 (20:00 +0000)]
Add assertions to verify that we are not trying to instantiate a
nontemplate in Sema::InstantiateTemplateDecl.

This should make the issue in PR10026 more visible, although it's not
going to fix it because something is violating this precondition.

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

13 years agoUpdate the jump-scope checker for local variables with initializers,
Douglas Gregor [Fri, 27 May 2011 16:05:29 +0000 (16:05 +0000)]
Update the jump-scope checker for local variables with initializers,
so that it looks at the initializer of a local variable of class type
(or array thereof) to determine whether it's just an implicit
invocation of the trivial default constructor. Fixes PR10034.

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

13 years agoAdd an additional check for null pointer before accessing PatternDecl.
Richard Trieu [Fri, 27 May 2011 02:08:53 +0000 (02:08 +0000)]
Add an additional check for null pointer before accessing PatternDecl.

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

13 years agoEnhance Clang to start instantiating static data member definitions
Chandler Carruth [Fri, 27 May 2011 01:33:31 +0000 (01:33 +0000)]
Enhance Clang to start instantiating static data member definitions
within class templates when they are necessary to complete the type of
the member. The canonical example is code like:

  template <typename T> struct S {
    static const int arr[];
    static const int x;
    static int f();
  };

  template <typename T> const int S<T>::arr[] = { 1, 2, 3 };
  template <typename T> const int S<T>::x = sizeof(arr) / sizeof(arr[0]);
  template <typename T> int S<T>::f() { return x; }

  int x = S<int>::f();

We need to instantiate S<T>::arr's definition to pick up its initializer
and complete the array type. This involves new code to specially handle
completing the type of an expression where the type alone is
insufficient. It also requires *updating* the expression with the newly
completed type. Fortunately, all the other infrastructure is already in
Clang to do the instantiation, do the completion, and prune out the
unused bits of code that result from this instantiation.

This addresses the initial bug in PR10001, and will be a step to
fleshing out other cases where we need to work harder to complete an
expression's type. Who knew we still had missing C++03 "features"?

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

13 years agoObjective-C doesn't consider the use of incomplete types as method
Douglas Gregor [Fri, 27 May 2011 01:19:52 +0000 (01:19 +0000)]
Objective-C doesn't consider the use of incomplete types as method
parameter types to be ill-formed. However, it relies on the
completeness of method parameter types when producing metadata, e.g.,
for a protocol, leading IR generating to crash in such cases.

Since there's no real way to tighten down the semantics of Objective-C
here without breaking existing code, do something safe but lame:
suppress the generation of metadata when this happens.

Fixes <rdar://problem/9123036>.

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

13 years agoSilence sign compare warning.
Benjamin Kramer [Thu, 26 May 2011 21:32:30 +0000 (21:32 +0000)]
Silence sign compare warning.

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

13 years agoChange the include stack of "instantiated from" notes to fall under the control of...
Richard Trieu [Thu, 26 May 2011 20:49:16 +0000 (20:49 +0000)]
Change the include stack of "instantiated from" notes to fall under the control of f/fno-diagnostics-show-note-include-stack flags.  This should help with reducing diagnostic spew from macros instantiations.

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

13 years agoAdd a fix-it and better error recovery for improperly nested namespaces. This will...
Richard Trieu [Thu, 26 May 2011 20:11:09 +0000 (20:11 +0000)]
Add a fix-it and better error recovery for improperly nested namespaces.  This will give a better error message for cases such as "namespace foo::bar::baz {}" and a suggested fix-it of "namespace foo { namespace bar { namespace baz {} } }"

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

13 years agoTighen analyzer diagnostics w.r.t ObjC/CF leaks.
Ted Kremenek [Thu, 26 May 2011 18:45:44 +0000 (18:45 +0000)]
Tighen analyzer diagnostics w.r.t ObjC/CF leaks.

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

13 years agoExtract two more methods from the unary type trait checking. These
Chandler Carruth [Thu, 26 May 2011 08:53:16 +0000 (08:53 +0000)]
Extract two more methods from the unary type trait checking. These
provide re-usable forms of the rest of the custom validation done here.
Still no functionality changed here.

With this it should be possible to have an expression-centric code path
and a type-centric code path which don't duplicate logic.

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

13 years agoRemove a no longer relevant comment. It was just repeating the
Chandler Carruth [Thu, 26 May 2011 08:53:14 +0000 (08:53 +0000)]
Remove a no longer relevant comment. It was just repeating the
information in the previous comment which was preserved and moved with
the vec_step implementation code.

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

13 years agoExtract the vec_step trait operand checking to a stand alone function.
Chandler Carruth [Thu, 26 May 2011 08:53:12 +0000 (08:53 +0000)]
Extract the vec_step trait operand checking to a stand alone function.
It has little overlap with other traits' requirements, so the resulting
code is actually simpler.

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

13 years agoAdd a convenience interface for checking expression arguments to unary
Chandler Carruth [Thu, 26 May 2011 08:53:10 +0000 (08:53 +0000)]
Add a convenience interface for checking expression arguments to unary
traits which uses the information embedded in the expression. Use this
to simplify several interfaces which repeated information embedded in
the expression through explicit arguments. I added an assertion that the
only extra piece of data to come in from the parser matches what is
stored in the expression. No functionality change intended here.

Also cleaned up the doxygen comments for some of these methods and some
formatting oddities.

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

13 years agoImplement a new warning for when adding a default argument to a method
Sean Hunt [Thu, 26 May 2011 01:26:05 +0000 (01:26 +0000)]
Implement a new warning for when adding a default argument to a method
makes it into a special member function. This is very bad and can lead
to all sorts of nastiness including implicit member functions violating
the One Definition Rule. This should probably be made ill-formed in a
later version of the standard, but for now we'll just warn.

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

13 years agoSkip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 ...
Eli Friedman [Thu, 26 May 2011 00:10:27 +0000 (00:10 +0000)]
Skip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 .  This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0.

Originally r130717, but was backed out due to an ObjC regression.

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

13 years agostatic analyzer: when conservatively evaluating functions, don't invalidate the value...
Ted Kremenek [Wed, 25 May 2011 23:57:29 +0000 (23:57 +0000)]
static analyzer: when conservatively evaluating functions, don't invalidate the values of globals when the called function is strlen.

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

13 years agoUpdate our diagnostics to properly account for move operations.
Sean Hunt [Wed, 25 May 2011 23:16:36 +0000 (23:16 +0000)]
Update our diagnostics to properly account for move operations.

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

13 years agoFix a minor thinko that leads to a crash if PatternDecl is null but
Sean Hunt [Wed, 25 May 2011 22:02:25 +0000 (22:02 +0000)]
Fix a minor thinko that leads to a crash if PatternDecl is null but
Pattern is not. Thanks Nick for catching this!

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

13 years agoImplement a little bit of cleanup and a lot more of the base work
Sean Hunt [Wed, 25 May 2011 20:50:04 +0000 (20:50 +0000)]
Implement a little bit of cleanup and a lot more of the base work
behind implicit moves. We now correctly identify move constructors and
assignment operators and update bits on the record correctly. Generation
of implicit moves (declarations or definitions) is not yet supported.

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

13 years agoRemove bitcast to incorrect type.
David Chisnall [Wed, 25 May 2011 20:33:17 +0000 (20:33 +0000)]
Remove bitcast to incorrect type.

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

13 years agoProperly align UnaryTransformType when allocating it
Douglas Gregor [Wed, 25 May 2011 17:51:54 +0000 (17:51 +0000)]
Properly align UnaryTransformType when allocating it

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

13 years agoUpdate checker build to checker-257.
Ted Kremenek [Wed, 25 May 2011 16:30:14 +0000 (16:30 +0000)]
Update checker build to checker-257.

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

13 years agoDisable MSVC warning about runtime stack overflow for DebugOverflowStack.
Francois Pichet [Wed, 25 May 2011 16:15:03 +0000 (16:15 +0000)]
Disable MSVC warning about runtime stack overflow for DebugOverflowStack.

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

13 years agoFix MSVC warning: <unsafe use of type 'bool' in operation>
Francois Pichet [Wed, 25 May 2011 16:07:10 +0000 (16:07 +0000)]
Fix MSVC warning: <unsafe use of type 'bool' in operation>

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

13 years agoAdd support for Microsoft __if_exists, __if_not_exists extension at class scope.
Francois Pichet [Wed, 25 May 2011 10:19:49 +0000 (10:19 +0000)]
Add support for Microsoft __if_exists, __if_not_exists extension at class scope.

Example:

typedef int TYPE;
class C {
  __if_exists(TYPE) {
     TYPE a;
  }
  __if_not_exists(TYPE) {
     this will never be parsed.
  }
};

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

13 years agoTeach analyzer about cf_returns_not_retained for C functions.
Ted Kremenek [Wed, 25 May 2011 06:29:39 +0000 (06:29 +0000)]
Teach analyzer about cf_returns_not_retained for C functions.

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

13 years agoEnhance retain/release checker to flag warnings when functions returning CG types...
Ted Kremenek [Wed, 25 May 2011 06:19:45 +0000 (06:19 +0000)]
Enhance retain/release checker to flag warnings when functions returning CG types do not follow the Core Foundation naming conventions.

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

13 years agoA StringRef-ication of the DiagnosticIDs API and internals.
Argyrios Kyrtzidis [Wed, 25 May 2011 05:05:01 +0000 (05:05 +0000)]
A StringRef-ication of the DiagnosticIDs API and internals.

Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static
diagnostic data structures, which resulted in a huge global-var-init function.

Depends on llvm commit r132046.

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

13 years agoUpdate for llvm api change.
Rafael Espindola [Wed, 25 May 2011 03:44:55 +0000 (03:44 +0000)]
Update for llvm api change.

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

13 years agoDriver: Don't warn about unused PIE arguments.
Daniel Dunbar [Tue, 24 May 2011 23:05:49 +0000 (23:05 +0000)]
Driver: Don't warn about unused PIE arguments.

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

13 years agoImplement a new type node, UnaryTransformType, designed to represent a
Sean Hunt [Tue, 24 May 2011 22:41:36 +0000 (22:41 +0000)]
Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

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

13 years agoFix Darwin test for r132006.
Nick Lewycky [Tue, 24 May 2011 22:18:08 +0000 (22:18 +0000)]
Fix Darwin test for r132006.

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

13 years agoWhen given one of the applicable coverage flags, try to link against
Nick Lewycky [Tue, 24 May 2011 21:54:59 +0000 (21:54 +0000)]
When given one of the applicable coverage flags, try to link against
libprofile_rt.a. On Darwin, don't try to link -lgcov.

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

13 years agoAdd explicit CFG support for ignoring static_asserts.
Ted Kremenek [Tue, 24 May 2011 20:41:31 +0000 (20:41 +0000)]
Add explicit CFG support for ignoring static_asserts.

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

13 years agoLet amd64 be used in target triple instead of x86_64 on FreeBSD.
Roman Divacky [Tue, 24 May 2011 19:54:09 +0000 (19:54 +0000)]
Let amd64 be used in target triple instead of x86_64 on FreeBSD.

Patch by Dimitry Andric!

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

13 years agoAdd new warning that warns when invoking 'delete' on a polymorphic, non-final, class...
Argyrios Kyrtzidis [Tue, 24 May 2011 19:53:26 +0000 (19:53 +0000)]
Add new warning that warns when invoking 'delete' on a polymorphic, non-final, class without a virtual destructor.

Patch by Matthieu Monrocq!

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

13 years agoImplement the initial part of C++0x [expr.const]p2, which specifies
Douglas Gregor [Tue, 24 May 2011 16:02:01 +0000 (16:02 +0000)]
Implement the initial part of C++0x [expr.const]p2, which specifies
that the unevaluated subexpressions of &&, ||, and ? : are not
considered when determining whether the expression is a constant
expression. Also, turn the "used in its own initializer" warning into
a runtime-behavior warning, so that it doesn't fire when a variable is
used as part of an unevaluated subexpression of its own initializer.

Fixes PR9999.

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

13 years agoFor non-Darwin, a plain 'char' type is unsigned.
Jim Grosbach [Tue, 24 May 2011 15:40:46 +0000 (15:40 +0000)]
For non-Darwin, a plain 'char' type is unsigned.

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

13 years agoFix a bug in the most recent openSUSE support patch.
Chandler Carruth [Tue, 24 May 2011 07:51:17 +0000 (07:51 +0000)]
Fix a bug in the most recent openSUSE support patch.

This patch also by Ismail Donmez.

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

13 years agoFix a bug in -Wundefined-reinterpret-cast where we failed to look
Chandler Carruth [Tue, 24 May 2011 07:43:19 +0000 (07:43 +0000)]
Fix a bug in -Wundefined-reinterpret-cast where we failed to look
through sugared types when testing for TagTypes. This was the actual
cause of the only false positive in Clang+LLVM.

Next evaluation will be over a much larger selection of code including
large amounts of open source code.

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

13 years agoMake it possible for external tools to distinguish between paths that come from ...
Nico Weber [Tue, 24 May 2011 04:31:14 +0000 (04:31 +0000)]
Make it possible for external tools to distinguish between paths that come from -I and paths that come from -system. Patch from Paul Holden!

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

13 years agoMSVC doesn't do any validation regarding exception specification.
Francois Pichet [Tue, 24 May 2011 02:11:43 +0000 (02:11 +0000)]
MSVC doesn't do any validation regarding exception specification.

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