]> granicus.if.org Git - clang/log
clang
12 years agoMove isObjCSelf into Expr.
Anna Zaks [Mon, 1 Oct 2012 20:34:04 +0000 (20:34 +0000)]
Move isObjCSelf into Expr.

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

12 years ago[analyzer] Address Jordan's review for r164868.
Anna Zaks [Mon, 1 Oct 2012 20:33:58 +0000 (20:33 +0000)]
[analyzer] Address Jordan's review for r164868.

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

12 years agoAdd xml test for availability to comment-xml-schema.c
Fariborz Jahanian [Mon, 1 Oct 2012 19:10:40 +0000 (19:10 +0000)]
Add xml test for availability to comment-xml-schema.c

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

12 years ago[analyzer] Allow ObjC ivar lvalues where the base is nil.
Jordan Rose [Mon, 1 Oct 2012 19:07:22 +0000 (19:07 +0000)]
[analyzer] Allow ObjC ivar lvalues where the base is nil.

By analogy with C structs, this seems to be legal, if probably discouraged.
It's only if the ivar is read from or written to that there's a problem.
Running a program that gets the "address" of an instance variable does in
fact return the offset when the base "object" is nil.

This isn't a full revert because r164442 includes some diagnostic tweaks
as well; those have been kept.

This partially reverts r164442 / 08965091770c9b276c238bac2f716eaa4da2dca4.

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

