]> granicus.if.org Git - clang/log
clang
12 years agoWhen AST-dumping the ObjCBoxedExpr node, also print out what selector it chose.
Argyrios Kyrtzidis [Thu, 10 May 2012 20:02:31 +0000 (20:02 +0000)]
When AST-dumping the ObjCBoxedExpr node, also print out what selector it chose.

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

12 years agoProvide a man page for scan-build. Patch by James Lowden!
Ted Kremenek [Thu, 10 May 2012 19:10:47 +0000 (19:10 +0000)]
Provide a man page for scan-build.  Patch by James Lowden!

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

12 years ago[preprocessor] Make sure that MacroExpands callbacks are always in source order.
Argyrios Kyrtzidis [Thu, 10 May 2012 18:57:19 +0000 (18:57 +0000)]
[preprocessor] Make sure that MacroExpands callbacks are always in source order.

Fixes assertion hit in the preprocessing record. rdar://11426523

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

12 years agoTest for previously checked in patch.
Fariborz Jahanian [Thu, 10 May 2012 17:05:15 +0000 (17:05 +0000)]
Test for previously checked in patch.
// rdar://11374235

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

12 years agoFix an assertion hit when the serialized diagnostics writer receive a diagnostic
Argyrios Kyrtzidis [Thu, 10 May 2012 05:03:45 +0000 (05:03 +0000)]
Fix an assertion hit when the serialized diagnostics writer receive a diagnostic
from the frontend when the location is invalid and the SourceManager null.

Instead of keeping the SourceManager object in DiagnosticRenderer, propagate it
to the calls accordingly (as reference when it is expected to not be null, or pointer
when it may be null).
This effectively makes DiagnosticRenderer not tied to a specific SourceManager,
removing a hack from TextDiagnosticPrinter.

rdar://11386874

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

12 years agoWarn about visibility attributes in typedefs.
Rafael Espindola [Thu, 10 May 2012 03:01:34 +0000 (03:01 +0000)]
Warn about visibility attributes in typedefs.

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

12 years agoFix an old (2009) FIXME:
Rafael Espindola [Thu, 10 May 2012 02:50:16 +0000 (02:50 +0000)]
Fix an old (2009) FIXME:

// FIXME: This needs to happen before we merge declarations. Then,
// let attribute merging cope with attribute conflicts.

This was already being done for variables, but for functions we were merging
then first and then applying the attributes. To avoid duplicating merging
logic, some of the helpers in SemaDeclAttr.cpp become methods that can
handle merging two attributes in one decl or inheriting attributes from one
decl to another.

With this change we are now able to produce errors for variables with
incompatible visibility attributes or warn about unused dllimports in
variables.

This changes the attribute list iteration back to being in reverse source
code order, as that matches what decl merging does and avoids differentiating
the two cases is the merge*Attr methods.

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

12 years ago[analyzer] Do not highlight the range of the statement in case of leak.
Anna Zaks [Thu, 10 May 2012 01:37:40 +0000 (01:37 +0000)]
[analyzer] Do not highlight the range of the statement in case of leak.

We report a leak at a point a leaked variable is no longer accessible.
The statement that happens to be at that point is not relevant to the
leak diagnostic and, thus, should not be highlighted.

radar://11178519

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

12 years agoRecursiveASTVisitor:
Richard Smith [Wed, 9 May 2012 23:51:36 +0000 (23:51 +0000)]
RecursiveASTVisitor:

We don't create any declaration to mark the explicit instantiation of function
templates other than the instantiation itself, so visit that when traversing
the function template decl.

This is a temporary fix, pending the creation of a Decl node to represent the
explicit instantiation.

Patch by Daniel Jasper!

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

12 years agoobjective-c. Fixes a 'fixit' where location of
Fariborz Jahanian [Wed, 9 May 2012 21:49:29 +0000 (21:49 +0000)]
objective-c. Fixes a 'fixit' where location of
'*' on objective-c class name was misplaced.
// rdar://11311333

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

12 years agohopefully fix a bunch of ARM buildbot failures
Nuno Lopes [Wed, 9 May 2012 21:21:49 +0000 (21:21 +0000)]
hopefully fix a bunch of ARM buildbot failures

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

12 years agoPull some cases of initialization with self-reference warnings out of
Richard Trieu [Wed, 9 May 2012 21:08:22 +0000 (21:08 +0000)]
Pull some cases of initialization with self-reference warnings out of
-Wconditional-uninitialized into -Wuninitialized.

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

