]> granicus.if.org Git - clang/log
clang
12 years agoWarn about self-initialization of references.
Hans Wennborg [Fri, 17 Aug 2012 10:12:33 +0000 (10:12 +0000)]
Warn about self-initialization of references.

Initializing a reference with itself, e.g. "int &a = a;" seems like a
very bad idea.

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

12 years agoMake the spacing of the code completion result for NSDictionary
Douglas Gregor [Fri, 17 Aug 2012 05:40:05 +0000 (05:40 +0000)]
Make the spacing of the code completion result for NSDictionary
literals match the spacing introduced by the ObjC modernizer. Fixes
the rest of <rdar://problem/11889572>.

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

12 years agoWhen we need the complete set of visible declarations from a
Douglas Gregor [Fri, 17 Aug 2012 05:26:33 +0000 (05:26 +0000)]
When we need the complete set of visible declarations from a
declaration context, check whether the primary context---not the
current context---has any external visible declarations. Fixes
PR13616.

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

12 years agoDon't do jump-scope checking when code completion is enabled. It's
Douglas Gregor [Fri, 17 Aug 2012 05:12:08 +0000 (05:12 +0000)]
Don't do jump-scope checking when code completion is enabled. It's
both a waste of time, and prone to crash due to the use of the
error-recovery path in parser. Fixes <rdar://problem/12103608>, which
has been driving me nuts.

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

12 years agoTemporarily revert r162066 and r162062 to see if it brings the gdb
Eric Christopher [Fri, 17 Aug 2012 04:42:07 +0000 (04:42 +0000)]
Temporarily revert r162066 and r162062 to see if it brings the gdb
bots back.

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

12 years agoFix undefined behavior in debug info emission: operator* on WeakVH returns a
Richard Smith [Fri, 17 Aug 2012 04:17:54 +0000 (04:17 +0000)]
Fix undefined behavior in debug info emission: operator* on WeakVH returns a
reference, so &* on an empty WeakVH binds a reference to a dereferenced null
pointer. So don't do that; we have a perfectly good implicit conversion to
Value*.

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

12 years agoFix test so that it doesn't keep failing forever when it's failed once.
Richard Smith [Fri, 17 Aug 2012 04:05:25 +0000 (04:05 +0000)]
Fix test so that it doesn't keep failing forever when it's failed once.

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

12 years agoSwitch PTH format from a 7 byte magic number to an 8 byte one, to avoid
Richard Smith [Fri, 17 Aug 2012 03:55:43 +0000 (03:55 +0000)]
Switch PTH format from a 7 byte magic number to an 8 byte one, to avoid
misaligned reads throughout the file. Bump PTH format version to 10.

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

12 years agoFix -Wl,--no-demangle to actually pass the flag to the linker on Linux instead
Nick Lewycky [Fri, 17 Aug 2012 03:39:16 +0000 (03:39 +0000)]
Fix -Wl,--no-demangle to actually pass the flag to the linker on Linux instead
of silently dropping it on the floor.

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

12 years agoDon't forget to apply #pragma pack to partial and explicit specializations of
Richard Smith [Fri, 17 Aug 2012 03:20:55 +0000 (03:20 +0000)]
Don't forget to apply #pragma pack to partial and explicit specializations of
class templates. This fixes misalignment issues in llvm/Support/Endian.h when
built by Clang.

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

12 years ago[analyzer] Add an internal reference document describing IPA and CallEvent.
Jordan Rose [Fri, 17 Aug 2012 02:11:35 +0000 (02:11 +0000)]
[analyzer] Add an internal reference document describing IPA and CallEvent.

This attempts to be a higher-level description of our inlining heuristics
and decision trees than the source, where the work is spread out between
ExprEngine (mostly in ExprEngineCallAndReturn.cpp) and CallEvent, with a
few other classes participating as well.

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

12 years ago[analyzer] Unbreak the static analyzer buildbot.
Anna Zaks [Fri, 17 Aug 2012 01:09:13 +0000 (01:09 +0000)]
[analyzer] Unbreak the static analyzer buildbot.

We no longer associate the correct HTML file with plist diagnostic.
Fall out from r162028.

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