12 years ago[analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"
Jordan Rose [Mon, 1 Oct 2012 19:07:19 +0000 (19:07 +0000)]
[analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"

This seems to be legal according to C11 6.5.3.2.

No functionality change.

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

12 years agoRevert "[analyzer] Check that a member expr is valid even when the result is an lvalue."
Jordan Rose [Mon, 1 Oct 2012 19:07:15 +0000 (19:07 +0000)]
Revert "[analyzer] Check that a member expr is valid even when the result is an lvalue."

The original intent of this commit was to catch potential null dereferences
early, but it breaks the common "home-grown offsetof" idiom (PR13927):

 (((struct Foo *)0)->member - ((struct foo *)0))

As it turns out, this appears to be legal in C, per a footnote in
C11 6.5.3.2: "Thus, &*E is equivalent to E (even if E is a null pointer)".
In C++ this issue is still open:
  http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#232

We'll just have to make sure we have good path notes in the future.

This reverts r164441 / 9be016dcd1ca3986873a7b66bd4bc027309ceb59.

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

12 years agoavailability in structured documents. Takes
Fariborz Jahanian [Mon, 1 Oct 2012 18:42:25 +0000 (18:42 +0000)]
availability in structured documents. Takes
care of comments by Dimitri and Doug.

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

12 years agoHave AnalyzerOptions::getBooleanOption() stick the matching config
Ted Kremenek [Mon, 1 Oct 2012 18:28:19 +0000 (18:28 +0000)]
Have AnalyzerOptions::getBooleanOption() stick the matching config
string in the config table so that it can be dumped as part of the
config dumper.  Add a test to show that these options are sticking
and can be cross-checked using FileCheck.

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

12 years agoAdd checker debug.ConfigDumper to dump the contents of the configuration table.
Ted Kremenek [Mon, 1 Oct 2012 18:28:14 +0000 (18:28 +0000)]
Add checker debug.ConfigDumper to dump the contents of the configuration table.
The format of this output is a WIP; largely I'm bringing it up now
for regression testing.  We can evolve the output format over time.

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

12 years agoReapply "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
Jordan Rose [Mon, 1 Oct 2012 17:51:35 +0000 (17:51 +0000)]
Reapply "[analyzer] Handle inlined constructors for rvalue temporaries correctly."

This is related to but not blocked by <rdar://problem/12137950>
("Return-by-value structs do not have associated regions")

This reverts r164875 / 3278d41e17749dbedb204a81ef373499f10251d7.

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

12 years agoCleaning up the self initialization checker.
Richard Trieu [Mon, 1 Oct 2012 17:39:51 +0000 (17:39 +0000)]
Cleaning up the self initialization checker.
-Allow Sema to do more processing on the initial Expr before checking it.
-Remove the special conditions in HandleExpr()
-Move the code so that only one call site is needed.
-Removed the function from Sema and only call it locally.
-Warn on potentially evaluated reference variables, not just casts to r-values.
-Update tests.

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

12 years ago[analyzer] Make ProgramStateManager's SubEngine parameter optional.
Jordan Rose [Mon, 1 Oct 2012 16:53:40 +0000 (16:53 +0000)]
[analyzer] Make ProgramStateManager's SubEngine parameter optional.

It is possible and valid to have a state manager and associated objects
without having a SubEngine or checkers.

Patch by Olaf Krzikalla!

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

12 years agoFix ASTMatchersTests in configurations where
Daniel Jasper [Mon, 1 Oct 2012 15:05:34 +0000 (15:05 +0000)]
Fix ASTMatchersTests in configurations where
"#include <initializer_list>" is unavailable for whatever reason.

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

12 years agoAdd matchers for selected C++11 features.
Daniel Jasper [Mon, 1 Oct 2012 13:40:41 +0000 (13:40 +0000)]
Add matchers for selected C++11 features.

Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D46

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

12 years agoThe Redeclarable part of named decls is read before their name.
Axel Naumann [Mon, 1 Oct 2012 09:51:27 +0000 (09:51 +0000)]
The Redeclarable part of named decls is read before their name.
Lookup can nevertheless find them due to the serialized lookup table.
For instance when reading a template decl's templatedDecl, it will search for existing decls that it could be a redeclaration of, and find the half-read template decl.
Thus there is no point in asserting the names of decls.

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

12 years agoAlso merge template redeclarations.
Axel Naumann [Mon, 1 Oct 2012 09:18:00 +0000 (09:18 +0000)]
Also merge template redeclarations.
Don't require specializations (of existing and read template) to be unique.

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

12 years agoMark two Clang tests as passing on ARM
Nico Weber [Mon, 1 Oct 2012 08:44:54 +0000 (08:44 +0000)]
Mark two Clang tests as passing on ARM

Also move one of them from grep to FileCheck.
Patch from Joey Gouly <joey.gouly@arm.com>!

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

12 years agofix test/CodeGen/tbaa-for-vptr.cpp: don't hardcode the index of metadata
Kostya Serebryany [Mon, 1 Oct 2012 08:39:00 +0000 (08:39 +0000)]
fix test/CodeGen/tbaa-for-vptr.cpp: don't hardcode the index of metadata

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

12 years agoBring ASTReader and Writer into sync for the case where a canonical template speciali...
Axel Naumann [Mon, 1 Oct 2012 07:34:47 +0000 (07:34 +0000)]
Bring ASTReader and Writer into sync for the case where a canonical template specialization was written, which is non-canonical at the time of reading: force the reading of the ClassTemplateDecl if it was written.
The easiest way out is to store whether the decl was canonical at the time of writing.
Add test.

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

12 years agoCodeGen: Copy tail padding when we're not dealing with a trivial copy assign or move...
Benjamin Kramer [Sun, 30 Sep 2012 12:43:37 +0000 (12:43 +0000)]
CodeGen: Copy tail padding when we're not dealing with a trivial copy assign or move assign operator.

This fixes a regression from r162254, the optimizer has problems reasoning
about the smaller memcpy as it's often not safe to widen a store but making it
smaller is.

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

12 years agoFilter out tools and unittests which we don't want to build when we're building clang...
Bill Wendling [Sun, 30 Sep 2012 11:23:30 +0000 (11:23 +0000)]
Filter out tools and unittests which we don't want to build when we're building clang only.

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

12 years agoRemove this hack in favor of another, better way of performing the same thing.
Bill Wendling [Sun, 30 Sep 2012 11:22:45 +0000 (11:22 +0000)]
Remove this hack in favor of another, better way of performing the same thing.

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

12 years agoSpecify a full target in an attempt to appease buildbots.
Bob Wilson [Sun, 30 Sep 2012 00:58:28 +0000 (00:58 +0000)]
Specify a full target in an attempt to appease buildbots.

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

12 years agoAdd Clang support for iOS6.
Bob Wilson [Sat, 29 Sep 2012 23:52:58 +0000 (23:52 +0000)]
Add Clang support for iOS6.

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

12 years agoAdd ARM VFPv4 feature and enable it by default for Swift.
Bob Wilson [Sat, 29 Sep 2012 23:52:52 +0000 (23:52 +0000)]
Add ARM VFPv4 feature and enable it by default for Swift.

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

12 years agoAdd armv7s and some other arm variants supported by Mach-O files.
Bob Wilson [Sat, 29 Sep 2012 23:52:50 +0000 (23:52 +0000)]
Add armv7s and some other arm variants supported by Mach-O files.

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

12 years agoAdd an FMA intrinsic for ARM Neon.
Bob Wilson [Sat, 29 Sep 2012 23:52:48 +0000 (23:52 +0000)]
Add an FMA intrinsic for ARM Neon.

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

12 years agoWhitespace.
Bob Wilson [Sat, 29 Sep 2012 22:08:54 +0000 (22:08 +0000)]
Whitespace.

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

12 years agoFix refersToDeclaration()-matcher and add missing test case. This was
Daniel Jasper [Sat, 29 Sep 2012 15:55:18 +0000 (15:55 +0000)]
Fix refersToDeclaration()-matcher and add missing test case. This was
broken as of r164656 as TemplateArgument::getAsDecl() now asserts
instead of returning NULL for other template arugment kinds.

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

12 years agoMove the 'find macro by spelling' infrastructure to the Preprocessor class and
Dmitri Gribenko [Sat, 29 Sep 2012 11:40:46 +0000 (11:40 +0000)]
Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.

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

12 years agoComment XML schema: correct indentation.
Dmitri Gribenko [Sat, 29 Sep 2012 08:27:37 +0000 (08:27 +0000)]
Comment XML schema: correct indentation.

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

12 years agoclang/test/CodeGen/tbaa-struct.cpp: Fix. Be aware of 32 bit pointer.
NAKAMURA Takumi [Sat, 29 Sep 2012 02:00:04 +0000 (02:00 +0000)]
clang/test/CodeGen/tbaa-struct.cpp: Fix. Be aware of 32 bit pointer.

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

12 years agoRevert "[analyzer] Create a temporary region for rvalue structs when accessing fields"
Jordan Rose [Sat, 29 Sep 2012 01:36:51 +0000 (01:36 +0000)]
Revert "[analyzer] Create a temporary region for rvalue structs when accessing fields"

This reverts commit 6f61df3e7256413dcb99afb9673f4206e3c4992c.

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

12 years agoRevert "[analyzer] Create a temp region when a method is called on a struct rvalue."
Jordan Rose [Sat, 29 Sep 2012 01:36:47 +0000 (01:36 +0000)]
Revert "[analyzer] Create a temp region when a method is called on a struct rvalue."

This reverts commit 0006ba445962621ed82ec84400a6b978205a3fbc.

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

12 years agoRevert "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
Jordan Rose [Sat, 29 Sep 2012 01:36:42 +0000 (01:36 +0000)]
Revert "[analyzer] Handle inlined constructors for rvalue temporaries correctly."

This reverts commit 580cd17f256259f39a382e967173f34d68e73859.

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

12 years agoFor PPCallbacks::InclusionDirective() add a parameter for the module, whenever
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:10 +0000 (01:06 +0000)]
For PPCallbacks::InclusionDirective() add a parameter for the module, whenever
an inclusion directive was automatically turned into a module import, and
PPCallbacks::moduleImport() for an explicit module import.

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

12 years agoIn the Module class, add a reference to the corresponding AST file.
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:04 +0000 (01:06 +0000)]
In the Module class, add a reference to the corresponding AST file.

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

