]> granicus.if.org Git - clang/log
clang
12 years ago[analyzer] Rename addTrackNullOrUndefValueVisitor to trackNullOrUndefValue.
Jordan Rose [Tue, 28 Aug 2012 00:50:51 +0000 (00:50 +0000)]
[analyzer] Rename addTrackNullOrUndefValueVisitor to trackNullOrUndefValue.

This helper function (in the clang::ento::bugreporter namespace) may add more
than one visitor, but conceptually it's tracking a single use of a null or
undefined value and should do so as best it can.

Also, the BugReport parameter has been made a reference to underscore that
it is non-optional.

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

12 years ago[analyzer] Refactor FindLastStoreBRVisitor to not find the store ahead of time.
Jordan Rose [Tue, 28 Aug 2012 00:50:45 +0000 (00:50 +0000)]
[analyzer] Refactor FindLastStoreBRVisitor to not find the store ahead of time.

As Anna pointed out to me offline, it's a little silly to walk backwards through
the graph to find the store site when BugReporter will do the exact same walk
as part of path diagnostic generation.

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

12 years ago[analyzer] If the last store into a region came from a function, step into it.
Jordan Rose [Tue, 28 Aug 2012 00:50:42 +0000 (00:50 +0000)]
[analyzer] If the last store into a region came from a function, step into it.

Previously, if we were tracking stores to a variable 'x', and came across this:

x = foo();

...we would simply emit a note here and stop. Now, we'll step into 'foo' and
continue tracking the returned value from there.

<rdar://problem/12114689>

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

12 years ago[analyzer] Rename CallEvent::mayBeInlined to CallEvent::isCallStmt.
Jordan Rose [Tue, 28 Aug 2012 00:50:38 +0000 (00:50 +0000)]
[analyzer] Rename CallEvent::mayBeInlined to CallEvent::isCallStmt.

The two callers are using this in order to be conservative, so let's just
clarify the information that's actually being provided here. This is not
related to inlining decisions in any way.

No functionality change.

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

12 years ago[ms-inline asm] Hoist more common code into the AsmStmt base class. Add stubs
Chad Rosier [Tue, 28 Aug 2012 00:24:05 +0000 (00:24 +0000)]
[ms-inline asm] Hoist more common code into the AsmStmt base class.  Add stubs
with FIXMEs for unimplemented features.  No functional change intended.

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

12 years ago[libclang] When determining the cursor via a location, ignore synthesized ivars otherwise
Argyrios Kyrtzidis [Tue, 28 Aug 2012 00:04:23 +0000 (00:04 +0000)]
[libclang] When determining the cursor via a location, ignore synthesized ivars otherwise
if we have something like:

   @synthesize prop = _prop;

and '_prop' is not declared, we will encounter a '_prop' ivar before
encountering the 'prop' synthesize declaration and we will think that
we passed the region-of-interest, missing the cursor for 'prop'.

rdar://12172700

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

12 years ago[ms-inline asm] Add virtual function, getClobber, that returns a StringRef.
Chad Rosier [Mon, 27 Aug 2012 23:47:56 +0000 (23:47 +0000)]
[ms-inline asm] Add virtual function, getClobber, that returns a StringRef.
More work towards unifying asm stmt codegen.

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

12 years ago[ms-inline asm] Hoist getNumClobbers into base class.
Chad Rosier [Mon, 27 Aug 2012 23:40:17 +0000 (23:40 +0000)]
[ms-inline asm] Hoist getNumClobbers into base class.

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

12 years ago[ms-inline asm] Rename getClobber to getClobberStringLiteral. No functional
Chad Rosier [Mon, 27 Aug 2012 23:28:41 +0000 (23:28 +0000)]
[ms-inline asm] Rename getClobber to getClobberStringLiteral.  No functional
change intended.

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

12 years agoCodeGen: Hoist check from recursive function to its only callsite.
Benjamin Kramer [Mon, 27 Aug 2012 22:07:02 +0000 (22:07 +0000)]
CodeGen: Hoist check from recursive function to its only callsite.

Suggested by Roman Divacky.

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

12 years agoCodeGen: When emitting stores for an initializer, only emit a GEP if we really need...
Benjamin Kramer [Mon, 27 Aug 2012 21:35:58 +0000 (21:35 +0000)]
CodeGen: When emitting stores for an initializer, only emit a GEP if we really need the store.