12 years agoPush the knowledge that we are parsing a type-id/type-name further into the
Richard Smith [Wed, 9 May 2012 20:55:26 +0000 (20:55 +0000)]
Push the knowledge that we are parsing a type-id/type-name further into the
parser, and use it to emit better diagnostics in cases where an identifer
can't be looked up as a type name.

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

12 years agoStop AltiVec parsing from going down the 'implicit int' codepath as part of its
Richard Smith [Wed, 9 May 2012 18:56:43 +0000 (18:56 +0000)]
Stop AltiVec parsing from going down the 'implicit int' codepath as part of its
normal parse for token sequences like 'vector pixel foo'. This incidentally also
fixes a couple of wrong-parse issues.

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

12 years agoRoll logic into a single if statement, per David's suggestion.
Chad Rosier [Wed, 9 May 2012 18:55:57 +0000 (18:55 +0000)]
Roll logic into a single if statement, per David's suggestion.

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

12 years agoUse the triple directly, rather then getTriple().
Chad Rosier [Wed, 9 May 2012 18:51:13 +0000 (18:51 +0000)]
Use the triple directly, rather then getTriple().

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

12 years agoPass a target triple explicitly to check platform specific macros definitions.
Simon Atanasyan [Wed, 9 May 2012 18:49:52 +0000 (18:49 +0000)]
Pass a target triple explicitly to check platform specific macros definitions.
That allows to run the tests on all platforms successfully.

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

12 years agoNow the proper fix for r156497. Sorry for the churn.
Chad Rosier [Wed, 9 May 2012 18:46:30 +0000 (18:46 +0000)]
Now the proper fix for r156497.  Sorry for the churn.

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

12 years agoMove the iOSVersionMin string to a header so as to avoid a dangling pointer.
Chad Rosier [Wed, 9 May 2012 18:37:26 +0000 (18:37 +0000)]
Move the iOSVersionMin string to a header so as to avoid a dangling pointer.

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

12 years agoFix -Wdelete-non-virtual-dtor in Tooling code.
David Blaikie [Wed, 9 May 2012 18:31:50 +0000 (18:31 +0000)]
Fix -Wdelete-non-virtual-dtor in Tooling code.

Also, add an anchor as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch

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

12 years agoUpdate test case for new default of 3.0
Chad Rosier [Wed, 9 May 2012 18:23:04 +0000 (18:23 +0000)]
Update test case for new default of 3.0

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

12 years agoImplement PPC64TargetCodeGenInfo.
Roman Divacky [Wed, 9 May 2012 18:22:46 +0000 (18:22 +0000)]
Implement PPC64TargetCodeGenInfo.

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

12 years agoARM: Support marking intrinsic definitions as 'unavailable'
Jim Grosbach [Wed, 9 May 2012 18:17:30 +0000 (18:17 +0000)]
ARM: Support marking intrinsic definitions as 'unavailable'

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

12 years ago[driver] Use the iOS target triple to infer the deployment target.
Chad Rosier [Wed, 9 May 2012 18:09:58 +0000 (18:09 +0000)]
[driver] Use the iOS target triple to infer the deployment target.
rdar://11409204

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

12 years ago[analyzer]Extend the available checks list and the release notes for 264
Anna Zaks [Wed, 9 May 2012 17:57:16 +0000 (17:57 +0000)]
[analyzer]Extend the available checks list and the release notes for 264

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

12 years agoIgnore a "generic" return value from getHostCPUName. <rdar://problem/11314502>
Bob Wilson [Wed, 9 May 2012 17:53:10 +0000 (17:53 +0000)]
Ignore a "generic" return value from getHostCPUName.  <rdar://problem/11314502>

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

12 years ago[libclang] Add a test for objc boxed expressions.
Argyrios Kyrtzidis [Wed, 9 May 2012 17:46:47 +0000 (17:46 +0000)]
[libclang] Add a test for objc boxed expressions.

rdar://11407754

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

12 years ago[analyzer] Simplify r156446, as per Ted's review.
Anna Zaks [Wed, 9 May 2012 17:23:15 +0000 (17:23 +0000)]
[analyzer] Simplify r156446, as per Ted's review.

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

12 years ago[analyzer] Allow pointers to escape through selector callbacks.
Anna Zaks [Wed, 9 May 2012 17:23:11 +0000 (17:23 +0000)]
[analyzer] Allow pointers to escape through selector callbacks.

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