12 years agoAvoid binding a reference to a dereferenced null pointer, if we try to emit a
Richard Smith [Fri, 17 Aug 2012 00:55:32 +0000 (00:55 +0000)]
Avoid binding a reference to a dereferenced null pointer, if we try to emit a
diagnostic before we have a source manager.

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

12 years agoFix misaligned DeclGroup allocation.
Richard Smith [Fri, 17 Aug 2012 00:34:00 +0000 (00:34 +0000)]
Fix misaligned DeclGroup allocation.

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

12 years agoDon't form a null reference when checking for validity of an anonymous
Richard Smith [Fri, 17 Aug 2012 00:12:27 +0000 (00:12 +0000)]
Don't form a null reference when checking for validity of an anonymous
elaborated type specifier in template instantiation: such a specifier is always
valid because it must be specified within the definition of the type.

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

12 years agoAdd support for "type safety" attributes that allow checking that 'void *'
Dmitri Gribenko [Fri, 17 Aug 2012 00:08:38 +0000 (00:08 +0000)]
Add support for "type safety" attributes that allow checking that 'void *'
function arguments and arguments for variadic functions are of a particular
type which is determined by some other argument to the same function call.

Usecases include:
* MPI library implementations, where these attributes enable checking that
  buffer type matches the passed MPI_Datatype;
* for HDF5 library there is a similar usecase as MPI;
* checking types of variadic functions' arguments for functions like
  fcntl() and ioctl().

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

12 years agoAdd some caching here for the builtin types.
Eric Christopher [Thu, 16 Aug 2012 23:50:46 +0000 (23:50 +0000)]
Add some caching here for the builtin types.

rdar://12117935

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

12 years agoRemove FIXME, the constraints contain more options than the
Eric Christopher [Thu, 16 Aug 2012 23:50:43 +0000 (23:50 +0000)]
Remove FIXME, the constraints contain more options than the
current available documentation.

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

12 years agoAdd a missing 'break' to ensure that we reject inline assembly
Eric Christopher [Thu, 16 Aug 2012 23:50:41 +0000 (23:50 +0000)]
Add a missing 'break' to ensure that we reject inline assembly
constraints we don't recognize.

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

12 years agoRandom string removal.
Eric Christopher [Thu, 16 Aug 2012 23:50:37 +0000 (23:50 +0000)]
Random string removal.

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

12 years agoMake isa part of objc_object at metadata generation time.
Eric Christopher [Thu, 16 Aug 2012 23:50:35 +0000 (23:50 +0000)]
Make isa part of objc_object at metadata generation time.

Noticed on inspection.

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

12 years agoFix misaligned allocation of TemplateParameterList objects.
Richard Smith [Thu, 16 Aug 2012 22:51:34 +0000 (22:51 +0000)]
Fix misaligned allocation of TemplateParameterList objects.

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

12 years ago[ms-inline asm] Comment.
Chad Rosier [Thu, 16 Aug 2012 22:47:10 +0000 (22:47 +0000)]
[ms-inline asm] Comment.

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

12 years ago[ms-inline asm] Extract a helper function, getSpelling(). Also use this on
Chad Rosier [Thu, 16 Aug 2012 22:40:32 +0000 (22:40 +0000)]
[ms-inline asm] Extract a helper function, getSpelling().  Also use this on
tokens we don't know how to handle; this should aid when debugging.

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

12 years agoobjective-C++: issue diagnostic when ivar type is
Fariborz Jahanian [Thu, 16 Aug 2012 22:38:41 +0000 (22:38 +0000)]
objective-C++: issue diagnostic when ivar type is
an abstract c++ class. // rdar://12095239

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

12 years ago[ms-inline asm] If we don't know how to handle a token then assume this is not a
Chad Rosier [Thu, 16 Aug 2012 22:30:02 +0000 (22:30 +0000)]
[ms-inline asm] If we don't know how to handle a token then assume this is not a
simple asm.

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

12 years ago[ms-inline asm] Add a helper function, isMSAsmKeyword().
Chad Rosier [Thu, 16 Aug 2012 22:25:38 +0000 (22:25 +0000)]
[ms-inline asm] Add a helper function, isMSAsmKeyword().

These require special handling, which we don't currently handle.  This is being
put in place to ensure we don't do invalid symbol table lookups or try to parse
invalid assembly.  The test cases just makes sure the latter isn't happening.

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