12 years agoAdd an assertion to make sure the implicitly imported module
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:01 +0000 (01:06 +0000)]
Add an assertion to make sure the implicitly imported module
is the same as the suggested one when looking up the include filename.

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

12 years ago[analyzer] Do not visit ObjCMethodDecl twice in the AST checkers.
Anna Zaks [Sat, 29 Sep 2012 00:20:40 +0000 (00:20 +0000)]
[analyzer] Do not visit ObjCMethodDecl twice in the AST checkers.

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

12 years ago[analyzer] Re-implement IvarInvalidationChecker so that it verifies that
Anna Zaks [Sat, 29 Sep 2012 00:20:38 +0000 (00:20 +0000)]
[analyzer] Re-implement IvarInvalidationChecker so that it verifies that
the validation occurred.

The original implementation was pessimistic - we assumed that ivars
which escape are invalidated. This version is optimistic, it assumes
that the ivars will always be explicitly invalidated: either set to nil
or sent an invalidation message.

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

12 years agoPR13941: Mark all virtual functions as unnamed_addr. It's not possible to
Richard Smith [Fri, 28 Sep 2012 22:46:07 +0000 (22:46 +0000)]
PR13941: Mark all virtual functions as unnamed_addr. It's not possible to
observe their addresses (taking their address gives the vtable slot) so we are
free to merge their definitions.

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