12 years agoRemove this test again which fails the build-bot for reasons yet
Fariborz Jahanian [Wed, 9 May 2012 17:18:19 +0000 (17:18 +0000)]
Remove this test again which fails the build-bot for reasons yet
unknown to me.

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

12 years agoDeclare abstract class ArgumentsAdjuster. This abstract interface describes
Simon Atanasyan [Wed, 9 May 2012 16:18:30 +0000 (16:18 +0000)]
Declare abstract class ArgumentsAdjuster. This abstract interface describes
a command line argument adjuster, which is responsible for command line
arguments modification before the arguments are used to run a frontend action.

Define class ClangSyntaxOnlyAdjuster implements ArgumentsAdjuster interface.
This class converts input command line arguments to the "syntax check only"
variant.

Reviewed by Manuel Klimek.

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

12 years agoRe-add test for // rdar://11374235
Fariborz Jahanian [Wed, 9 May 2012 16:15:46 +0000 (16:15 +0000)]
Re-add test for // rdar://11374235

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

12 years ago[AST/libclang] Speed up clang_getOverriddenCursors() considerably by reserving a bit
Argyrios Kyrtzidis [Wed, 9 May 2012 16:12:57 +0000 (16:12 +0000)]
[AST/libclang] Speed up clang_getOverriddenCursors() considerably by reserving a bit
in ObjCMethodDecl to indicate whether the method does not override any other method,
which is the majority of cases.

That way we can avoid unnecessary work doing lookups, especially when PCH is involved.

rdar://11360082

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

12 years agoupdate calls to objectsize intrinsic to match LLVM r156473
Nuno Lopes [Wed, 9 May 2012 15:53:34 +0000 (15:53 +0000)]
update calls to objectsize intrinsic to match LLVM r156473
add a test for -fbounds-checking code generation

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

12 years agoRecover properly if a class member declaration starts with a scope specifier
Richard Smith [Wed, 9 May 2012 08:23:23 +0000 (08:23 +0000)]
Recover properly if a class member declaration starts with a scope specifier
or template-id which can't be parsed.

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

12 years agoFix Engrish.
Ted Kremenek [Wed, 9 May 2012 06:29:38 +0000 (06:29 +0000)]
Fix Engrish.

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

12 years agoTeach IsTailPaddedMemberArray() (used by -Warray-bounds) that a FieldDecl may have...
Ted Kremenek [Wed, 9 May 2012 05:35:08 +0000 (05:35 +0000)]
Teach IsTailPaddedMemberArray() (used by -Warray-bounds) that a FieldDecl may have a Typedef type, and not always a ConstantArrayType.

Fixes <rdar://problem/11387038>.

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

12 years agoA little tweak to the SFINAE condition reporting. Don't say:
Richard Smith [Wed, 9 May 2012 05:17:00 +0000 (05:17 +0000)]
A little tweak to the SFINAE condition reporting. Don't say:

  candidate template ignored: substitution failed [with T = int]: no type named 'type' in 'std::enable_if<false, void>'

Instead, just say:

  candidate template ignored: disabled by 'enable_if' [with T = int]

... and point at the enable_if condition which (we assume) failed.

This is applied to all cases where the user writes 'typename enable_if<...>::type' (optionally prefixed with a nested name specifier), and 'enable_if<...>' names a complete class type which does not have a member named 'type', and this results in a candidate function being ignored in a SFINAE context. Thus it catches 'std::enable_if', 'std::__1::enable_if', 'boost::enable_if' and 'llvm::enable_if'.

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

12 years agoFix typo.
Ted Kremenek [Wed, 9 May 2012 04:35:15 +0000 (04:35 +0000)]
Fix typo.

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

12 years agoRemove thid test for now.
Fariborz Jahanian [Wed, 9 May 2012 00:27:52 +0000 (00:27 +0000)]
Remove thid test for now.

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

12 years agoUpdate the SelfReferenceChecker. Refactored some of the visitor methods.
Richard Trieu [Wed, 9 May 2012 00:21:34 +0000 (00:21 +0000)]
Update the SelfReferenceChecker.  Refactored some of the visitor methods.
Added support for conditional operators and tightened the exclusion of the
unary operator from all operators to only the address of operator.

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

12 years agoUpdate checker build.
Ted Kremenek [Wed, 9 May 2012 00:08:47 +0000 (00:08 +0000)]
Update checker build.

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