This avoids emitting many dead GEPs for large zero-initialized arrays.

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

12 years agoAppease -Wnon-virtual-dtor
Matt Beaumont-Gay [Mon, 27 Aug 2012 21:15:55 +0000 (21:15 +0000)]
Appease -Wnon-virtual-dtor

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

12 years ago[ms-inline asm] Add a few comments.
Chad Rosier [Mon, 27 Aug 2012 21:14:01 +0000 (21:14 +0000)]
[ms-inline asm] Add a few comments.

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

12 years ago[ms-inline asm] Hoist common Expr handling logic into AsmStmt.
Chad Rosier [Mon, 27 Aug 2012 21:04:42 +0000 (21:04 +0000)]
[ms-inline asm] Hoist common Expr handling logic into AsmStmt.

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

12 years agoMIPS: Use -G option to specify MIPS section threshold. Translate it
Simon Atanasyan [Mon, 27 Aug 2012 20:55:56 +0000 (20:55 +0000)]
MIPS: Use -G option to specify MIPS section threshold. Translate it
to the -mllvm -mips-ssection-threshold=<value> pair and pass to the frontend.
The patch suggested by Carl Norum.

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

12 years ago[ms-inline asm] Rename GenerateAsmString to generateAsmString to conform with
Chad Rosier [Mon, 27 Aug 2012 20:23:31 +0000 (20:23 +0000)]
[ms-inline asm] Rename GenerateAsmString to generateAsmString to conform with
coding standards.  Also, add stub for MSAsmStmt class as part of unifying
codegen logic for AsmStmts.

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

12 years ago[analyzer] Look through casts when trying to track a null pointer dereference.
Jordan Rose [Mon, 27 Aug 2012 20:18:30 +0000 (20:18 +0000)]
[analyzer] Look through casts when trying to track a null pointer dereference.

Also, add comments to addTrackNullOrUndefValueVisitor.

Thanks for the review, Anna!

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

12 years agoRestore a -cc1 invariant that was causing problems on PPC64.
John McCall [Mon, 27 Aug 2012 19:56:37 +0000 (19:56 +0000)]
Restore a -cc1 invariant that was causing problems on PPC64.
This test case is pretty bad, though.

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

12 years ago[ms-inline asm] Base class AsmStmt implements these.
Chad Rosier [Mon, 27 Aug 2012 19:48:56 +0000 (19:48 +0000)]
[ms-inline asm] Base class AsmStmt implements these.

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

12 years ago[ms-inline asm] Hoist common logic into the AsmStmt base class.
Chad Rosier [Mon, 27 Aug 2012 19:38:01 +0000 (19:38 +0000)]
[ms-inline asm] Hoist common logic into the AsmStmt base class.

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

12 years ago[ms-inline asm] Add a new base class, AsmStmt, for the GCCAsmStmt and MSAsmStmt
Chad Rosier [Mon, 27 Aug 2012 18:56:36 +0000 (18:56 +0000)]
[ms-inline asm] Add a new base class, AsmStmt, for the GCCAsmStmt and MSAsmStmt
classes.

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

12 years agoThis is a temporary solution until we have a better way to
Manuel Klimek [Mon, 27 Aug 2012 18:49:12 +0000 (18:49 +0000)]
This is a temporary solution until we have a better way to
parse doxygen comments for macros with libclang.

I'm not entirely happy about this script, but as it saves
a lot of work in keeping the docs up to date with the
actual code I think checking it in makes sense.

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

12 years ago[analyzer] Don't inline constructors for objects allocated with operator new.
Jordan Rose [Mon, 27 Aug 2012 18:39:22 +0000 (18:39 +0000)]
[analyzer] Don't inline constructors for objects allocated with operator new.

Because the CXXNewExpr appears after the CXXConstructExpr in the CFG, we don't
actually have the correct region to construct into at the time we decide
whether or not to inline. The long-term fix (discussed in PR12014) might be to
introduce a new CFG node (CFGAllocator) that appears before the constructor.

Tracking the short-term fix in <rdar://problem/12180598>.

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

12 years ago[analyzer] Update inlining design notes for r162681.
Jordan Rose [Mon, 27 Aug 2012 18:39:16 +0000 (18:39 +0000)]
[analyzer] Update inlining design notes for r162681.

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