12 years agoUse a custom DenseMapInfo for WeakObjectProfileTy.
Jordan Rose [Fri, 28 Sep 2012 22:42:04 +0000 (22:42 +0000)]
Use a custom DenseMapInfo for WeakObjectProfileTy.

We can't specialize the usual llvm::DenseMapInfo at the end of the file
because by that point the DenseMap in FunctionScopeInfo has already been
instantiated.

No functionality change.

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

12 years ago[Doc parsing] Add availability information to generated Comment XML.
Fariborz Jahanian [Fri, 28 Sep 2012 22:35:49 +0000 (22:35 +0000)]
[Doc parsing] Add availability information to generated Comment XML.
(I still need to add a test once I figure it out).
Reviewed off-line by Doug. // rdar://12378879

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

12 years agoFix buildbots by not using a template from another namespace.
Jordan Rose [Fri, 28 Sep 2012 22:29:02 +0000 (22:29 +0000)]
Fix buildbots by not using a template from another namespace.

No need to specialize BeforeThanCompare for a comparator that's only
going to be used once.

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

12 years agoCompatibility macro detection for the -Wimplicit-fallthrough diagnostic.
Alexander Kornienko [Fri, 28 Sep 2012 22:24:03 +0000 (22:24 +0000)]
Compatibility macro detection for the -Wimplicit-fallthrough diagnostic.

Summary:
When issuing a diagnostic message for the -Wimplicit-fallthrough diagnostics, always try to find the latest macro, defined at the point of fallthrough, which is immediately expanded to "[[clang::fallthrough]]", and use it's name instead of the actual sequence.

Known issues:
  * uses PP.getSpelling() to compare macro definition with a string (anyone can suggest a convenient way to fill a token array, or maybe lex it in runtime?);
  * this can be generalized and used in other similar cases, any ideas where it should reside then?

Reviewers: doug.gregor, rsmith

Reviewed By: rsmith

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D50

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

12 years ago-Wreceiver-is-weak: rephrase warning text and add a suggestion Note.
Jordan Rose [Fri, 28 Sep 2012 22:21:42 +0000 (22:21 +0000)]
-Wreceiver-is-weak: rephrase warning text and add a suggestion Note.

New output:
  warning: weak property may be unpredictably set to nil
  note: property declared here
  note: assign the value to a strong variable to keep the object alive
        during use

<rdar://problem/12277204>

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

12 years agoPull ScopeInfo implementation into its own file.
Jordan Rose [Fri, 28 Sep 2012 22:21:39 +0000 (22:21 +0000)]
Pull ScopeInfo implementation into its own file.

The infrastructure for -Warc-repeated-use-of-weak got a little too heavy
to leave sitting at the top of Sema.cpp.

No functionality change.

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

12 years ago-Warc-repeated-use-of-weak: check ivars and variables as well.
Jordan Rose [Fri, 28 Sep 2012 22:21:35 +0000 (22:21 +0000)]
-Warc-repeated-use-of-weak: check ivars and variables as well.

Like properties, loading from a weak ivar twice in the same function can
give you inconsistent results if the object is deallocated between the
two loads. It is safer to assign to a strong local variable and use that.

Second half of <rdar://problem/12280249>.

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

12 years agoAdd a warning (off by default) for repeated use of the same weak property.
Jordan Rose [Fri, 28 Sep 2012 22:21:30 +0000 (22:21 +0000)]
Add a warning (off by default) for repeated use of the same weak property.

The motivating example:

if (self.weakProp)
  use(self.weakProp);

As with any non-atomic test-then-use, it is possible a weak property to be
non-nil at the 'if', but be deallocated by the time it is used. The correct
way to write this example is as follows:

id tmp = self.weakProp;
if (tmp)
  use(tmp);

The warning is controlled by -Warc-repeated-use-of-receiver, and uses the
property name and base to determine if the same property on the same object
is being accessed multiple times. In cases where the base is more
complicated than just a single Decl (e.g. 'foo.bar.weakProp'), it picks a
Decl for some degree of uniquing and reports the problem under a subflag,
-Warc-maybe-repeated-use-of-receiver. This gives a way to tune the
aggressiveness of the warning for a particular project.