12 years agoModern objective-c translation. Translating default
Fariborz Jahanian [Tue, 8 May 2012 23:54:35 +0000 (23:54 +0000)]
Modern objective-c translation. Translating default
synthesis of property getter/setters. // rdar://11374235

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

12 years ago[analyzer] We currently do not fully support CompoundLiterals in
Anna Zaks [Tue, 8 May 2012 23:40:38 +0000 (23:40 +0000)]
[analyzer] We currently do not fully support CompoundLiterals in
RegionStore, so be explicit about it and generate UnknownVal().

This is a hack to ensure we never produce undefined values for a value
coming from a compound value. (The undefined values can lead to
false positives.)

radar://10127782

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

12 years agoadd -fbounds-checking option.
Nuno Lopes [Tue, 8 May 2012 22:10:46 +0000 (22:10 +0000)]
add -fbounds-checking option.
When enabled, clang generates bounds checks for array and pointers dereferences. Work to follow in LLVM's backend.

OK'ed by Chad; thanks for the review.

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

12 years agoHaving RegionStore lower field bindings to raw offsets, just like ElementRegions...
Ted Kremenek [Tue, 8 May 2012 21:49:54 +0000 (21:49 +0000)]
Having RegionStore lower field bindings to raw offsets, just like ElementRegions.  This is a bit
disruptive, but it allows RegionStore to better "see" through casts that reinterpret arrays of values
as structs.  Fixes <rdar://problem/11405978>.

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

12 years agoWhen creating lazy bindings in RegionStore, propagate existing lazy bindings instead...
Ted Kremenek [Tue, 8 May 2012 21:49:51 +0000 (21:49 +0000)]
When creating lazy bindings in RegionStore, propagate existing lazy bindings instead of creating new ones.
This is a functionality optimization.

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

12 years agoInclude address of Store in graphviz output of ExplodedGraph.
Ted Kremenek [Tue, 8 May 2012 21:49:47 +0000 (21:49 +0000)]
Include address of Store in graphviz output of ExplodedGraph.

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

12 years agoBind cleanups after doing l2r conversion on the operand of a
John McCall [Tue, 8 May 2012 21:41:25 +0000 (21:41 +0000)]
Bind cleanups after doing l2r conversion on the operand of a
@throw expression;  l2r conversion can introduce new cleanups
in certain cases, like when the expression is an ObjC property
reference of retainable type in ARC.

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

12 years ago[analyzer] SelfInit: Stop tracking self if it's assigned a value we
Anna Zaks [Tue, 8 May 2012 21:19:21 +0000 (21:19 +0000)]
[analyzer] SelfInit: Stop tracking self if it's assigned a value we
don't reason about.