12 years ago[analyzer] More internal stats collection.
Anna Zaks [Mon, 27 Aug 2012 18:38:32 +0000 (18:38 +0000)]
[analyzer] More internal stats collection.

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

12 years agoUpdate comment, per Jordan's suggestion.
Chad Rosier [Mon, 27 Aug 2012 18:16:34 +0000 (18:16 +0000)]
Update comment, per Jordan's suggestion.

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

12 years agoUse cast<> instead of static_cast. Patch by Timur Iskhodzhanov!
John McCall [Mon, 27 Aug 2012 18:12:29 +0000 (18:12 +0000)]
Use cast<> instead of static_cast.  Patch by Timur Iskhodzhanov!

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

12 years agoUpdate comment.
Chad Rosier [Mon, 27 Aug 2012 18:00:52 +0000 (18:00 +0000)]
Update comment.

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

12 years ago[analyzer] Inline constructors for any object with a trivial destructor.
Jordan Rose [Mon, 27 Aug 2012 17:50:07 +0000 (17:50 +0000)]
[analyzer] Inline constructors for any object with a trivial destructor.

This allows us to better reason about status objects, like Clang's own
llvm::Optional (when its contents are trivially destructible), which are
often intended to be passed around by value.

We still don't inline constructors for temporaries in the general case.

<rdar://problem/11986434>

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

12 years agoSupport MIPS DSP Rev2 intrinsics.
Simon Atanasyan [Mon, 27 Aug 2012 12:29:20 +0000 (12:29 +0000)]
Support MIPS DSP Rev2 intrinsics.
The patch reviewed by Akira Hatanaka.

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

12 years agoTweak the ARC-requires-10.6 diagnostic according to Jordan's review.
John McCall [Mon, 27 Aug 2012 01:56:21 +0000 (01:56 +0000)]
Tweak the ARC-requires-10.6 diagnostic according to Jordan's review.

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

12 years agoUpdate reference docs to latest changes.
Manuel Klimek [Sun, 26 Aug 2012 23:55:24 +0000 (23:55 +0000)]
Update reference docs to latest changes.

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

12 years agoFix a CodeGen bug where we would skip zero-initialization for
Eli Friedman [Sat, 25 Aug 2012 07:11:29 +0000 (07:11 +0000)]
Fix a CodeGen bug where we would skip zero-initialization for
array new with a non-trivial constructor. Pointed out in PR13380.

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

12 years agoRemove spurious string literal for bool argument.
Richard Smith [Sat, 25 Aug 2012 05:43:00 +0000 (05:43 +0000)]
Remove spurious string literal for bool argument.

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

12 years ago_HAS_CHAR16_T_LANGUAGE_SUPPORT is not predefined MSVC macro.
Francois Pichet [Sat, 25 Aug 2012 05:27:04 +0000 (05:27 +0000)]
_HAS_CHAR16_T_LANGUAGE_SUPPORT is not predefined MSVC macro.

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

12 years agoChange --with-analyzer to --use-analyzer, per sage feedback from Jordan.
Ted Kremenek [Sat, 25 Aug 2012 05:24:46 +0000 (05:24 +0000)]
Change --with-analyzer to --use-analyzer, per sage feedback from Jordan.

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

12 years agoFix the CC-matching logic for instance methods in the MS ABI.
John McCall [Sat, 25 Aug 2012 02:00:03 +0000 (02:00 +0000)]
Fix the CC-matching logic for instance methods in the MS ABI.
Patch by Timur Iskhodzhanov!

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

12 years agoFix the mangling of function pointers in the MS ABI.
John McCall [Sat, 25 Aug 2012 01:12:56 +0000 (01:12 +0000)]
Fix the mangling of function pointers in the MS ABI.
Patch by Timur Iskhodzhanov!

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

12 years ago[analyzer] Use the common evalBind infrastructure for initializers.
Jordan Rose [Sat, 25 Aug 2012 01:06:23 +0000 (01:06 +0000)]
[analyzer] Use the common evalBind infrastructure for initializers.

This allows checkers (like the MallocChecker) to process the effects of the
bind. Previously, using a memory-allocating function (like strdup()) in an
initializer would result in a leak warning.