12 years agoRemoved unused LParenLoc parameter to ActOnCXXForRangeStmt
Sam Panzer [Thu, 16 Aug 2012 21:47:25 +0000 (21:47 +0000)]
Removed unused LParenLoc parameter to ActOnCXXForRangeStmt

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

12 years agoobjective-C: make -Wcast-of-sel-type the default.
Fariborz Jahanian [Thu, 16 Aug 2012 20:16:46 +0000 (20:16 +0000)]
objective-C: make  -Wcast-of-sel-type the default.
// rdar://12107381

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

12 years agoCommentCommandTraits: rename BeginName -> StartName for consistency.
Dmitri Gribenko [Thu, 16 Aug 2012 20:16:11 +0000 (20:16 +0000)]
CommentCommandTraits: rename BeginName -> StartName for consistency.

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

12 years ago[ms-inline asm] Perform symbol table lookup on variables. The idea is to use
Chad Rosier [Thu, 16 Aug 2012 19:52:25 +0000 (19:52 +0000)]
[ms-inline asm] Perform symbol table lookup on variables.  The idea is to use
this information to determine valid MC operands.  This will also be used for
semantic analysis.

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

12 years agoFixup test case for Release builds.
Chad Rosier [Thu, 16 Aug 2012 18:47:29 +0000 (18:47 +0000)]
Fixup test case for Release builds.

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

12 years agoobjective-C: deprecate casts of ObjC's SEL
Fariborz Jahanian [Thu, 16 Aug 2012 18:33:47 +0000 (18:33 +0000)]
objective-C: deprecate casts of ObjC's SEL
expressions except to void, void * and their
qualified versions. // rdar://12107381

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

12 years agoAttaching comments to declarations: parse the comment in context of the
Dmitri Gribenko [Thu, 16 Aug 2012 18:19:43 +0000 (18:19 +0000)]
Attaching comments to declarations: parse the comment in context of the
declaration it was attached to.

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

12 years agoRemove #if 0 that has been around for a long time.
Ted Kremenek [Thu, 16 Aug 2012 17:45:32 +0000 (17:45 +0000)]
Remove #if 0 that has been around for a long time.

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

12 years agoRemove "range_iterator" from PathDiagnosticPiece and just use ArrayRef<SourceRange...
Ted Kremenek [Thu, 16 Aug 2012 17:45:29 +0000 (17:45 +0000)]
Remove "range_iterator" from PathDiagnosticPiece and just use ArrayRef<SourceRange> for ranges.  This
removes conceptual clutter, and can allow us to easy migrate to C++11 style for-range loops if we
ever move to using C++11 in Clang.

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

12 years agoAllow multiple PathDiagnosticConsumers to be used with a BugReporter at the same...
Ted Kremenek [Thu, 16 Aug 2012 17:45:23 +0000 (17:45 +0000)]
Allow multiple PathDiagnosticConsumers to be used with a BugReporter at the same time.

This fixes several issues:

- removes egregious hack where PlistDiagnosticConsumer would forward to HTMLDiagnosticConsumer,
but diagnostics wouldn't be generated consistently in the same way if PlistDiagnosticConsumer
was used by itself.