The warning is not on by default because it is not flow-sensitive and thus
may have a higher-than-acceptable rate of false positives, though it is
less noisy than -Wreceiver-is-weak. On the other hand, it will not warn
about some cases that may be legitimate issues that -Wreceiver-is-weak
will catch, and it does not attempt to reason about methods returning weak
values.

Even though this is not a real "analysis-based" check I've put the bug
emission code in AnalysisBasedWarnings for two reasons: (1) to run on
every kind of code body (function, method, block, or lambda), and (2) to
suggest that it may be enhanced by flow-sensitive analysis in the future.

The second (smaller) half of this work is to extend it to weak locals
and weak ivars. This should use most of the same infrastructure.

Part of <rdar://problem/12280249>

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

12 years agoAdd basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
Dan Gohman [Fri, 28 Sep 2012 21:58:29 +0000 (21:58 +0000)]
Add basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
struct assignment.

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

12 years agoWhen processing an InitListExpr and skipping the initialization of an invalid
Richard Smith [Fri, 28 Sep 2012 21:23:50 +0000 (21:23 +0000)]
When processing an InitListExpr and skipping the initialization of an invalid
record, skip at least one element from the InitListExpr to avoid an infinite
loop if we're initializing an array of unknown bound.

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

12 years agoUpdate template type diffing to handle qualifiers. Differing qualifiers will
Richard Trieu [Fri, 28 Sep 2012 20:32:51 +0000 (20:32 +0000)]
Update template type diffing to handle qualifiers.  Differing qualifiers will
now be printed with highlighting.

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

12 years agoAllow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl...
Richard Smith [Fri, 28 Sep 2012 20:20:52 +0000 (20:20 +0000)]
Allow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl Coosemans!

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

12 years agoClean up part of template type diffing. Moved repeated code to separate
Richard Trieu [Fri, 28 Sep 2012 19:51:57 +0000 (19:51 +0000)]
Clean up part of template type diffing.  Moved repeated code to separate
functions.  Reworked one of the conditionals.  No functional changes.

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

12 years agoModern objcective-C translator. When doing rewriting, Do not
Fariborz Jahanian [Fri, 28 Sep 2012 19:05:17 +0000 (19:05 +0000)]
Modern objcective-C translator. When doing rewriting, Do not
use the integrated pre-processor, preprocess in objective-c++ mode.
// rdar://12189793.

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

12 years ago[analyzer] Handle inlined constructors for rvalue temporaries correctly.
Jordan Rose [Fri, 28 Sep 2012 17:15:25 +0000 (17:15 +0000)]
[analyzer] Handle inlined constructors for rvalue temporaries correctly.

Previously the analyzer treated all inlined constructors like lvalues,
setting the value of the CXXConstructExpr to the newly-constructed
region. However, some CXXConstructExprs behave like rvalues -- in
particular, the implicit copy constructor into a pass-by-value argument.
In this case, we want only the /contents/ of a temporary object to be
passed, so that we can use the same "copy each argument into the
parameter region" algorithm that we use for scalar arguments.

This may change when we start modeling destructors of temporaries,
but for now this is the last part of <rdar://problem/12137950>.

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

12 years ago[analyzer] Create a temp region when a method is called on a struct rvalue.
Jordan Rose [Fri, 28 Sep 2012 17:15:21 +0000 (17:15 +0000)]
[analyzer] Create a temp region when a method is called on a struct rvalue.

An rvalue has no address, but calling a C++ member function requires a
'this' pointer. This commit makes the analyzer create a temporary region
in which to store the struct rvalue and use as a 'this' pointer whenever
a member function is called on an rvalue, which is essentially what
CodeGen does.

More of <rdar://problem/12137950>. The last part is tracking down the
C++ FIXME in array-struct-region.cpp.

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

12 years ago[analyzer] Create a temporary region for rvalue structs when accessing fields
Jordan Rose [Fri, 28 Sep 2012 17:15:12 +0000 (17:15 +0000)]
[analyzer] Create a temporary region for rvalue structs when accessing fields

Struct rvalues are represented in the analyzer by CompoundVals,
LazyCompoundVals, or plain ConjuredSymbols -- none of which have associated
regions. If the entire structure is going to persist, this is not a
problem -- either the rvalue will be assigned to an existing region, or
a MaterializeTemporaryExpr will be present to create a temporary region.
However, if we just need a field from the struct, we need to create the
temporary region ourselves.