This does bend the expectations of checkBind a bit; since there is no
assignment expression, the statement being used is the initializer value.
In most cases this shouldn't matter because we'll use a PostInitializer
program point (rather than PostStmt) for any checker-generated nodes, though
we /will/ generate a PostStore node referencing the internal statement.
(In theory this could have funny effects if someone actually does an
assignment within an initializer; in practice, that seems like it would be
very rare.)

<rdar://problem/12171711>

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

12 years agoStub out a release notes section on -fcatch-undefined-behavior.
Richard Smith [Sat, 25 Aug 2012 00:47:19 +0000 (00:47 +0000)]
Stub out a release notes section on -fcatch-undefined-behavior.

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

12 years agoUpdate the user's manual for some of the new -fcatch-undefined-behavior features.
Richard Smith [Sat, 25 Aug 2012 00:44:02 +0000 (00:44 +0000)]
Update the user's manual for some of the new -fcatch-undefined-behavior features.

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

12 years ago-fcatch-undefined-behavior: add the -ftrapv checks to the set of things caught
Richard Smith [Sat, 25 Aug 2012 00:32:28 +0000 (00:32 +0000)]
-fcatch-undefined-behavior: add the -ftrapv checks to the set of things caught
by this mode, and also check for signed left shift overflow. The rules for the
latter are a little subtle:

 * neither C89 nor C++98 specify the behavior of a signed left shift at all
 * in C99 and C11, shifting a 1 bit into the sign bit has undefined behavior
 * in C++11, with core issue 1457, shifting a 1 bit *out* of the sign bit has
   undefined behavior

As of this change, we use the C99 rules for all C language variants, and the
C++11 rules for all C++ language variants. Once we have individual
-fcatch-undefined-behavior= flags, this should be revisited.

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

