]> granicus.if.org Git - clang/log
clang
12 years ago[analyzer] Fixup 162863.
Anna Zaks [Wed, 29 Aug 2012 23:23:39 +0000 (23:23 +0000)]
[analyzer] Fixup 162863.

Thanks Jordan.

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

12 years agoFix serious regression introduced in r157780 where __attribute__((NSObject))
Ted Kremenek [Wed, 29 Aug 2012 22:54:47 +0000 (22:54 +0000)]
Fix serious regression introduced in r157780 where __attribute__((NSObject))
could not be attached to a CFTypeRef.

Fixes <rdar://problem/12197822>

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

12 years agoFix PR reference in test.
Eli Friedman [Wed, 29 Aug 2012 21:27:50 +0000 (21:27 +0000)]
Fix PR reference in test.

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

12 years agoFix run-line for test.
Eli Friedman [Wed, 29 Aug 2012 21:25:58 +0000 (21:25 +0000)]
Fix run-line for test.

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

12 years ago[analyzer]Fix typo, unbreak static analyzer BuildBot (at least
Anna Zaks [Wed, 29 Aug 2012 21:22:40 +0000 (21:22 +0000)]
[analyzer]Fix typo, unbreak static analyzer BuildBot (at least
partially).

(Addresses a regression from r162790.)

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

12 years ago[analyzer] Improved diagnostic pruning for calls initializing values.
Anna Zaks [Wed, 29 Aug 2012 21:22:37 +0000 (21:22 +0000)]
[analyzer] Improved diagnostic pruning for calls initializing values.

This heuristic addresses the case when a pointer (or ref) is passed
to a function, which initializes the variable (or sets it to something
other than '0'). On the branch where the inlined function does not
set the value, we report use of undefined value (or NULL pointer
dereference). The access happens in the caller and the path
through the callee would get pruned away with regular path pruning. To
solve this issue, we previously disabled diagnostic pruning completely
on undefined and null pointer dereference checks, which entailed very
verbose diagnostics in most cases. Furthermore, not all of the
undef value checks had the diagnostic pruning disabled.

This patch implements the following heuristic: if we pass a pointer (or
ref) to the region (on which the error is reported) into a function and
it's value is either undef or 'NULL' (and is a pointer), do not prune
the function.

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

12 years agoMake alignment computation for pointer values for builtins handle
Eli Friedman [Wed, 29 Aug 2012 21:21:11 +0000 (21:21 +0000)]
Make alignment computation for pointer values for builtins handle
non-pointer types with a pointer representation correctly. PR13660.

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

12 years agoDefine __mips64 / __mips64__ macros for MIPS 64-bit targets.
Simon Atanasyan [Wed, 29 Aug 2012 20:50:11 +0000 (20:50 +0000)]
Define __mips64 / __mips64__ macros for MIPS 64-bit targets.
The patch suggested by Brad Smith.

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

12 years agoUse getTargetDefines() virtual function in MipsTargetInfoBase successors
Simon Atanasyan [Wed, 29 Aug 2012 19:59:32 +0000 (19:59 +0000)]
Use getTargetDefines() virtual function in MipsTargetInfoBase successors
to define all macros for MIPS targets. Remove redundant virtual function
getArchDefines(). Two virtual functions for this task are really too much.

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

12 years agoFactor out MIPS macro definitions common for all MIPS targets.
Simon Atanasyan [Wed, 29 Aug 2012 19:14:58 +0000 (19:14 +0000)]
Factor out MIPS macro definitions common for all MIPS targets.

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

12 years agoMove TLS check from LValueExprEvaluator::VisitVarDecl to
Hans Wennborg [Wed, 29 Aug 2012 18:27:29 +0000 (18:27 +0000)]
Move TLS check from LValueExprEvaluator::VisitVarDecl to
CheckLValueConstantExpression.

Richard pointed out that using the address of a TLS variable is ok in a
core C++11 constant expression, as long as it isn't part of the eventual
result of constant expression evaluation. Having the check in
CheckLValueConstantExpression accomplishes this.

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

12 years agoobjective-C: make -Widiomatic-parentheses work
Fariborz Jahanian [Wed, 29 Aug 2012 17:17:11 +0000 (17:17 +0000)]
objective-C: make -Widiomatic-parentheses work
when assignment expression in conditional invloves
property reference. // rdar://11066598

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

12 years agoFixed a problem with #pragma push_macro/pop_macro implementation.
Alexander Kornienko [Wed, 29 Aug 2012 16:56:24 +0000 (16:56 +0000)]
Fixed a problem with #pragma push_macro/pop_macro implementation.

Summary:
The problem was with the following sequence:
  #pragma push_macro("long")
  #undef long
  #pragma pop_macro("long")
in case when "long" didn't represent a macro.
Fixed crash and removed code duplication for #undef/pop_macro case. Added regression tests.

Reviewers: doug.gregor, klimek

Reviewed By: doug.gregor

CC: cfe-commits, chapuni
Differential Revision: http://llvm-reviews.chandlerc.com/D31

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

12 years agoDefine _MIPS_ARCH and _MIPS_ARCH_<cpu name> macros for MIPS targets.
Simon Atanasyan [Wed, 29 Aug 2012 15:17:29 +0000 (15:17 +0000)]
Define _MIPS_ARCH and _MIPS_ARCH_<cpu name> macros for MIPS targets.
The patch suggested by Logan Chien.

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

12 years agoReversing the logic since C99 mode is actually not an extension. Also, changing...
Aaron Ballman [Wed, 29 Aug 2012 12:35:14 +0000 (12:35 +0000)]
Reversing the logic since C99 mode is actually not an extension.  Also, changing the group to the singular to match the diagnostic better.

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

12 years agoFix r162835 as per Richard's comments.
Hans Wennborg [Wed, 29 Aug 2012 09:17:34 +0000 (09:17 +0000)]
Fix r162835 as per Richard's comments.

VisitVarDecl should return Error(E), and we should test that the address
of a TLS var can't be used as a constexpr.

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

12 years agoMove the test for PR13720 from Sema/init.c to Sema/thread-specifier.c.
Hans Wennborg [Wed, 29 Aug 2012 09:04:10 +0000 (09:04 +0000)]
Move the test for PR13720 from Sema/init.c to Sema/thread-specifier.c.

Can't use __thread in init.c because it doesn't have a triple.

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

12 years agoThe address of a TLS var is not compile-time constant (PR13720)
Hans Wennborg [Wed, 29 Aug 2012 08:44:49 +0000 (08:44 +0000)]
The address of a TLS var is not compile-time constant (PR13720)

This makes Clang produce an error for code such as:

  __thread int x;
  int *p = &x;

The lvalue of a thread-local variable cannot be evaluated at compile
time.

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

12 years agoClarify the point at which ARC destroys ivars vis-à-vis
John McCall [Wed, 29 Aug 2012 08:32:30 +0000 (08:32 +0000)]
Clarify the point at which ARC destroys ivars vis-à-vis
[super dealloc].  rdar://problem/11141872

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

12 years agoUse double instead of single quote to expand .
Ted Kremenek [Wed, 29 Aug 2012 07:22:34 +0000 (07:22 +0000)]
Use double instead of single quote to expand .

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

12 years agoAdd new -cc1 driver option -analyzer-config, which allows one to specify
Ted Kremenek [Wed, 29 Aug 2012 05:55:00 +0000 (05:55 +0000)]
Add new -cc1 driver option -analyzer-config, which allows one to specify
a comma separated collection of key:value pairs (which are strings).  This
allows a general way to provide analyzer configuration data from the command line.

No clients yet.

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

12 years ago[analyzer] C++ objects returned on the stack may be wrapped in ExprWithCleanups.
Jordan Rose [Wed, 29 Aug 2012 01:11:59 +0000 (01:11 +0000)]
[analyzer] C++ objects returned on the stack may be wrapped in ExprWithCleanups.

In C++, objects being returned on the stack are actually copy-constructed into
the return value. That means that when a temporary is returned, it still has
to be destroyed, i.e. the returned expression will be wrapped in an
ExprWithCleanups node. Our "returning stack memory" checker needs to look
through this node to see if we really are returning an object by value.

PR13722

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

12 years agoKeep history of macro definitions and #undefs
Alexander Kornienko [Wed, 29 Aug 2012 00:20:03 +0000 (00:20 +0000)]
Keep history of macro definitions and #undefs

Summary:
Summary: Keep history of macro definitions and #undefs with corresponding source locations, so that we can later find out all macros active in a specified source location. We don't save the history in PCH (no need currently). Memory overhead is about sizeof(void*)*3*<number of macro definitions and #undefs>+<in-memory size of all #undef'd macros>

I've run a test on a file composed of 109 .h files from boost 1.49 on x86-64 linux.
Stats before this patch:
*** Preprocessor Stats:
73222 directives found:
  19171 #define.
  4345 #undef.
  #include/#include_next/#import:
    5233 source files entered.
    27 max include stack depth
  19210 #if/#ifndef/#ifdef.
  2384 #else/#elif.
  6891 #endif.
  408 #pragma.
14466 #if/#ifndef#ifdef regions skipped
80023/451669/1270 obj/fn/builtin macros expanded, 85724 on the fast path.
127145 token paste (##) operations performed, 11008 on the fast path.

Preprocessor Memory: 5874615B total
  BumpPtr: 4399104
  Macro Expanded Tokens: 417768
  Predefines Buffer: 8135
  Macros: 1048576
  #pragma push_macro Info: 0
  Poison Reasons: 1024
  Comment Handlers: 8

Stats with this patch:
...
Preprocessor Memory: 7541687B total
  BumpPtr: 6066176
  Macro Expanded Tokens: 417768
  Predefines Buffer: 8135
  Macros: 1048576
  #pragma push_macro Info: 0
  Poison Reasons: 1024
  Comment Handlers: 8

In my test increase in memory usage is about 1.7Mb, which is ~28% of initial preprocessor's memory usage and about 0.8% of clang's total VMM allocation.

As for CPU overhead, it should only be noticeable when iterating over all macros, and should mostly consist of couple extra dereferences and one comparison per macro + skipping of #undef'd macros. It's less trivial to measure, though, as the preprocessor consumes a very small fraction of compilation time.

Reviewers: doug.gregor, klimek, rsmith, djasper

Reviewed By: doug.gregor

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

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

12 years agoModifes BoundNodes to store void* and allow casting them
Manuel Klimek [Tue, 28 Aug 2012 23:26:39 +0000 (23:26 +0000)]
Modifes BoundNodes to store void* and allow casting them
into the correct types when pulling them out in the result
callback in a type safe way.

This is also the base change for multiple things that will
allow handling things more generally and thus supporting more
of the AST, especially handling Type nodes.

Patch contributed by Michael Diamond.

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

12 years agoobjective-C arc: ns_returns_retained is a type attribute in ARC,
Fariborz Jahanian [Tue, 28 Aug 2012 22:26:21 +0000 (22:26 +0000)]
objective-C arc: ns_returns_retained is a type attribute in ARC,
and when used in property type declaration, is handled as type
attribute. Do not issue the warning when declaraing the property.
// rdar://12173491

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

12 years agoFix test case for Release builds.
Chad Rosier [Tue, 28 Aug 2012 22:22:54 +0000 (22:22 +0000)]
Fix test case for Release builds.

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

12 years agoOnly add common tool options when CommonOptionsParser is used.
Alexander Kornienko [Tue, 28 Aug 2012 22:15:41 +0000 (22:15 +0000)]
Only add common tool options when CommonOptionsParser is used.

Summary: Subj.

Reviewers: chandlerc, klimek, djasper

Reviewed By: klimek

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

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

12 years agoRevert r162424 now that the scoping issue has been fixed in r162444.
Chad Rosier [Tue, 28 Aug 2012 22:08:58 +0000 (22:08 +0000)]
Revert r162424 now that the scoping issue has been fixed in r162444.

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

12 years ago[ms-inline asm] Have MSAsmStmts use the generic EmitAsmStmt codegen function.
Chad Rosier [Tue, 28 Aug 2012 21:11:24 +0000 (21:11 +0000)]
[ms-inline asm] Have MSAsmStmts use the generic EmitAsmStmt codegen function.

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

12 years agoSplitting the duplicated decl spec extension warning into two: one is an ExtWarn...
Aaron Ballman [Tue, 28 Aug 2012 20:55:40 +0000 (20:55 +0000)]
Splitting the duplicated decl spec extension warning into two: one is an ExtWarn and the other a vanilla warning.  This addresses PR13705, where const char const * wouldn't warn unless -pedantic was specified under the right conditions.

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

12 years ago[analyzer] Teach CallEventManager that CXXTemporaryObjectExpr is also a ctor.
Jordan Rose [Tue, 28 Aug 2012 20:52:21 +0000 (20:52 +0000)]
[analyzer] Teach CallEventManager that CXXTemporaryObjectExpr is also a ctor.

Specifically, CallEventManager::getCaller was looking at the call site for
an inlined call and trying to see what kind of call it was, but it only
checked for CXXConstructExprClass. (It's not using an isa<> here to avoid
doing three more checks on the the statement class.)

This caused an unreachable when we actually did inline the constructor of a
temporary object.

PR13717

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

12 years ago[analyzer] When we look for the last stmt in a function, skip implicit dtors.
Jordan Rose [Tue, 28 Aug 2012 20:52:13 +0000 (20:52 +0000)]
[analyzer] When we look for the last stmt in a function, skip implicit dtors.

When exiting a function, the analyzer looks for the last statement in the
function to see if it's a return statement (and thus bind the return value).
However, the search for "the last statement" was accepting statements that
were in implicitly-generated inlined functions (i.e. destructors). So we'd
go and get the statement from the destructor, and then say "oh look, this
function had no explicit return...guess there's no return value". And /that/
led to the value being returned being declared dead, and all our leak
checkers complaining.

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

12 years agoAutomatically use more cores when the test build uses 'make'.
Ted Kremenek [Tue, 28 Aug 2012 20:40:04 +0000 (20:40 +0000)]
Automatically use more cores when the test build uses 'make'.

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

12 years agoConsolidate helper methods and configuration logic. No functionality change.
Ted Kremenek [Tue, 28 Aug 2012 20:40:02 +0000 (20:40 +0000)]
Consolidate helper methods and configuration logic.  No functionality change.

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

12 years agoCUDA: give static storage class to __shared__ and __constant__
Peter Collingbourne [Tue, 28 Aug 2012 20:37:50 +0000 (20:37 +0000)]
CUDA: give static storage class to __shared__ and __constant__
variables without a storage class within a function, to implement
CUDA B.2.5: "__shared__ and __constant__ variables have implied static
storage [duration]."

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

12 years agoCUDA: give correct address space to globals declared in functions
Peter Collingbourne [Tue, 28 Aug 2012 20:37:10 +0000 (20:37 +0000)]
CUDA: give correct address space to globals declared in functions

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

12 years agoTidy up.
Chad Rosier [Tue, 28 Aug 2012 20:35:06 +0000 (20:35 +0000)]
Tidy up.

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

12 years ago[ms-inline asm] Have generateAsmString() return the AsmString computed by Sema.
Chad Rosier [Tue, 28 Aug 2012 20:33:49 +0000 (20:33 +0000)]
[ms-inline asm] Have generateAsmString() return the AsmString computed by Sema.
We still need to translate the string, but this at least gets us one step
closer to using the more general EmitAsmStmt() codegen function. No functional
change intended.

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

12 years ago[ms-inline asm] Add constraints to MSAsmStmt. We don't currently compute
Chad Rosier [Tue, 28 Aug 2012 20:28:20 +0000 (20:28 +0000)]
[ms-inline asm] Add constraints to MSAsmStmt.  We don't currently compute
the constraints, so in the interim we speculatively assume a 'r' constraint.
This is expected to work for most cases on x86.

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

12 years agoPass --use-analyzer to scan-build when running within the test harness.
Ted Kremenek [Tue, 28 Aug 2012 20:20:52 +0000 (20:20 +0000)]
Pass --use-analyzer to scan-build when running within the test harness.

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

12 years ago[ms-inline asm] Rename EmitGCCAsmStmt to EmitAsmStmt and have it accept
Chad Rosier [Tue, 28 Aug 2012 18:54:39 +0000 (18:54 +0000)]
[ms-inline asm] Rename EmitGCCAsmStmt to EmitAsmStmt and have it accept
AsmStmts.  This function is only used by GCCAsmStmts, however. Constraints need
to be properly computed before MSAsmStmts can use EmitAsmStmt.  No functional
change intended.

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

12 years agoexperimental.security.taint is now alpha.security.taint
Ted Kremenek [Tue, 28 Aug 2012 18:45:22 +0000 (18:45 +0000)]
experimental.security.taint is now alpha.security.taint

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

12 years ago[ms-inline asm] Use dyn_cast<> here to simplify logic.
Chad Rosier [Tue, 28 Aug 2012 18:21:14 +0000 (18:21 +0000)]
[ms-inline asm] Use dyn_cast<> here to simplify logic.

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

12 years ago[analyzer] Don't purge dead symbols at the end of calls if -analyzer-purge=none.
Jordan Rose [Tue, 28 Aug 2012 18:16:45 +0000 (18:16 +0000)]
[analyzer] Don't purge dead symbols at the end of calls if -analyzer-purge=none.

No test case since this is a debug option that we will never turn on by
default since it makes the leak checkers much less useful. (We'll only report
leaks at the end of analysis if -analyzer-purge=none.)

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

12 years agoMake test pass in Release builds, which use a different naming scheme for llvm values.
Benjamin Kramer [Tue, 28 Aug 2012 18:11:31 +0000 (18:11 +0000)]
Make test pass in Release builds, which use a different naming scheme for llvm values.

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

12 years agoMerge test case for PR13704 into exprs.c to reduce test cases
Michael Liao [Tue, 28 Aug 2012 17:46:11 +0000 (17:46 +0000)]
Merge test case for PR13704 into exprs.c to reduce test cases

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

12 years ago[ms-inline asm] Make the AsmStmt class non-virtual.
Chad Rosier [Tue, 28 Aug 2012 17:43:23 +0000 (17:43 +0000)]
[ms-inline asm] Make the AsmStmt class non-virtual.

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

12 years agoFix PR13704
Michael Liao [Tue, 28 Aug 2012 16:55:13 +0000 (16:55 +0000)]
Fix PR13704

- The increment needs to be signed value to preserve the original value when
  its data type is larger than 64-bit integer.

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

12 years agoFix passing of -analyzer-max-loop from scan-build to clang.
Ted Kremenek [Tue, 28 Aug 2012 16:48:48 +0000 (16:48 +0000)]
Fix passing of -analyzer-max-loop from scan-build to clang.

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

12 years agoWarn about suspicious implicit conversions from floating point to bool
Hans Wennborg [Tue, 28 Aug 2012 15:44:30 +0000 (15:44 +0000)]
Warn about suspicious implicit conversions from floating point to bool

This warns in two specific situations:

1) For potentially swapped function arguments, e.g.

     void foo(bool, float);
     foo(1.7, false);

2) Misplaced brackets around function call arguments, e.g.

     bool InRange = fabs(a - b < delta);

   Where the last argument in a function call is implicitly converted
   from bool to float, and the function returns a float which gets
   implicitly converted to bool.