This is inspired by the way CodeGen handles calls to temporaries;
support for that in the analyzer is coming next.

Part of <rdar://problem/12137950>

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

12 years agoAvoid malloc thrashing in the uninitialized value analysis.
Benjamin Kramer [Fri, 28 Sep 2012 16:44:29 +0000 (16:44 +0000)]
Avoid malloc thrashing in the uninitialized value analysis.

- The size of the packed vector is often small, save mallocs using SmallBitVector.
- Copying SmallBitVectors is also cheap, remove a level of indirection.

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

12 years agoSet Diag.ErrorOccurred even if a DiagnosticConsumer does not want it in
Daniel Jasper [Fri, 28 Sep 2012 15:45:07 +0000 (15:45 +0000)]
Set Diag.ErrorOccurred even if a DiagnosticConsumer does not want it in
diagnostic count.

If a DiagnosticConsumer sub-class overwrites IncludeInDiagnosticCounts,
this should change diagnostic counts. However, it currently also
influences Diag.ErrorOccurred, which in turn influences the behavior of
parsing and semantic analysis (in a way that can make it crash).

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

12 years agoFix a regression from r164656.
Eli Friedman [Thu, 27 Sep 2012 22:13:33 +0000 (22:13 +0000)]
Fix a regression from r164656.

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

12 years ago[analyzer] Address Jordan's code review for r164790.
Anna Zaks [Thu, 27 Sep 2012 21:57:17 +0000 (21:57 +0000)]
[analyzer] Address Jordan's code review for r164790.

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

12 years ago[analyzer] IvarInvalidation: track synthesized ivars and allow escape
Anna Zaks [Thu, 27 Sep 2012 21:57:14 +0000 (21:57 +0000)]
[analyzer] IvarInvalidation: track synthesized ivars and allow escape
through property getters.

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

12 years agoUnbreak cmake build
Anna Zaks [Thu, 27 Sep 2012 20:32:46 +0000 (20:32 +0000)]
Unbreak cmake build
(fixup for r164790)

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

12 years ago[analyzer] Add an experimental ObjC direct ivar assignment checker.
Anna Zaks [Thu, 27 Sep 2012 19:45:15 +0000 (19:45 +0000)]
[analyzer] Add an experimental ObjC direct ivar assignment checker.

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

12 years agoMake getDefaultSynthIvarName() a member of ObjCPropertyDecl.
Anna Zaks [Thu, 27 Sep 2012 19:45:11 +0000 (19:45 +0000)]
Make getDefaultSynthIvarName() a member of ObjCPropertyDecl.

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

12 years ago[analyzer] Address Jordan's code review comments for r164716.
Anna Zaks [Thu, 27 Sep 2012 19:45:08 +0000 (19:45 +0000)]
[analyzer] Address Jordan's code review comments for r164716.

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

12 years agoPass PrintingPolicy by reference, copying it isn't cheap.
Benjamin Kramer [Thu, 27 Sep 2012 17:37:30 +0000 (17:37 +0000)]
Pass PrintingPolicy by reference, copying it isn't cheap.

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

12 years agoclang/test/CodeGen/ms-inline-asm.c: It requires x86 codegen. Reported by Joey Gouly.
NAKAMURA Takumi [Thu, 27 Sep 2012 14:55:08 +0000 (14:55 +0000)]
clang/test/CodeGen/ms-inline-asm.c: It requires x86 codegen. Reported by Joey Gouly.

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

12 years agoFollowing up on r164620, cope with symlinking from an embedded
Douglas Gregor [Thu, 27 Sep 2012 14:50:15 +0000 (14:50 +0000)]
Following up on r164620, cope with symlinking from an embedded
framework location out to a top-level framework. Such frameworks are
not really embedded at all.

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

12 years agoShrink LinkageInfo from 96 bits to 8 bits.
Benjamin Kramer [Thu, 27 Sep 2012 12:52:55 +0000 (12:52 +0000)]
Shrink LinkageInfo from 96 bits to 8 bits.

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

12 years agoRevert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See:...
Sylvestre Ledru [Thu, 27 Sep 2012 10:16:10 +0000 (10:16 +0000)]
Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766

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