Self is just like a local variable in init methods, so it can be
assigned anything like result of static functions, other methods ... So
to suppress false positives that result in such cases, stop tracking the
checker-specific state after self is being assigned to (unless the
value is't being assigned to is either self or conforms to our rules).

This change does not invalidate any existing regression tests.

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

12 years agomodern objc translation. objc_getClass() and objc_getMetaClass()
Fariborz Jahanian [Tue, 8 May 2012 20:55:55 +0000 (20:55 +0000)]
modern objc translation.  objc_getClass() and objc_getMetaClass()
prototypes should both return  `struct objc_class *`.
// rdar://11375495

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

12 years agoThe address of a vla is actually complex and requires a dereference.
Eric Christopher [Tue, 8 May 2012 18:56:47 +0000 (18:56 +0000)]
The address of a vla is actually complex and requires a dereference.

Part of rdar://11352000

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

12 years agoWhitespace.
Eric Christopher [Tue, 8 May 2012 18:56:42 +0000 (18:56 +0000)]
Whitespace.

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

12 years agoFix fmin*/fmax* library builtin signatures.
Douglas Gregor [Tue, 8 May 2012 18:29:52 +0000 (18:29 +0000)]
Fix fmin*/fmax* library builtin signatures.

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

12 years agoFixes a typo. note_xxx not not_xxx.
Fariborz Jahanian [Tue, 8 May 2012 18:03:39 +0000 (18:03 +0000)]
Fixes a typo. note_xxx not not_xxx.

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

12 years agoMake -Wformat accept printf("%hhx", c); with -funsigned-char
Hans Wennborg [Tue, 8 May 2012 17:21:31 +0000 (17:21 +0000)]
Make -Wformat accept printf("%hhx", c); with -funsigned-char

For "%hhx", printf expects an unsigned char. This makes Clang
accept a 'char' argument for that also when using -funsigned-char.

This fixes PR12761.

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

12 years ago[clang.py] Remove trailing whitespace from recent commits
Gregory Szorc [Tue, 8 May 2012 06:01:34 +0000 (06:01 +0000)]
[clang.py] Remove trailing whitespace from recent commits

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

12 years ago[clang.py] TranslationUnit API improvements
Gregory Szorc [Tue, 8 May 2012 05:56:38 +0000 (05:56 +0000)]
[clang.py] TranslationUnit API improvements

* TranslationUnit reading and parsing now implemented as
  TranslationUnit.from_ast() and TranslationUnit.from_source().
* Index.parse() and Index.read() implemented through above.
* Index.parse() and Index.read() now raise a TanslationUnitLoadException
  instead of returning None if a TranslationUnit could not be
  instantiated. This is backwards incompatible.
* Ability to save TranslationUnits via TranslationUnit.save().
* TranslationUnit now holds onto Index instance that created. This means
  the Index can't be GC'd until the TranslationUnit is itself GC'd,
  making memory management thoughtless.
* Don't use [] as a default argument value, as the initial value used is
  reused for the duration of the program.

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

12 years agoTeach the analyzer about CXXScaleValueInitExpr.
Ted Kremenek [Tue, 8 May 2012 05:13:40 +0000 (05:13 +0000)]
Teach the analyzer about CXXScaleValueInitExpr.

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

12 years agoClean up SemaDeclAttr for high-warnings build.
Jordy Rose [Tue, 8 May 2012 03:27:22 +0000 (03:27 +0000)]
Clean up SemaDeclAttr for high-warnings build.

Includes a real potential initialization problem.

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

12 years ago[analyzer] BasicConstraintManager: drop NE-constraints once we have a value.
Jordy Rose [Tue, 8 May 2012 03:27:20 +0000 (03:27 +0000)]
[analyzer] BasicConstraintManager: drop NE-constraints once we have a value.

This could conceivably cut down on state proliferation, although we don't
use BasicConstraintManager by default anymore. No functionality change.

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

12 years ago[analyzer] Rework both constraint managers to handle mixed-type comparisons.
Jordy Rose [Tue, 8 May 2012 03:27:16 +0000 (03:27 +0000)]
[analyzer] Rework both constraint managers to handle mixed-type comparisons.

This involves keeping track of three separate types: the symbol type, the
adjustment type, and the comparison type. For example, in "$x + 5 > 0ULL",
if the type of $x is 'signed char', the adjustment type is 'int' and the
comparison type is 'unsigned long long'. Most of the time these three types
will be the same, but we should still do the right thing when the
comparison value is out of range, and wraparound should be calculated in
the adjustment type.

This also re-disables an out-of-bounds test; we were extracting the symbol
from non-additive SymIntExprs, but then throwing away the integer.

Sorry for the large patch; both the basic and range constraint managers needed
to be updated together, since they share code in SimpleConstraintManager.

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

12 years ago[analyzer] Add an abstraction for the bit width and signedness of an APSInt. No funct...
Jordy Rose [Tue, 8 May 2012 03:26:58 +0000 (03:26 +0000)]
[analyzer] Add an abstraction for the bit width and signedness of an APSInt. No functionality change.

There are more parts of the analyzer that could use the convenience of APSIntType, particularly the constraint engine, but that needs a fair amount of rewriting to handle mixed-type constraints anyway.

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

12 years agohopefully unbreak some buildbots
Nuno Lopes [Tue, 8 May 2012 01:54:53 +0000 (01:54 +0000)]
hopefully unbreak some buildbots

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

12 years ago[libclang] Map 'id'/'Class'/'SEL' to the corresponding CXType kinds.
Argyrios Kyrtzidis [Tue, 8 May 2012 01:22:12 +0000 (01:22 +0000)]
[libclang] Map 'id'/'Class'/'SEL' to the corresponding CXType kinds.

rdar://11357807

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

12 years agoRobustify test
Douglas Gregor [Tue, 8 May 2012 00:29:04 +0000 (00:29 +0000)]
Robustify test

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

12 years agoAdd missing 'y'.
Rafael Espindola [Tue, 8 May 2012 00:28:39 +0000 (00:28 +0000)]
Add missing 'y'.

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

12 years agoIntroduce a new libclang API to determine the platform availability of
Douglas Gregor [Tue, 8 May 2012 00:14:45 +0000 (00:14 +0000)]
Introduce a new libclang API to determine the platform availability of
a given entity, so that we can tell when the entity was
introduced/deprecated/obsoleted on each platform for which we have an
annotation. Addresses <rdar://problem/11365715>.

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

12 years agoTeach the static analyzer that NSLog() and friends do not hold on to object reference...
Ted Kremenek [Tue, 8 May 2012 00:12:09 +0000 (00:12 +0000)]
Teach the static analyzer that NSLog() and friends do not hold on to object references (thus extending their lifetime).

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

12 years agoProcess attributes in the order they appear in the source code. This make clang
Rafael Espindola [Mon, 7 May 2012 23:58:18 +0000 (23:58 +0000)]
Process attributes in the order they appear in the source code. This make clang
match gcc behavior for two conflicting visibilities in the same decl. It also
makes handling of dllimport/dllexport more natural.

As a bonus we now warn on the dllimport in

void __attribute__((dllimport)) foo13();
void __attribute__((dllexport)) foo13();

as does gcc.

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

12 years ago[analyzer]Turn on MallocSizeOfChecker by default; shorten the diagnostic
Anna Zaks [Mon, 7 May 2012 23:30:29 +0000 (23:30 +0000)]
[analyzer]Turn on MallocSizeOfChecker by default; shorten the diagnostic

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

12 years ago[libclang] Actually commit the changes to make libclang's RecursiveASTVisitor
Argyrios Kyrtzidis [Mon, 7 May 2012 23:23:03 +0000 (23:23 +0000)]
[libclang] Actually commit the changes to make libclang's RecursiveASTVisitor
data-recursive for statements.

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

12 years ago[libclang] Put the RecursiveASTVisitor in libclang in a cxindex namespace.
Argyrios Kyrtzidis [Mon, 7 May 2012 22:22:58 +0000 (22:22 +0000)]
[libclang] Put the RecursiveASTVisitor in libclang in a cxindex namespace.

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

12 years agoUn-revert r156142, "[libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr".
Argyrios Kyrtzidis [Mon, 7 May 2012 22:16:49 +0000 (22:16 +0000)]
Un-revert r156142, "[libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr".

It was reverted on r156253.

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

12 years ago[libclang] Use a copy of the data-recursive RecursiveASTVisitor inside libclang.
Argyrios Kyrtzidis [Mon, 7 May 2012 22:16:46 +0000 (22:16 +0000)]
[libclang] Use a copy of the data-recursive RecursiveASTVisitor inside libclang.

This is temporary until we settle on how to make the main RecursiveASTVisitor safe.
There are some modifications on the original version, to avoid extreme memory usage
when compiling for release.

rdar://11179167

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

12 years agoRemove the 'intrin.h' builtin header file and its tests for now.
Chandler Carruth [Mon, 7 May 2012 20:46:58 +0000 (20:46 +0000)]
Remove the 'intrin.h' builtin header file and its tests for now.

After discussion with several people, including Doug Gregor, we've
decided to change our approach here. If you have questions about this
header file, the commit removing it, etc., please reach out to me
off-list.

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

12 years agomake this test a little more useful. I'll add more tests for bound checking once...
Nuno Lopes [Mon, 7 May 2012 20:23:03 +0000 (20:23 +0000)]
make this test a little more useful. I'll add more tests for bound checking once -fbounds-checking patch gets in

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

12 years ago[analyzer] Fix a crash in triggered by OSAtomicChecker.
Anna Zaks [Mon, 7 May 2012 19:40:49 +0000 (19:40 +0000)]
[analyzer] Fix a crash in triggered by OSAtomicChecker.

SValBuilder should return an UnknownVal() when comparison of int and ptr
fails. Previous to this commit, it went on assuming that we are dealing
with pointer arithmetic.

PR12509, radar://11390991

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

12 years ago[analyzer] Fixup for r155244: PurgeDeadSymbols should subclass StmtPoint
Anna Zaks [Mon, 7 May 2012 18:40:26 +0000 (18:40 +0000)]
[analyzer] Fixup for r155244: PurgeDeadSymbols should subclass StmtPoint

To solve the inconsistency pointed out in Erik's review, refactor class
hierarchy of ProgramPoints so that PreStmtPurgeDeadSymbols and
PostStmtPurgeDeadSymbols both subclass from StmtPoint instead of
PostStmt.

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

12 years agoremove code to add bound checks for simple array accesses, since those are already...
Nuno Lopes [Mon, 7 May 2012 17:57:00 +0000 (17:57 +0000)]
remove code to add bound checks for simple array accesses, since those are already covered by the check with the objectsize builtin
remove the comparison of objectsize with -1. since it's an unsigned comparison, it will always succeed if objectsize returns -1, which is enough to have the check removed

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

12 years ago[analyzer]Fixup r156215: use StopTracking summary instead of ScratchArgs
Anna Zaks [Mon, 7 May 2012 17:47:09 +0000 (17:47 +0000)]
[analyzer]Fixup r156215: use StopTracking summary instead of ScratchArgs

As per Jordy's and Ted's comment, use the default StopTracking summary
instead of adding all arguments to ScratchArs.

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

12 years agoRevert r156097, which appears to be causing some breakage.
Douglas Gregor [Mon, 7 May 2012 14:17:47 +0000 (14:17 +0000)]
Revert r156097, which appears to be causing some breakage.

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

12 years agoFix includes for unices that don't have chdir declared transitively.
Manuel Klimek [Mon, 7 May 2012 10:02:55 +0000 (10:02 +0000)]
Fix includes for unices that don't have chdir declared transitively.

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

12 years agoIncludes direct.h for windows compilation.
Manuel Klimek [Mon, 7 May 2012 09:45:46 +0000 (09:45 +0000)]
Includes direct.h for windows compilation.

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

12 years agoFixes resolution of relative paths when running clang tools.
Manuel Klimek [Mon, 7 May 2012 09:17:48 +0000 (09:17 +0000)]
Fixes resolution of relative paths when running clang tools.

The chdir is not the perfect fix, as it is thread hostile. The
real fix will be to make -working-dir work correctly, which will
take time to implement. Before that, the tooling library cannot
be used concurrently.

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

12 years agoFixed UserDefinedLiteral source locations.
Abramo Bagnara [Mon, 7 May 2012 09:06:16 +0000 (09:06 +0000)]
Fixed UserDefinedLiteral source locations.

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

12 years agoWhen we suppress an error due to SFINAE, stash the diagnostic away with the
Richard Smith [Mon, 7 May 2012 09:03:25 +0000 (09:03 +0000)]
When we suppress an error due to SFINAE, stash the diagnostic away with the
overload candidate, and include its message in any subsequent 'candidate not
viable due to substitution failure' note we may produce.

To keep the note small (since the 'overload resolution failed' diagnostics are
often already very verbose), the text of the SFINAE diagnostic is included as
part of the text of the note, and any notes which were attached to it are
discarded.

There happened to be spare space in OverloadCandidate into which a
PartialDiagnosticAt could be squeezed, and this patch goes to lengths to avoid
unnecessary PartialDiagnostic copies, resulting in no slowdown that I could
measure. (Removal in passing of some PartialDiagnostic copies has resulted in a
slightly smaller clang binary overall.) Even on a torture test, I was unable to
measure a memory increase of above 0.2%.

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

12 years agoConvert AVX non-temporal store builtins to LLVM-native IR. This was previously done...
Craig Topper [Mon, 7 May 2012 06:25:45 +0000 (06:25 +0000)]
Convert AVX non-temporal store builtins to LLVM-native IR. This was previously done for SSE builtins.

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

12 years agoChange how we suppress access control in explicit instantiations
John McCall [Mon, 7 May 2012 06:16:58 +0000 (06:16 +0000)]
Change how we suppress access control in explicit instantiations
so that we actually accumulate all the delayed diagnostics.  Do
this so that we can restore those diagnostics to good standing
if it turns out that we were wrong to suppress, e.g. if the
tag specifier is actually an elaborated type specifier and not
a declaration.

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

12 years agoThere is no reason for these methods to be out-of-line.
John McCall [Mon, 7 May 2012 06:16:49 +0000 (06:16 +0000)]
There is no reason for these methods to be out-of-line.

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

12 years agoRefactor DelayedDiagnostics so that it keeps diagnostics in
John McCall [Mon, 7 May 2012 06:16:41 +0000 (06:16 +0000)]
Refactor DelayedDiagnostics so that it keeps diagnostics in
separate pools owned by the RAII objects that keep pushing
decl state.  This gives us quite a bit more flexibility.

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

12 years ago- Adding lexical_parent and semantic_parent properties to clang.cindex.Cursor
Manuel Klimek [Mon, 7 May 2012 05:56:03 +0000 (05:56 +0000)]
- Adding lexical_parent and semantic_parent properties to clang.cindex.Cursor
- Two new tests (one for each property), require libclang built from r155858 or later to pass
- New test utility function (get_cursors) that gets all the nodes with a specific spelling.

Patch by Evan Pipho.

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

12 years agoUpdating the test case based on previous patch
Aaron Ballman [Mon, 7 May 2012 01:10:33 +0000 (01:10 +0000)]
Updating the test case based on previous patch

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

12 years agoA union can have a constexpr defaulted default constructor, if it has an
Richard Smith [Mon, 7 May 2012 01:07:30 +0000 (01:07 +0000)]
A union can have a constexpr defaulted default constructor, if it has an
in-class initializer for one of its fields. Value-initialization of such
a type should use the in-class initializer!

The former was just a bug, the latter is a (reported) standard defect.

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

12 years agoRemove variable made unused by r156270.
David Blaikie [Mon, 7 May 2012 00:53:51 +0000 (00:53 +0000)]
Remove variable made unused by r156270.

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

12 years agoDetecting illegal instantiations of abstract types when using a function-style cast...
Aaron Ballman [Mon, 7 May 2012 00:02:00 +0000 (00:02 +0000)]
Detecting illegal instantiations of abstract types when using a function-style cast.  Fixed PR12658.

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

12 years ago[analyzer] Reduce parallel code paths in SimpleSValBuilder::evalBinOpNN, and handle...
Jordy Rose [Sun, 6 May 2012 23:40:02 +0000 (23:40 +0000)]
[analyzer] Reduce parallel code paths in SimpleSValBuilder::evalBinOpNN, and handle mixed-type operations more generally.

The logical change is that the integers in SymIntExprs may not have the same type as the symbols they are paired with. This was already the case with taint-propagation expressions created by SValBuilder::makeSymExprValNN, but I think those integers may never have been used. SimpleSValBuilder should be able to handle mixed-integer-type SymIntExprs fine now, though, and the constraint managers were already being defensive (though not entirely correct). All existing tests pass.

The logic in evalBinOpNN has been simplified so that conversion is done as late as possible. As a result, most of the switch cases have been reduced to do the minimal amount of work, delegating to another case when they can by substituting ConcreteInts and (as before) reversing the left and right arguments when useful.

Comparisons require special handling in two places (building SymIntExprs and evaluating constant-constant operations) because we don't /know/ the best type for comparing the two values. I've approximated the rules in Sema [C99 6.3.1.8]  but it'd be nice to refactor Sema's actual algorithm into ASTContext.

This is also groundwork for handling mixed-type constraints better than we do now.

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

12 years agoSplit mergeAvailabilityAttr out of handleAvailabilityAttr. This is important
Rafael Espindola [Sun, 6 May 2012 19:56:25 +0000 (19:56 +0000)]
Split mergeAvailabilityAttr out of handleAvailabilityAttr. This is important
for having a uniform logic for adding attributes to a decl. This in turn
is needed to fix the FIXME:

  // FIXME: This needs to happen before we merge declarations. Then,
  // let attribute merging cope with attribute conflicts.
  ProcessDeclAttributes(S, NewFD, D,
                        /*NonInheritable=*/false, /*Inheritable=*/true);

The idea is that mergeAvailabilityAttr will become a method. Once attributes
are processed before merging, it will be called from handleAvailabilityAttr to
handle multiple attributes in one decl:

void f(int) __attribute__((availability(ios,deprecated=3.0),
                           availability(ios,introduced=2.0)));

and from SemaDecl.cpp to handle multiple decls:

void f(int) __attribute__((availability(ios,deprecated=3.0)));
void f(int) __attribute__((availability(ios,introduced=2.0)));

As a bonus, use the new structure to diagnose incompatible availability
attributes added to different decls (see included testcases).

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

12 years agoPut the availability warnings in a group.
Rafael Espindola [Sun, 6 May 2012 16:49:20 +0000 (16:49 +0000)]
Put the availability warnings in a group.

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

12 years agoSimple typo fix (syntex to syntax). Fixes PR12735
Aaron Ballman [Sun, 6 May 2012 16:07:45 +0000 (16:07 +0000)]
Simple typo fix (syntex to syntax).  Fixes PR12735

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