Patch by Andreas Eckleder!

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

12 years agoCleanup FreeBSD linking and add support for -pie.
Roman Divacky [Tue, 28 Aug 2012 15:09:03 +0000 (15:09 +0000)]
Cleanup FreeBSD linking and add support for -pie.

Path by Brooks Davis, tests and fixes from me.

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

12 years agoCheck for MIPS target availability for Driver/mips-as.c test.
Simon Atanasyan [Tue, 28 Aug 2012 11:17:20 +0000 (11:17 +0000)]
Check for MIPS target availability for Driver/mips-as.c test.

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

12 years agoFix for assertion when solving unresolved templates.
Rafael Espindola [Tue, 28 Aug 2012 04:13:54 +0000 (04:13 +0000)]
Fix for assertion when solving unresolved templates.
Patch by Magee, Josh.

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

12 years agoFix a -Wdocumentation warning.
Dmitri Gribenko [Tue, 28 Aug 2012 02:49:14 +0000 (02:49 +0000)]
Fix a -Wdocumentation warning.

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

12 years agoMerging consecutive comments: be more conservative.
Dmitri Gribenko [Tue, 28 Aug 2012 01:20:53 +0000 (01:20 +0000)]
Merging consecutive comments: be more conservative.
Should fix part 2 of PR13374.

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

12 years agoFix a -Wdocumentation warning.
Dmitri Gribenko [Tue, 28 Aug 2012 01:15:46 +0000 (01:15 +0000)]
Fix a -Wdocumentation warning.

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

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