12 years ago[ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.
Chad Rosier [Sat, 25 Aug 2012 00:11:56 +0000 (00:11 +0000)]
[ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.
No functional change intended.

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

12 years agoASTTests: Suppress TestCXXConstructorDecl11 on msvc for now. It seems incompatible.
NAKAMURA Takumi [Sat, 25 Aug 2012 00:05:56 +0000 (00:05 +0000)]
ASTTests: Suppress TestCXXConstructorDecl11 on msvc for now. It seems incompatible.

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

12 years agoRemove RequireCompleteType call which was made redundant by r162586.
Richard Smith [Fri, 24 Aug 2012 23:51:39 +0000 (23:51 +0000)]
Remove RequireCompleteType call which was made redundant by r162586.

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

12 years ago[ms-inline asm] Update the AST Reader/Writer for MS-style inline asms.
Chad Rosier [Fri, 24 Aug 2012 23:51:02 +0000 (23:51 +0000)]
[ms-inline asm] Update the AST Reader/Writer for MS-style inline asms.

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

12 years agoobjective-C: Do not warn if align attribute on method
Fariborz Jahanian [Fri, 24 Aug 2012 23:50:13 +0000 (23:50 +0000)]
objective-C: Do not warn if align attribute on method
declaration is not provided. It is only necessary on
the method implementation. // rdar://11593375

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

12 years agoFix integer unsigned behavior in clang due to signed left shift overflow.
Richard Smith [Fri, 24 Aug 2012 23:43:39 +0000 (23:43 +0000)]
Fix integer unsigned behavior in clang due to signed left shift overflow.

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

12 years agoFix a few issues related to -with-analyzer reported by Jordan. Let's
Ted Kremenek [Fri, 24 Aug 2012 23:42:58 +0000 (23:42 +0000)]
Fix a few issues related to -with-analyzer reported by Jordan.  Let's
have the option with two '--' to be consistent with other options.

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

12 years agoRework how scan-build picks the version of clang to use for static analysis.
Ted Kremenek [Fri, 24 Aug 2012 23:08:08 +0000 (23:08 +0000)]
Rework how scan-build picks the version of clang to use for static analysis.

Unless the user specifies, the clang used for static analysis is the one
found relative to scan-build.

If the user specifies -with-analyzer, they can pick either to use
the clang bundled with Xcode (via xcrun) or they can specify
a path to clang.

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

12 years agoReformat help text for scan-build, and remove -constraints
Ted Kremenek [Fri, 24 Aug 2012 23:08:06 +0000 (23:08 +0000)]
Reformat help text for scan-build, and remove -constraints
and -store from help text because they are no longer relevant
to users.

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

12 years agoWhen computing the effective context for access control,
John McCall [Fri, 24 Aug 2012 22:54:02 +0000 (22:54 +0000)]
When computing the effective context for access control,
make sure we walk up the DC chain for the current context,
rather than allowing ourselves to get switched over to the
canonical DC chain.  Fixes PR13642.

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

12 years agoNew matcher for MaterializeTemporaryExpr
Sam Panzer [Fri, 24 Aug 2012 22:04:44 +0000 (22:04 +0000)]
New matcher for MaterializeTemporaryExpr

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

12 years ago[ms-inline asm] Change the -fenable-experimental-ms-inline-asm option from a
Chad Rosier [Fri, 24 Aug 2012 21:42:51 +0000 (21:42 +0000)]
[ms-inline asm] Change the -fenable-experimental-ms-inline-asm option from a
CodeGen option to a LangOpt option.  In turn, hoist the guard into the parser
so that we avoid the new (and fairly unstable) Sema/AST/CodeGen logic.  This
should restore the behavior of clang to that prior to r158325.
<rdar://problem/12163681>

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

12 years ago[analyzer] Ted fixed the plist-html issue, so the assert can go away.
Anna Zaks [Fri, 24 Aug 2012 21:07:49 +0000 (21:07 +0000)]
[analyzer] Ted fixed the plist-html issue, so the assert can go away.

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

12 years ago[analyzer] More fixups/rewording based on Jordan's feedback.
Anna Zaks [Fri, 24 Aug 2012 21:07:45 +0000 (21:07 +0000)]
[analyzer] More fixups/rewording based on Jordan's feedback.

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

12 years agoRemove unnecessary calls to c_str.
Benjamin Kramer [Fri, 24 Aug 2012 20:43:21 +0000 (20:43 +0000)]
Remove unnecessary calls to c_str.

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

12 years agoFix analyzer tests.
Ted Kremenek [Fri, 24 Aug 2012 20:39:55 +0000 (20:39 +0000)]
Fix analyzer tests.

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

12 years agoRevert "Go ahead and show experimental checkers in the scan-build "-h" output."
Ted Kremenek [Fri, 24 Aug 2012 20:39:38 +0000 (20:39 +0000)]
Revert "Go ahead and show experimental checkers in the scan-build "-h" output."

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

12 years agoInstantiate class template specializations during ADL.
John McCall [Fri, 24 Aug 2012 20:38:34 +0000 (20:38 +0000)]
Instantiate class template specializations during ADL.

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

12 years agoobjective-C: When checking for valid overriden property
Fariborz Jahanian [Fri, 24 Aug 2012 20:10:53 +0000 (20:10 +0000)]
objective-C: When checking for valid overriden property
in class extension, assume default is rewdwrite and don't
issue any diagnostics, privided other ownership models
are ok.

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

12 years agoRename the "experimental" checker package to "alpha". We will then refine
Ted Kremenek [Fri, 24 Aug 2012 19:46:03 +0000 (19:46 +0000)]
Rename the "experimental" checker package to "alpha".  We will then refine
this group into "alpha" and "beta" to distinguish between checkers in
different levels of premature state.

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

12 years agoRework how PathDiagnosticConsumers pass knowledge of what files they
Ted Kremenek [Fri, 24 Aug 2012 19:35:19 +0000 (19:35 +0000)]
Rework how PathDiagnosticConsumers pass knowledge of what files they
generated for a given diagnostic to another.  Because PathDiagnostics
are specific to a give PathDiagnosticConsumer, store in
a FoldingSet a unique hash for a PathDiagnostic (that will be the same
for the same bug for different PathDiagnosticConsumers) that
stores a list of files generated.  This can then be read by the
other PathDiagnosticConsumers.

This fixes breakage in the PLIST-HTML output.

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

12 years ago[analyzer] Address Jordan's review comments.
Anna Zaks [Fri, 24 Aug 2012 18:43:09 +0000 (18:43 +0000)]
[analyzer] Address Jordan's review comments.

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

12 years agoFix 80-column violation.
Chad Rosier [Fri, 24 Aug 2012 18:31:16 +0000 (18:31 +0000)]
Fix 80-column violation.

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

12 years agoComment diagnostics: for unresolved parameters, do not suggest parameter fixit
Dmitri Gribenko [Fri, 24 Aug 2012 17:45:39 +0000 (17:45 +0000)]
Comment diagnostics: for unresolved parameters, do not suggest parameter fixit
with parameter that is documented.

Fixes PR13670, <rdar://problem/12155840>.

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

12 years ago[ms-inline asm] Refactor code. No functional change intended.
Chad Rosier [Fri, 24 Aug 2012 17:05:45 +0000 (17:05 +0000)]
[ms-inline asm] Refactor code.  No functional change intended.

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

12 years ago[ms-inline asm] Generate the Input/Output expressions using
Chad Rosier [Fri, 24 Aug 2012 16:38:58 +0000 (16:38 +0000)]
[ms-inline asm] Generate the Input/Output expressions using
Sema::ActOnIdExpression().

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

12 years ago[analyzer] If we dereference a NULL that came from a function, show the return.
Jordan Rose [Fri, 24 Aug 2012 16:34:31 +0000 (16:34 +0000)]
[analyzer] If we dereference a NULL that came from a function, show the return.

More generally, any time we try to track where a null value came from, we
should show if it came from a function. This usually isn't necessary if
the value is symbolic, but if the value is just a constant we previously
just ignored its origin entirely. Now, we'll step into the function and
recursively add a visitor to the returned expression.

<rdar://problem/12114609>

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

12 years agoFix 80-column violation.
Chad Rosier [Fri, 24 Aug 2012 15:51:10 +0000 (15:51 +0000)]
Fix 80-column violation.

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

12 years agoPush ArrayRef through the Expr hierarchy.
Benjamin Kramer [Fri, 24 Aug 2012 11:54:20 +0000 (11:54 +0000)]
Push ArrayRef through the Expr hierarchy.

No functionality change.

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

12 years agoFix the definition of JSONAnchorSource. MSVC mangles variable symbols, and "volatile...
NAKAMURA Takumi [Fri, 24 Aug 2012 10:39:28 +0000 (10:39 +0000)]
Fix the definition of JSONAnchorSource. MSVC mangles variable symbols, and "volatile" affects.

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

12 years agoTeach CFG that 'if (x & 0)' and 'if (x * 0)' is an unfeasible branch.
Ted Kremenek [Fri, 24 Aug 2012 07:42:09 +0000 (07:42 +0000)]
Teach CFG that 'if (x & 0)' and 'if (x * 0)' is an unfeasible branch.

Fixes <rdar://problem/11005770>.

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

12 years agoAllow RecursiveASTVisitor to visit CXXCtorInitializer objects for which
James Dennett [Fri, 24 Aug 2012 06:59:51 +0000 (06:59 +0000)]
Allow RecursiveASTVisitor to visit CXXCtorInitializer objects for which
isWritten() returns false, if shouldVisitImplicitCode() returns true.
Previously those CXXCtorInitializers were always skipped.

In order to make this change easier to test, this patch also extends the
test class template ExpectedLocationVisitor to support arbitrary numbers
of expected matches and disallowed matches.

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

12 years agoGo ahead and show experimental checkers in the scan-build "-h" output.
Ted Kremenek [Fri, 24 Aug 2012 06:49:34 +0000 (06:49 +0000)]
Go ahead and show experimental checkers in the scan-build "-h" output.
They are labeled as not being enabled-by-default, and how else
are users going to test them.

Fixes <rdar://problem/11654923>

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

12 years agoUse LLVM's plugin registry to enable registering new compilation
Daniel Jasper [Fri, 24 Aug 2012 05:50:27 +0000 (05:50 +0000)]
Use LLVM's plugin registry to enable registering new compilation
databases. Move JSONCompilationDatabase.h to its own files and
register it as plugin.

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

12 years agoRename the ASTMatchers to better match AST nodes. Now, all
Daniel Jasper [Fri, 24 Aug 2012 05:12:34 +0000 (05:12 +0000)]
Rename the ASTMatchers to better match AST nodes. Now, all
ASTMatchers have the same name as the corresponding AST nodes
but are lower case. The only exceptions are the "CXX" prefixes
which are not copied over to the matcher names as the goal is to
actually remove these prefixes from the AST node names.

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

12 years agoOn OS X, use xcrun (if present) to find the clang to use for static analysis if
Ted Kremenek [Fri, 24 Aug 2012 04:53:06 +0000 (04:53 +0000)]
On OS X, use xcrun (if present) to find the clang to use for static analysis if
no clang can be found relative to the location of scan-build.

Fixes <rdar://problem/11691794>

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

12 years ago[analyzer] Fix realloc related bug in the malloc checker.
Anna Zaks [Fri, 24 Aug 2012 02:28:20 +0000 (02:28 +0000)]
[analyzer] Fix realloc related bug in the malloc checker.

When reallocation of a non-allocated (not owned) symbol fails do not
expect it to be freed.

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

12 years ago[analyzer] Remove unnecessary code.
Anna Zaks [Fri, 24 Aug 2012 01:39:13 +0000 (01:39 +0000)]
[analyzer] Remove unnecessary code.

This code has been added a while ago and removing it does not trigger
any test failures. The false positives it was trying to suppress are
probably handled by other logic (ex: special handling of delegates).

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

12 years ago[analyzer] Move DynamicTypeInfo out of the ProgramState.h
Anna Zaks [Fri, 24 Aug 2012 01:39:10 +0000 (01:39 +0000)]
[analyzer] Move DynamicTypeInfo out of the ProgramState.h

(I am not sure if we should move the setters and getters as well and
make them into static methods..)

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

12 years agoNew -fcatch-undefined-behavior features:
Richard Smith [Fri, 24 Aug 2012 00:54:33 +0000 (00:54 +0000)]
New -fcatch-undefined-behavior features:
 * when checking that a pointer or reference refers to appropriate storage for a type, also check the alignment and perform a null check
 * check that references are bound to appropriate storage
 * check that 'this' has appropriate storage in member accesses and member function calls

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

12 years agoUpdated LibTooling.html, minor improvements in CommonOptionsParser
Alexander Kornienko [Fri, 24 Aug 2012 00:39:14 +0000 (00:39 +0000)]
Updated LibTooling.html, minor improvements in CommonOptionsParser

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

12 years agoDeclPrinter tests: mark test case we get wrong currently with WRONG.
Dmitri Gribenko [Fri, 24 Aug 2012 00:27:50 +0000 (00:27 +0000)]
DeclPrinter tests: mark test case we get wrong currently with WRONG.

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

12 years agoDeclPrinter tests: add two more tests.
Dmitri Gribenko [Fri, 24 Aug 2012 00:26:25 +0000 (00:26 +0000)]
DeclPrinter tests: add two more tests.

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

12 years ago[ms-inline asm] Add the basic APIs for Exprs to the MSAsmStmt AST. Next we need
Chad Rosier [Fri, 24 Aug 2012 00:07:09 +0000 (00:07 +0000)]
[ms-inline asm] Add the basic APIs for Exprs to the MSAsmStmt AST.  Next we need
generate the Input/Output expressions using Sema::ActOnIdExpression().

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

12 years ago[analyzer] Make analyzer less aggressive when dealing with [self init].
Anna Zaks [Fri, 24 Aug 2012 00:06:12 +0000 (00:06 +0000)]
[analyzer] Make analyzer less aggressive when dealing with [self init].

With inlining, retain count checker starts tracking 'self' through the
init methods. The analyser results were too noisy if the developer
did not follow 'self = [super init]' pattern (which is common
especially in older code bases) - we reported self init anti-pattern AND
possible use-after-free. This patch teaches the retain count
checker to assume that [super init] does not fail when it's not consumed
by another expression. This silences the retain count warning that warns
about possibility of use-after-free when init fails, while preserving
all the other checking on 'self'.

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

12 years agoComment semantic analysis: treat function typedefs as functions so that one can
Dmitri Gribenko [Fri, 24 Aug 2012 00:05:30 +0000 (00:05 +0000)]
Comment semantic analysis: treat function typedefs as functions so that one can
use \param and \returns in documentation.

Fixes PR13533.

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

12 years agoFix a few -Wdocumentation warnings.
Dmitri Gribenko [Fri, 24 Aug 2012 00:01:24 +0000 (00:01 +0000)]
Fix a few -Wdocumentation warnings.

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

12 years agoNow that ASTMultiPtr is nothing more than a array reference, make it a MutableArrayRef.
Benjamin Kramer [Thu, 23 Aug 2012 23:38:35 +0000 (23:38 +0000)]
Now that ASTMultiPtr is nothing more than a array reference, make it a MutableArrayRef.

This required changing all get() calls to data() and using the simpler constructors.

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

12 years ago[scan-build] Accept -fno-objc-arc as well as -fobjc-arc.
Jordan Rose [Thu, 23 Aug 2012 23:16:34 +0000 (23:16 +0000)]
[scan-build] Accept -fno-objc-arc as well as -fobjc-arc.

This is how Xcode lets individual files be marked as non-ARC when the rest
of the project is ARC-enabled, so this is necessary for scan-build xcodebuild.

Patch by Paul Eipper!

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

12 years ago[analyzer] For now, treat pointers-to-members as non-null void * symbols.
Jordan Rose [Thu, 23 Aug 2012 23:01:43 +0000 (23:01 +0000)]
[analyzer] For now, treat pointers-to-members as non-null void * symbols.

Until we have full support for pointers-to-members, we can at least
approximate some of their use by tracking null and non-null values.
We thus treat &A::m_ptr as a non-null void * symbol, and MemberPointer(0)
as a pointer-sized null constant.

This enables support for what is sometimes called the "safe bool" idiom,
demonstrated in the test case.

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

12 years ago[analyzer] Handle UserDefinedConversion casts in C++.
Jordan Rose [Thu, 23 Aug 2012 23:01:39 +0000 (23:01 +0000)]
[analyzer] Handle UserDefinedConversion casts in C++.

This is trivial; the UserDefinedConversion always wraps a CXXMemberCallExpr
for the appropriate conversion function, so it's just a matter of
propagating that value to the CastExpr itself.

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

12 years agoRemove ASTOwningVector, it doesn't own anything and provides no value over SmallVector.
Benjamin Kramer [Thu, 23 Aug 2012 22:51:59 +0000 (22:51 +0000)]
Remove ASTOwningVector, it doesn't own anything and provides no value over SmallVector.

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

12 years agoAttaching comments to decls: since it was decided that Decl::isImplicit should
Dmitri Gribenko [Thu, 23 Aug 2012 22:40:40 +0000 (22:40 +0000)]
Attaching comments to decls: since it was decided that Decl::isImplicit should
not be set for implicit instantiations, remove the FIXME.  This should be the
last bit for PR13634.  The actual fix happened in r162238.

Motivation: it might be misleading to mark implicit instantiations as
Decl::isImplicit = true.  Because then, in order to be consistent, we should
mark all instantiated members as implicit.  But the user did actually type the
declaration for the member, but the compiler played with it a little bit.

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

12 years ago[ms-inline asm] Add a few helper function to the MSAsmStmt class that are needed
Chad Rosier [Thu, 23 Aug 2012 21:55:11 +0000 (21:55 +0000)]
[ms-inline asm] Add a few helper function to the MSAsmStmt class that are needed
by CodeGen.

In the long-term, much of the codegen logic will be shared between the GNU-style
and MS-style inline assembly, but for now I'm replicating this logic to avoid
regressions with the GNU-style.

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

12 years agoRip out remnants of move semantic emulation and smart pointers in Sema.
Benjamin Kramer [Thu, 23 Aug 2012 21:35:17 +0000 (21:35 +0000)]
Rip out remnants of move semantic emulation and smart pointers in Sema.

These were nops for quite a while and only lead to confusion. ASTMultiPtr
now behaves like a proper dumb array reference.

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

12 years agoAdded a method to DeclContext that marks the
Sean Callanan [Thu, 23 Aug 2012 21:16:40 +0000 (21:16 +0000)]
Added a method to DeclContext that marks the
lookup table as needing to be built.

This is required for LLDB, which provides the
contents of many DeclContexts through a custom
ExternalASTSource.

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

12 years agoChange a bunch of cases where we do "getAs<...>->doSomething()" to
Ted Kremenek [Thu, 23 Aug 2012 20:46:57 +0000 (20:46 +0000)]
Change a bunch of cases where we do "getAs<...>->doSomething()" to
"castAs<...>->doSomething()".  The analyzer was flagging these
as potential null dereferences, which is technically true.  The
invariants appear to be that these casts should never fail, so
let's use castAs<> instead and avoid a runtime check.

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

12 years agoWhen disambiguating an expression-statement from a declaraton-statement, if the
Richard Smith [Thu, 23 Aug 2012 20:19:14 +0000 (20:19 +0000)]
When disambiguating an expression-statement from a declaraton-statement, if the
statement starts with an identifier for which name lookup will fail either way,
look at later tokens to disambiguate in order to improve error recovery.

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