- emitting diagnostics to the terminal (using clang's diagnostic machinery) is no longer a special
case, just another PathDiagnosticConsumer.  This also magically resolved some duplicate warnings,
as we now use PathDiagnosticConsumer's diagnostic pruning, which has scope for the entire translation
unit, not just the scope of a BugReporter (which is limited to a particular ExprEngine).

As an interesting side-effect, diagnostics emitted to the terminal also have their trailing "." stripped,
just like with diagnostics emitted to plists and HTML.  This required some tests to be updated, but now
the tests have higher fidelity with what users will see.

There are some inefficiencies in this patch.  We currently generate the report graph (from the ExplodedGraph)
once per PathDiagnosticConsumer, which is a bit wasteful, but that could be pulled up higher in the
logic stack.  There is some intended duplication, however, as we now generate different PathDiagnostics (for the same issue)
for different PathDiagnosticConsumers.  This is necessary to produce the diagnostics that a particular
consumer expects.

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

12 years agoMatchers related to DeclStmt for matching the count of declarations, a particular...
Sam Panzer [Thu, 16 Aug 2012 17:20:59 +0000 (17:20 +0000)]
Matchers related to DeclStmt for matching the count of declarations, a particular declaration within the statement, and single-Decl DeclStmts.

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

12 years ago[ms-inline asm] Start tracking which tokens are registers and which are
Chad Rosier [Thu, 16 Aug 2012 17:10:59 +0000 (17:10 +0000)]
[ms-inline asm] Start tracking which tokens are registers and which are
variables, function or label references.  The former is a potential clobber.
The latter is either an input or an output.  Unfortunately, it's difficult to
test this patch at the moment, but the added test case will eventually do so.

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

12 years agoMatchers which correspond to CastExpr, IgnoreImpCasts, IgnoreParenCasts, and IgnorePa...
Sam Panzer [Thu, 16 Aug 2012 16:58:10 +0000 (16:58 +0000)]
Matchers which correspond to CastExpr, IgnoreImpCasts, IgnoreParenCasts, and IgnoreParenImpCasts

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

12 years agoStore SourceManager pointer on PrintingPolicy in the case where we're dumping,
Richard Smith [Thu, 16 Aug 2012 03:56:14 +0000 (03:56 +0000)]
Store SourceManager pointer on PrintingPolicy in the case where we're dumping,
and remove ASTContext reference (which was frequently bound to a dereferenced
null pointer) from the recursive lump of printPretty functions. In so doing,
fix (at least) one case where we intended to use the 'dump' mode, but that
failed because a null ASTContext reference had been passed in.

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

12 years agoDon't constant-fold when pretty-printing alignment attribute. This fixes a
Richard Smith [Thu, 16 Aug 2012 02:43:29 +0000 (02:43 +0000)]
Don't constant-fold when pretty-printing alignment attribute. This fixes a
potential crasher -- Context is sometimes a null reference (!!) here.

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

12 years agoTest commit: deleted whitespace on blank line
Sam Panzer [Thu, 16 Aug 2012 02:38:47 +0000 (02:38 +0000)]
Test commit: deleted whitespace on blank line

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

12 years agoFix misaligned allocation of QualifiedTempateName and DependentTemplateName.
Richard Smith [Thu, 16 Aug 2012 01:19:31 +0000 (01:19 +0000)]
Fix misaligned allocation of QualifiedTempateName and DependentTemplateName.

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

12 years agoRemove names from the CHECK lines.
Tanya Lattner [Thu, 16 Aug 2012 00:22:16 +0000 (00:22 +0000)]
Remove names from the CHECK lines.

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

12 years agoConvert loads and stores of vec3 to vec4 to achieve better code generation. Add test...
Tanya Lattner [Thu, 16 Aug 2012 00:10:13 +0000 (00:10 +0000)]
Convert loads and stores of vec3 to vec4 to achieve better code generation. Add test case.

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

12 years ago[ms-inline asm] Add inputs and outputs to AST. No functional change.
Chad Rosier [Thu, 16 Aug 2012 00:06:53 +0000 (00:06 +0000)]
[ms-inline asm] Add inputs and outputs to AST.  No functional change.

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

12 years ago[analyzer] Look through all casts when trying to track constraints.
Jordan Rose [Thu, 16 Aug 2012 00:03:33 +0000 (00:03 +0000)]
[analyzer] Look through all casts when trying to track constraints.

Previously, we were losing path notes (in both text and plist form)
because the interesting DeclRefExpr was buried in a cast.

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

12 years agoDevirtualize calls on glvalues produced by class member access expressions.
Richard Smith [Wed, 15 Aug 2012 22:59:28 +0000 (22:59 +0000)]
Devirtualize calls on glvalues produced by class member access expressions.
Based on a patch by Yin Ma!

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

12 years agoThread safety analysis: prevent a compiler error in cases where a
DeLesley Hutchins [Wed, 15 Aug 2012 22:41:04 +0000 (22:41 +0000)]
Thread safety analysis:  prevent a compiler error in cases where a
late-parsed attribute is attached to an invalid declaration.

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

12 years ago[analyzer] If we call a C++ method on an object, assume it's non-null.
Jordan Rose [Wed, 15 Aug 2012 21:56:23 +0000 (21:56 +0000)]
[analyzer] If we call a C++ method on an object, assume it's non-null.

This is analogous to our handling of pointer dereferences: if we
dereference a pointer that may or may not be null, we assume it's non-null
from then on.

While some implementations of C++ (including ours) allow you to call a
non-virtual method through a null pointer of object type, it is technically
disallowed by the C++ standard, and should not prune out any real paths in
practice.

  [class.mfct.non-static]p1: A non-static member function may be called
    for an object of its class type, or for an object of a class derived
    from its class type...
  (a null pointer value does not refer to an object)

We can also make the same assumption about function pointers.

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

12 years ago[ms-inline asm] Use a set container to remove redundant clobbers.
Chad Rosier [Wed, 15 Aug 2012 21:55:19 +0000 (21:55 +0000)]
[ms-inline asm] Use a set container to remove redundant clobbers.

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

12 years ago[ms-inline asm] Address a FIXME by computing the number of asm statements when
Chad Rosier [Wed, 15 Aug 2012 21:08:52 +0000 (21:08 +0000)]
[ms-inline asm] Address a FIXME by computing the number of asm statements when
building the AsmString.

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

12 years ago[analyzer] Even if we are not inlining a virtual call, still invalidate!
Jordan Rose [Wed, 15 Aug 2012 21:05:15 +0000 (21:05 +0000)]
[analyzer] Even if we are not inlining a virtual call, still invalidate!

Fixes a mistake introduced in r161916.

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

12 years ago[ms-inline asm] MSVC parses multiple __asm statements on a single line as one
Chad Rosier [Wed, 15 Aug 2012 21:03:27 +0000 (21:03 +0000)]
[ms-inline asm] MSVC parses multiple __asm statements on a single line as one
statement.  For example,

  if (x)
    __asm out dx, ax  __asm out dx, ax

results in a single inline asm statement (i.e., both "out dx, ax" statements are
predicated on if(x)).

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

12 years ago[analyzer] Correctly devirtualize virtual method calls in constructors.
Jordan Rose [Wed, 15 Aug 2012 20:07:17 +0000 (20:07 +0000)]
[analyzer] Correctly devirtualize virtual method calls in constructors.

This is the other half of C++11 [class.cdtor]p4 (the destructor side
was added in r161915). This also fixes an issue with post-call checks
where the 'this' value was already being cleaned out of the state, thus
being omitted from a reconstructed CXXConstructorCall.

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

12 years agoAllow 'static' and type qualifiers in K&R parameter type lists.
Matt Beaumont-Gay [Wed, 15 Aug 2012 19:53:19 +0000 (19:53 +0000)]
Allow 'static' and type qualifiers in K&R parameter type lists.

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

12 years ago[ms-inline asm] Don't emit newlines as these are ignored by the AsmParser
Chad Rosier [Wed, 15 Aug 2012 19:12:42 +0000 (19:12 +0000)]
[ms-inline asm] Don't emit newlines as these are ignored by the AsmParser
anyways.  Also, simplify some conditional logic.

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

12 years agoAdd ASTMatcher for matching extern "C" function declarations.
Daniel Jasper [Wed, 15 Aug 2012 18:52:19 +0000 (18:52 +0000)]
Add ASTMatcher for matching extern "C" function declarations.

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

12 years agoPatch to warn about __private_extern__ on tentative definitions
Fariborz Jahanian [Wed, 15 Aug 2012 18:42:26 +0000 (18:42 +0000)]
Patch to warn about __private_extern__ on tentative definitions
as it does something unexpected (but gcc compatible).
Suggest use of __attribute__((visibility("hidden")))
on declaration instead. // rdar://7703982

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

12 years agoFix for PR#13606: http://llvm.org/bugs/show_bug.cgi?id=13606
John Criswell [Wed, 15 Aug 2012 18:40:30 +0000 (18:40 +0000)]
Fix for PR#13606: http://llvm.org/bugs/show_bug.cgi?id=13606
Changed the alignment of an LValue to be 64 bits so that we can handle
alignment values up to half of a 64-bit address space.

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

12 years ago[ms-inline asm] Add support for clobbers in CodeGen.
Chad Rosier [Wed, 15 Aug 2012 18:12:36 +0000 (18:12 +0000)]
[ms-inline asm]  Add support for clobbers in CodeGen.

This is a reapplication of r161914 now that the scoping issue has been resolved
in r161966.

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

12 years ago[ms-inline asm] Capturing loop-scoped (std::string)Reg with a StringRef is bad.
Chad Rosier [Wed, 15 Aug 2012 18:09:18 +0000 (18:09 +0000)]
[ms-inline asm] Capturing loop-scoped (std::string)Reg with a StringRef is bad.

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

12 years agoFix base type of ASTDeclNodeLister.
Michael Han [Wed, 15 Aug 2012 17:56:58 +0000 (17:56 +0000)]
Fix base type of ASTDeclNodeLister.

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

12 years ago[analyzer] Don't try to devirtualize if the class is incomplete.
Jordan Rose [Wed, 15 Aug 2012 17:33:37 +0000 (17:33 +0000)]
[analyzer] Don't try to devirtualize if the class is incomplete.

A similar issue to the previous commit, introduced by r161915.

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

12 years ago[analyzer] Only adjust the type of 'this' when we devirtualize a method call.
Jordan Rose [Wed, 15 Aug 2012 17:33:34 +0000 (17:33 +0000)]
[analyzer] Only adjust the type of 'this' when we devirtualize a method call.

With reinterpret_cast, we can get completely unrelated types in a region
hierarchy together; this was resulting in CXXBaseObjectRegions being layered
directly on an (untyped) SymbolicRegion, whose symbol was from a completely
different type hierarchy. This was what was causing the internal buildbot to
fail.

Reverts r161911, which merely masked the problem.

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

12 years ago[ms-inline asm] Add the left brace source location and improve the pretty
Chad Rosier [Wed, 15 Aug 2012 16:53:30 +0000 (16:53 +0000)]
[ms-inline asm] Add the left brace source location and improve the pretty
printer.  Patch by Enea Zaffanella <zaffanella@cs.unipr.it>.

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

12 years agoCheck for improper use of 'static' and type qualifiers in array
Hans Wennborg [Wed, 15 Aug 2012 07:42:30 +0000 (07:42 +0000)]
Check for improper use of 'static' and type qualifiers in array
declarators.

They are only allowed for function parameters, and then only on the
outermost array type derivation.

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

12 years agoRevert this to try to bring the i386 bots back.
Eric Christopher [Wed, 15 Aug 2012 06:31:06 +0000 (06:31 +0000)]
Revert this to try to bring the i386 bots back.

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

12 years agoclang/lib/Sema/SemaStmt.cpp: Include MCAsmLexer.h to appease msvc to define llvm...
NAKAMURA Takumi [Wed, 15 Aug 2012 04:19:08 +0000 (04:19 +0000)]
clang/lib/Sema/SemaStmt.cpp: Include MCAsmLexer.h to appease msvc to define llvm::AsmToken.

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

12 years agoUse the right alignment when allocating NestedNameSpecifier objects.
Richard Smith [Wed, 15 Aug 2012 01:41:43 +0000 (01:41 +0000)]
Use the right alignment when allocating NestedNameSpecifier objects.

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

12 years agoFix overallocation and underalignment of ASTTemplateArgumentListInfo objects.
Richard Smith [Wed, 15 Aug 2012 01:22:58 +0000 (01:22 +0000)]
Fix overallocation and underalignment of ASTTemplateArgumentListInfo objects.

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

12 years ago[analyzer] Doxygen comments in ObjCMethodCall.
Jordan Rose [Wed, 15 Aug 2012 00:52:03 +0000 (00:52 +0000)]
[analyzer] Doxygen comments in ObjCMethodCall.

No functionality change.

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

12 years ago[analyzer] Don't inline dynamic-dispatch methods unless -analyzer-ipa=dynamic.
Jordan Rose [Wed, 15 Aug 2012 00:52:00 +0000 (00:52 +0000)]
[analyzer] Don't inline dynamic-dispatch methods unless -analyzer-ipa=dynamic.

Previously we were checking -analyzer-ipa=dynamic-bifurcate only, and
unconditionally inlining everything else that had an available definition,
even under -analyzer-ipa=inlining (but not under -analyzer-ipa=none).

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

12 years ago[analyzer] Correctly devirtualize virtual method calls in destructors.
Jordan Rose [Wed, 15 Aug 2012 00:51:56 +0000 (00:51 +0000)]
[analyzer] Correctly devirtualize virtual method calls in destructors.

C++11 [class.cdtor]p4: When a virtual function is called directly or
  indirectly from a constructor or from a destructor, including during
  the construction or destruction of the class’s non-static data members,
  and the object to which the call applies is the object under
  construction or destruction, the function called is the final overrider
  in the constructor's or destructor's class and not one overriding it in
  a more-derived class.

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

12 years ago[ms-inline asm] Add support for clobbers in CodeGen.
Chad Rosier [Wed, 15 Aug 2012 00:43:09 +0000 (00:43 +0000)]
[ms-inline asm] Add support for clobbers in CodeGen.

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

12 years ago[ms-inline asm] Have MC start parsing the asms.
Chad Rosier [Wed, 15 Aug 2012 00:42:47 +0000 (00:42 +0000)]
[ms-inline asm] Have MC start parsing the asms.

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

12 years ago[ms-inline asm] Mark getClobber() const.
Chad Rosier [Wed, 15 Aug 2012 00:41:20 +0000 (00:41 +0000)]
[ms-inline asm] Mark getClobber() const.

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

12 years ago[analyzer] A base class needs a complete definition to provide offsets.
Jordan Rose [Wed, 15 Aug 2012 00:36:44 +0000 (00:36 +0000)]
[analyzer] A base class needs a complete definition to provide offsets.

No test case yet; trying to reduce one from a failing internal buildbot.

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

12 years agoCheck local static variables for self reference on initialization.
Richard Trieu [Tue, 14 Aug 2012 23:50:52 +0000 (23:50 +0000)]
Check local static variables for self reference on initialization.

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

12 years ago[ms-inline asm] More test cases to make sure buildMSAsmString() doesn't regress.
Chad Rosier [Tue, 14 Aug 2012 23:48:41 +0000 (23:48 +0000)]
[ms-inline asm] More test cases to make sure buildMSAsmString() doesn't regress.

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

12 years ago[ms-inline asm] Remove the last bits of LineEnds.
Chad Rosier [Tue, 14 Aug 2012 23:14:45 +0000 (23:14 +0000)]
[ms-inline asm] Remove the last bits of LineEnds.

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

12 years agoRemove trailing return flag from FunctionTypeLoc, since we now carry that
Richard Smith [Tue, 14 Aug 2012 22:51:13 +0000 (22:51 +0000)]
Remove trailing return flag from FunctionTypeLoc, since we now carry that
information on FunctionProtoType. (This also fixes one of *many* misalignment
problems in the TypeLoc hierarchy...)

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

12 years agoFix undefined behavior: reference bound to dereferenced null pointer.
Richard Smith [Tue, 14 Aug 2012 22:37:22 +0000 (22:37 +0000)]
Fix undefined behavior: reference bound to dereferenced null pointer.

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

12 years ago[ms-inline asm] Simplify more logic by using the Token::hasLeadingSpace() and
Chad Rosier [Tue, 14 Aug 2012 22:11:17 +0000 (22:11 +0000)]
[ms-inline asm] Simplify more logic by using the Token::hasLeadingSpace() and
Token::isAtStartOfLine() APIs.

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

12 years agoSmall change to avoid confusion on what "used by" means for a compiler.
Rafael Espindola [Tue, 14 Aug 2012 21:58:29 +0000 (21:58 +0000)]
Small change to avoid confusion on what "used by" means for a compiler.
Patch by Jonathan Sauer.

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

12 years ago[ms-inline asm] Address a potential buffer overflow.
Chad Rosier [Tue, 14 Aug 2012 21:48:01 +0000 (21:48 +0000)]
[ms-inline asm] Address a potential buffer overflow.

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

12 years ago[ms-inline asm] Simplify the logic in patchMSAsmString. We no longer need to
Chad Rosier [Tue, 14 Aug 2012 20:58:21 +0000 (20:58 +0000)]
[ms-inline asm] Simplify the logic in patchMSAsmString.  We no longer need to
track the LineEnds now that single line asm statments aren't merged.

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

12 years agoirgen: inline code for several of complex builtin
Fariborz Jahanian [Tue, 14 Aug 2012 20:09:28 +0000 (20:09 +0000)]
irgen: inline code for several of complex builtin
calls. // rdar://8315199

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

12 years ago[ms-inline asm] Add a helpful assert.
Chad Rosier [Tue, 14 Aug 2012 19:22:06 +0000 (19:22 +0000)]
[ms-inline asm] Add a helpful assert.

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

12 years ago[analyzer]Assume that the properties cannot be overridden when dot
Anna Zaks [Tue, 14 Aug 2012 19:19:18 +0000 (19:19 +0000)]
[analyzer]Assume that the properties cannot be overridden when dot
syntax is used.

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

12 years ago[analyzer] Address Jordan's comments for r161822, r161683.
Anna Zaks [Tue, 14 Aug 2012 18:35:06 +0000 (18:35 +0000)]
[analyzer] Address Jordan's comments for r161822, r161683.

Add a TODO test case for r161822 - calling self from a class method.

Remove a TODO comment for r161683 - value2 is not a property - we just
have method names that look like they are getters/setters for a
property.

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

12 years agoAvoid using i64 types for vld1q_lane/vst1q_lane intrinsics.
Bob Wilson [Tue, 14 Aug 2012 17:27:04 +0000 (17:27 +0000)]
Avoid using i64 types for vld1q_lane/vst1q_lane intrinsics.

The backend has to legalize i64 types by splitting them into two 32-bit pieces,
which leads to poor quality code.  If we produce code for these intrinsics that
uses one-element vector types, which can live in Neon vector registers without
getting split up, then the generated code is much better.  Radar 11998303.

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

12 years agoAttaching comments to redeclarations: fix wrong assumptions
Dmitri Gribenko [Tue, 14 Aug 2012 17:17:18 +0000 (17:17 +0000)]
Attaching comments to redeclarations: fix wrong assumptions

The reason for the recent fallout for "attaching comments to any redeclaration"
change are two false assumptions:
(1) a RawComment is attached to a single decl (not true for 'typedef struct X *Y'
    where we want the comment to be attached to both X and Y);
(2) the whole redeclaration chain has only a single comment (obviously false, the
    user can put a separate comment for each redeclaration).

To fix (1) I revert the part of the recent change where a 'Decl*' member was
introduced to RawComment.  Now ASTContext has a separate DenseMap for mapping
'Decl*' to 'FullComment*'.

To fix (2) I just removed the test with this assumption.  We might not parse
every comment in redecl chain if we already parsed at least one.

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

12 years agoChanging an enumeration to a const int to fix MSVC compiler warnings.
Aaron Ballman [Tue, 14 Aug 2012 16:46:35 +0000 (16:46 +0000)]
Changing an enumeration to a const int to fix MSVC compiler warnings.

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

12 years ago[analyzer] Remove other #if 0 from Retain Count checker.
Anna Zaks [Tue, 14 Aug 2012 15:39:13 +0000 (15:39 +0000)]
[analyzer] Remove other #if 0 from Retain Count checker.

These date back to 2009, 2011.

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

12 years ago[analyzer] Remove autorelease pools code from the Retain Count checker.
Anna Zaks [Tue, 14 Aug 2012 15:39:09 +0000 (15:39 +0000)]
[analyzer] Remove autorelease pools code from the Retain Count checker.

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

12 years agoDo NOT use inline functions with LLVM_ATTRIBUTE_USED.
Benjamin Kramer [Tue, 14 Aug 2012 14:50:32 +0000 (14:50 +0000)]
Do NOT use inline functions with LLVM_ATTRIBUTE_USED.

The function will be emitted into every single TU including the header!

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

12 years agoRemove and simplify unused checking code.
Benjamin Kramer [Tue, 14 Aug 2012 13:24:39 +0000 (13:24 +0000)]
Remove and simplify unused checking code.

This is already handled by CheckCallingConvAttr.

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

12 years agoFix horribly broken sema of __attribute__((pcs())).
Benjamin Kramer [Tue, 14 Aug 2012 13:13:47 +0000 (13:13 +0000)]
Fix horribly broken sema of __attribute__((pcs())).

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