12 years agoFix a typo 'iff' => 'if'
Sylvestre Ledru [Thu, 27 Sep 2012 09:57:10 +0000 (09:57 +0000)]
Fix a typo 'iff' => 'if'

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

12 years agoIvarInvalidationChecker.cpp: Remove an unused member, InterfD. [-Wunused-private...
NAKAMURA Takumi [Thu, 27 Sep 2012 01:52:00 +0000 (01:52 +0000)]
IvarInvalidationChecker.cpp: Remove an unused member, InterfD. [-Wunused-private-field]

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

12 years agoPer discussion in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917...
Argyrios Kyrtzidis [Thu, 27 Sep 2012 01:42:07 +0000 (01:42 +0000)]
Per discussion in http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120917/064551.html
have PPCallbacks::InclusionDirective pass the character range for the filename quotes or brackets.

rdar://11113134 & http://llvm.org/PR13880

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

12 years agoUse %clang_cc1 so that the test works even if the target isn't available.
Jordan Rose [Thu, 27 Sep 2012 01:40:12 +0000 (01:40 +0000)]
Use %clang_cc1 so that the test works even if the target isn't available.

Xcode-style clang builds only support Xcode's architectures, so mips
isn't available and the driver tries to use gcc instead. cc1 will go
ahead and do -fsyntax-only for any platform it knows about even if it
can't actually compile.

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

12 years ago[libclang] Always report a CXCursor_MacroDefinition for code-completion
Argyrios Kyrtzidis [Thu, 27 Sep 2012 00:24:09 +0000 (00:24 +0000)]
[libclang] Always report a CXCursor_MacroDefinition for code-completion
results for a macro name, not CXCursor_NotImplemented.

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

12 years agoUse a variable to stop us from building clang testing tools.
Bill Wendling [Thu, 27 Sep 2012 00:11:09 +0000 (00:11 +0000)]
Use a variable to stop us from building clang testing tools.
<rdar://problem/11202465>

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

12 years agoTurn off this test, as the new and old SROA cause it produce different output.
Nick Lewycky [Wed, 26 Sep 2012 22:48:46 +0000 (22:48 +0000)]
Turn off this test, as the new and old SROA cause it produce different output.
Left in a note that we need to turn it back on once the SROA fallout is cleared
up.

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

12 years agoUpdate to new function attribute querying syntax.
Bill Wendling [Wed, 26 Sep 2012 21:59:46 +0000 (21:59 +0000)]
Update to new function attribute querying syntax.

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

12 years agoAllow -MF to be used in combination with -E -M or -E -MM.
Benjamin Kramer [Wed, 26 Sep 2012 19:01:49 +0000 (19:01 +0000)]
Allow -MF to be used in combination with -E -M or -E -MM.

Fixes PR13851. Patch by Dimitry Andric!

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

12 years ago[analyzer] Add experimental ObjC invalidation method checker.
Anna Zaks [Wed, 26 Sep 2012 18:55:16 +0000 (18:55 +0000)]
[analyzer] Add experimental ObjC invalidation method checker.

This checker is annotation driven. It checks that the annotated
invalidation method accesses all ivars of the enclosing objects that are
objects of type, which in turn contains an invalidation method.

This is driven by
__attribute((annotation("objc_instance_variable_invalidator")).

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

12 years ago[analyzer] Commit a test case for r164579.
Anna Zaks [Wed, 26 Sep 2012 18:55:09 +0000 (18:55 +0000)]
[analyzer] Commit a test case for r164579.

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

12 years agoHave set-xcode-analyer report an error if no xcspec file could be found.
Ted Kremenek [Wed, 26 Sep 2012 18:19:55 +0000 (18:19 +0000)]
Have set-xcode-analyer report an error if no xcspec file could be found.

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

12 years agoMake set-xcode-analyzer more tolerant of the naming differenes reported by xcode...
Ted Kremenek [Wed, 26 Sep 2012 18:13:03 +0000 (18:13 +0000)]
Make set-xcode-analyzer more tolerant of the naming differenes reported by xcode-select.

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

12 years agoRevert "Use sep instead of ' '."
Ted Kremenek [Wed, 26 Sep 2012 18:06:08 +0000 (18:06 +0000)]
Revert "Use sep instead of ' '."

This isn't correct, as Jordan correctly points out.

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

12 years agoFix template instantiation of attributes. More specifically, fix the case
DeLesley Hutchins [Wed, 26 Sep 2012 17:57:31 +0000 (17:57 +0000)]
Fix template instantiation of attributes.  More specifically, fix the case
where an attribute is attached to a forward declaration of a template function,
and refers to parameters of that declaration, but is then inherited by the
definition of that function.  When the definition is instantiated, the
parameter references need to be remapped.

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

12 years agoUse sep instead of ' '.
Ted Kremenek [Wed, 26 Sep 2012 17:23:31 +0000 (17:23 +0000)]
Use sep instead of ' '.

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

12 years agoMake our mini-stdint.h platform-independent by using predefined macros.
Jordan Rose [Wed, 26 Sep 2012 16:41:11 +0000 (16:41 +0000)]
Make our mini-stdint.h platform-independent by using predefined macros.

This also adds a definition for uint64_t, which was causing build failures
on some platforms. (I'm actually surprised this didn't happen on more
builders, but maybe the search paths are different.)

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

12 years ago[libclang] Remove the ParentKind cursor kind from code-completion results.
Argyrios Kyrtzidis [Wed, 26 Sep 2012 16:39:56 +0000 (16:39 +0000)]
[libclang] Remove the ParentKind cursor kind from code-completion results.

This is to reduce dependency to cursors for the code-completion results.

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

12 years agoHave ASTUnit::Save() return a bool to indicate save error.
Argyrios Kyrtzidis [Wed, 26 Sep 2012 16:39:46 +0000 (16:39 +0000)]
Have ASTUnit::Save() return a bool to indicate save error.

Removes a dependency of ASTUnit to clang-c/Index.h.

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

12 years agoFix build failure and enhance the testcase for unwind.h.
Logan Chien [Wed, 26 Sep 2012 09:40:37 +0000 (09:40 +0000)]
Fix build failure and enhance the testcase for unwind.h.

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

12 years agoRun test in a freestanding environment so it doesn't accidentally pick up system...
Benjamin Kramer [Wed, 26 Sep 2012 09:10:53 +0000 (09:10 +0000)]
Run test in a freestanding environment so it doesn't accidentally pick up system headers for the wrong target.

While there add a test that verifies that the header parses in C++ mode.

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

12 years agoFix two more tests that didn't do anything.
Nico Weber [Wed, 26 Sep 2012 09:09:17 +0000 (09:09 +0000)]
Fix two more tests that didn't do anything.

Found with
  find test -type f | xargs grep RUN: | grep '%clang' | grep -iv '%s' | grep -v '%t' | grep -v '\\$'

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

12 years agoMake this test actually test something
Nico Weber [Wed, 26 Sep 2012 09:02:07 +0000 (09:02 +0000)]
Make this test actually test something

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

12 years agoRevert r163022, it caused PR13924.
Nico Weber [Wed, 26 Sep 2012 08:19:01 +0000 (08:19 +0000)]
Revert r163022, it caused PR13924.

Add a test for PR13924. Do not revert the test added in r163022,
it surprisingly still passes even after reverting the code changes.

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

12 years agoAdd struct keyword before _Unwind_Context.
Logan Chien [Wed, 26 Sep 2012 06:35:17 +0000 (06:35 +0000)]
Add struct keyword before _Unwind_Context.

In the C programming language, we have to add the
"struct" keyword.  Otherwise, the compiler will
emit error message.

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

12 years agoRemove unnecessary ASTContext& parameter from SymExpr::getType().
Ted Kremenek [Wed, 26 Sep 2012 06:00:14 +0000 (06:00 +0000)]
Remove unnecessary ASTContext& parameter from SymExpr::getType().

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

12 years agoAdd codegen support for the __debugbreak intrinsic.
Nico Weber [Wed, 26 Sep 2012 05:40:16 +0000 (05:40 +0000)]
Add codegen support for the __debugbreak intrinsic.

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

12 years agoFix an edge case of mangling involving the combination of a lambda and typeid.
Eli Friedman [Wed, 26 Sep 2012 04:34:21 +0000 (04:34 +0000)]
Fix an edge case of mangling involving the combination of a lambda and typeid.
typeid (and a couple other non-standard places where we can transform an
unevaluated expression into an evaluated expression) is special
because it introduces an an expression evaluation context,
which conflicts with the mechanism to compute the current
lambda mangling context.  PR12123.

I would appreciate if someone would double-check that we get the mangling
correct with this patch.

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