]> granicus.if.org Git - clang/log
clang
12 years agoDon't warn about anonymous struct/union in C11.
Hans Wennborg [Fri, 3 Feb 2012 15:47:04 +0000 (15:47 +0000)]
Don't warn about anonymous struct/union in C11.

Also, in C, call this a C11 extension rather than a GNU extension.

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

12 years agoImplement support for a pack expansion into a fixed-length
Douglas Gregor [Fri, 3 Feb 2012 07:34:46 +0000 (07:34 +0000)]
Implement support for a pack expansion into a fixed-length
template. Such pack expansions can easily fail at template
instantiation time, if the expanded parameter packs are of the wrong
length. Fixes <rdar://problem/10040867>, PR9021, and the example that
came up today at Going Native.

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

12 years ago[analyzer] Testing: add automated reference results reset.
Anna Zaks [Fri, 3 Feb 2012 06:35:23 +0000 (06:35 +0000)]
[analyzer] Testing: add automated reference results reset.

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

12 years agoFix -ftrap-function fallout from llvm r145714. <rdar://problem/10799325>
Bob Wilson [Fri, 3 Feb 2012 06:27:22 +0000 (06:27 +0000)]
Fix -ftrap-function fallout from llvm r145714.  <rdar://problem/10799325>

That llvm change removed the -trap-func backend option, so that using
-ftrap-function with clang would cause the backend to complain.  Fix it
by adding the trap function name to the CodeGenOptions and passing it through
to the TargetOptions.

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

12 years agoChange Lexer::makeFileCharRange() to have it accept a CharSourceRange
Argyrios Kyrtzidis [Fri, 3 Feb 2012 05:58:29 +0000 (05:58 +0000)]
Change Lexer::makeFileCharRange() to have it accept a CharSourceRange
instead of a SourceRange, and handle the case where the range is
a char (not token) range.

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

12 years agoChange the fixed array of FixitHints to a SmallVector to lift off
Argyrios Kyrtzidis [Fri, 3 Feb 2012 05:58:22 +0000 (05:58 +0000)]
Change the fixed array of FixitHints to a SmallVector to lift off
the limit on the number of fixits.

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

12 years agoMove isSentinelNullExpr() from Sema to ASTContext to make it more widely
Argyrios Kyrtzidis [Fri, 3 Feb 2012 05:58:16 +0000 (05:58 +0000)]
Move isSentinelNullExpr() from Sema to ASTContext to make it more widely
available.

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

12 years agoFurther downgrade -Warc-bridge-casts-disallowed-in-nonarc to a warning (not mapped...
Ted Kremenek [Fri, 3 Feb 2012 05:01:51 +0000 (05:01 +0000)]
Further downgrade -Warc-bridge-casts-disallowed-in-nonarc to a warning (not mapped to an error).  We can consider mapping it back to an error later.

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

12 years agoThread safety analysis:
Richard Smith [Fri, 3 Feb 2012 04:45:26 +0000 (04:45 +0000)]
Thread safety analysis:
 * When we detect that a CFG block has inconsistent lock sets, point the
   diagnostic at the location where we found the inconsistency, and point a note
   at somewhere the inconsistently-locked mutex was locked.
 * Fix the wording of the normal (non-loop, non-end-of-function) case of this
   diagnostic to not suggest that the mutex is going out of scope.
 * Fix the diagnostic emission code to keep a warning and its note together when
   sorting the diagnostics into source location order.

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

12 years agoThread safety analysis: at a CFG join point between a block terminating in a
Richard Smith [Fri, 3 Feb 2012 03:30:07 +0000 (03:30 +0000)]
Thread safety analysis: at a CFG join point between a block terminating in a
'continue' and another block, prefer the lockset from the other block, and
diagnose the 'continue' block as being the end of a loop.

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

12 years agoC++ 5.2.10p2 has a note that mentions that, subject to all other restrictions,
Chad Rosier [Fri, 3 Feb 2012 02:54:37 +0000 (02:54 +0000)]
C++ 5.2.10p2 has a note that mentions that, subject to all other restrictions,
a cast to the same type is allowed so long as it does not cast away constness.

Fix for PR11747. Patch by Aaron Ballman. Reviewed by Eli.

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

12 years agoRefactor capture in blocks to use new-style capture hooks. Start adding a bit of...
Eli Friedman [Fri, 3 Feb 2012 02:04:35 +0000 (02:04 +0000)]
Refactor capture in blocks to use new-style capture hooks.  Start adding a bit of the code for lambdas.  The only visible changes are that we use the C++11 odr-used rules to figure out when a variable is captured, and type-checking in lambdas is slightly more accurate.

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

12 years ago[frontend] Don't allow a mapping to a warning override an error/fatal mapping.
Chad Rosier [Fri, 3 Feb 2012 01:49:51 +0000 (01:49 +0000)]
[frontend] Don't allow a mapping to a warning override an error/fatal mapping.
rdar://10736625

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

12 years agoNote whether a lambda is mutable in the LambdaScopeInfo; this information will be...
Eli Friedman [Fri, 3 Feb 2012 01:39:09 +0000 (01:39 +0000)]
Note whether a lambda is mutable in the LambdaScopeInfo; this information will be necessary to handle references to captured variables.

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

12 years agoMake error about using bridge casts in non-ARC mode a warning that is default mapped...
Ted Kremenek [Fri, 3 Feb 2012 01:30:34 +0000 (01:30 +0000)]
Make error about using bridge casts in non-ARC mode a warning that is default mapped to an error.  This is to ease the transition of large apps moving from non-ARC to ARC.

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

12 years agoDo not show macro expansion in strncat warnings, which can be defined as
Anna Zaks [Fri, 3 Feb 2012 01:27:37 +0000 (01:27 +0000)]
Do not show macro expansion in strncat warnings, which can be defined as
a builtin.

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

12 years agoobjc: Issue diagnostic when receiver type is a forward class declaration and
Fariborz Jahanian [Fri, 3 Feb 2012 01:02:44 +0000 (01:02 +0000)]
objc: Issue diagnostic when receiver type is a forward class declaration and
it is treated as of 'id' type resulting in multiple method lookup.
// rdar://10686120

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

12 years agoReplace the old --with-cxx-* configure options with a single --with-gcc-toolchain
Rafael Espindola [Fri, 3 Feb 2012 01:01:20 +0000 (01:01 +0000)]
Replace the old --with-cxx-* configure options with a single --with-gcc-toolchain
that just uses the new toolchain probing logic. This fixes linking with -m32 on
64 bit systems (the /32 dir was not being added to the search).

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

12 years agoRename -dependency-graphviz to -dependencncy-dot
Douglas Gregor [Thu, 2 Feb 2012 23:45:13 +0000 (23:45 +0000)]
Rename -dependency-graphviz to -dependencncy-dot

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

12 years agoAdd some code to accurately perform odr-used marking for variables per the C++11...
Eli Friedman [Thu, 2 Feb 2012 23:15:15 +0000 (23:15 +0000)]
Add some code to accurately perform odr-used marking for variables per the C++11 rules.

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

12 years agoFurther enhance comment for property in continuation class.
Fariborz Jahanian [Thu, 2 Feb 2012 22:37:48 +0000 (22:37 +0000)]
Further enhance comment for property in continuation class.

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

12 years agounnecessary include of TargetMachine.h?
Andrew Trick [Thu, 2 Feb 2012 22:36:19 +0000 (22:36 +0000)]
unnecessary include of TargetMachine.h?

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

12 years agoInitialize the user defined conversion function to null if this is an aggregate initi...
Benjamin Kramer [Thu, 2 Feb 2012 19:35:29 +0000 (19:35 +0000)]
Initialize the user defined conversion function to null if this is an aggregate initialization from an initializer list.

Found by valgrind.

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

12 years agoUse -isystem rather than relying on -isysroot to work consistently
Douglas Gregor [Thu, 2 Feb 2012 19:35:15 +0000 (19:35 +0000)]
Use -isystem rather than relying on -isysroot to work consistently

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

12 years agoobjc: comment the code which allows narroing of property object
Fariborz Jahanian [Thu, 2 Feb 2012 19:34:05 +0000 (19:34 +0000)]
objc: comment the code which allows narroing of property object
type in continuation class.

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

12 years agoYet more data from failing buildbots...
Douglas Gregor [Thu, 2 Feb 2012 19:30:09 +0000 (19:30 +0000)]
Yet more data from failing buildbots...

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

12 years agoobjective-c: When redeclaraing in continuation class a 'readonly'
Fariborz Jahanian [Thu, 2 Feb 2012 18:54:58 +0000 (18:54 +0000)]
objective-c: When redeclaraing in continuation class a 'readonly'
property to 'readwrite', also allow redeclaration of
property type to a narrowring object type.
// rdar://10790488

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

12 years agoDrop -verify to get better diagnostics from failing buildbots. Plus, we don't need...
Douglas Gregor [Thu, 2 Feb 2012 18:54:34 +0000 (18:54 +0000)]
Drop -verify to get better diagnostics from failing buildbots. Plus, we don't need it here

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

12 years agoBack out my heinous hack that tricked the module generation mechanism
Douglas Gregor [Thu, 2 Feb 2012 18:42:48 +0000 (18:42 +0000)]
Back out my heinous hack that tricked the module generation mechanism
into using non-absolute system includes (<foo>)...

... and introduce another hack that is simultaneously more heineous
and more effective. We whitelist Clang-supplied headers that augment
or override system headers (such as float.h, stdarg.h, and
tgmath.h). For these headers, Clang does not provide a module
mapping. Instead, a system-supplied module map can refer to these
headers in a system module, and Clang will look both in its own
include directory and wherever the system-supplied module map
suggests, then adds either or both headers. The end result is that
Clang-supplied headers get merged into the system-supplied module for
the C standard library.

As a drive-by, fix up a few dependencies in the _Builtin_instrinsics
module.

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

12 years agoPacify gcc's -Wreturn-type
Matt Beaumont-Gay [Thu, 2 Feb 2012 18:35:35 +0000 (18:35 +0000)]
Pacify gcc's -Wreturn-type

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

12 years agoPass the SourceMgr to the MCContext for cc1as.
Jim Grosbach [Thu, 2 Feb 2012 17:54:07 +0000 (17:54 +0000)]
Pass the SourceMgr to the MCContext for cc1as.

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

12 years agoMove the code that sets the AddressSafety
Alexander Potapenko [Thu, 2 Feb 2012 11:49:28 +0000 (11:49 +0000)]
Move the code that sets the AddressSafety
attribute into CodeGenModule::SetLLVMFunctionAttributesForDefinition().

Previously it resided in CodeGenModule::GetOrCreateLLVMFunction, which
for some reason wasn't called for ObjC class methods, see
http://code.google.com/p/address-sanitizer/issues/detail?id=33

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

12 years agor149587 reverted
Anton Yartsev [Thu, 2 Feb 2012 06:06:34 +0000 (06:06 +0000)]
r149587 reverted

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

12 years agoFix for PR10657 (http://llvm.org/bugs/show_bug.cgi?id=10657)
Anton Yartsev [Thu, 2 Feb 2012 05:13:59 +0000 (05:13 +0000)]
Fix for PR10657 (http://llvm.org/bugs/show_bug.cgi?id=10657)
extern inline case considered

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

12 years agoSplit Sema::MarkDeclarationReferenced into multiple functions; the additional entry...
Eli Friedman [Thu, 2 Feb 2012 03:46:19 +0000 (03:46 +0000)]
Split Sema::MarkDeclarationReferenced into multiple functions; the additional entry points are needed to implement C++11 odr-use marking correctly.  No functional change in this patch; I'll actually make the change which fixes the odr-use marking in a followup patch.

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

12 years ago[analyzer] Fix a false positive in the CFArrayCreate check that surfaces
Anna Zaks [Thu, 2 Feb 2012 01:30:08 +0000 (01:30 +0000)]
[analyzer] Fix a false positive in the CFArrayCreate check that surfaces
the the code like this (due to x and &x being the same value but
different size):

void* x[] = { ptr1, ptr2, ptr3 };
CFArrayCreate(NULL, (const void **) &x, count, NULL);

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

12 years agoconstexpr:
Richard Smith [Thu, 2 Feb 2012 01:16:57 +0000 (01:16 +0000)]
constexpr:
  * support the gcc __builtin_constant_p() ? ... : ... folding hack in C++11
  * check for unspecified values in pointer comparisons and pointer subtractions

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

12 years agoIntroduce a -cc1 option "-dependency-graphviz" that determines header
Douglas Gregor [Thu, 2 Feb 2012 00:54:52 +0000 (00:54 +0000)]
Introduce a -cc1 option "-dependency-graphviz" that determines header
dependencies and outputs them in GraphViz format.

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

12 years agoobjc: don't crash if primary class is missing and continuation class
Fariborz Jahanian [Thu, 2 Feb 2012 00:49:12 +0000 (00:49 +0000)]
objc: don't crash if primary class is missing and continuation class
is declaring ivars. // rdar://10752081

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

12 years agoChange the check for constant-conversion with width-1 bitfields so it doesn't suppres...
Eli Friedman [Thu, 2 Feb 2012 00:40:20 +0000 (00:40 +0000)]
Change the check for constant-conversion with width-1 bitfields so it doesn't suppress quite as many cases.  Based off a testcase in the gcc testsuite.

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

12 years agoback out r149504
Dylan Noblesmith [Thu, 2 Feb 2012 00:40:14 +0000 (00:40 +0000)]
back out r149504

Too many weird build failures.

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

12 years agoPer discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
Ted Kremenek [Thu, 2 Feb 2012 00:16:13 +0000 (00:16 +0000)]
Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.

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

12 years agoobjc2: add __has_feature(objc_default_synthesize_properties).
Fariborz Jahanian [Thu, 2 Feb 2012 00:15:51 +0000 (00:15 +0000)]
objc2: add __has_feature(objc_default_synthesize_properties).
// rdar://10770497

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

12 years agor149474 went a bit too far when combined with type caching. If we want
Eric Christopher [Wed, 1 Feb 2012 23:39:00 +0000 (23:39 +0000)]
r149474 went a bit too far when combined with type caching. If we want
a full type go ahead and emit it if we currently only have a forward
declaration.

Fixes gdb bots for gdb1090.exp and call-ar-st.exp.

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

12 years agoReject mismatched "#pragma GCC visibility push" and "#pragma GCC visibility pop".
Rafael Espindola [Wed, 1 Feb 2012 23:24:59 +0000 (23:24 +0000)]
Reject mismatched "#pragma GCC visibility push" and "#pragma GCC visibility pop".

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

12 years agoLook for declaration of CFBridgingRetain/CFBridgingRetain before
Fariborz Jahanian [Wed, 1 Feb 2012 22:56:20 +0000 (22:56 +0000)]
Look for declaration of CFBridgingRetain/CFBridgingRetain before
changing the diagnostic. Also use correct spelling for both.

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

12 years agomake: fix installation of generated header files
Dylan Noblesmith [Wed, 1 Feb 2012 22:23:31 +0000 (22:23 +0000)]
make: fix installation of generated header files

The PROJ_SRC_DIR != PROJ_OBJ_DIR path was missing the directory
creation logic that was in the path for non-generated headers.
PR11903.

(The oversight was copied and pasted from LLVM's Makefile.rules,
where it apparently existed since time immemorial til it was
corrected in r127325.)

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

12 years agocmake: don't install config.h (v2)
Dylan Noblesmith [Wed, 1 Feb 2012 22:22:37 +0000 (22:22 +0000)]
cmake: don't install config.h (v2)

This header is private and shouldn't be used by clients.

(This reverts r149540, reinstating r149496. False alarm.)

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

12 years agoRemove duplicated comment.
Eric Christopher [Wed, 1 Feb 2012 21:48:10 +0000 (21:48 +0000)]
Remove duplicated comment.

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

12 years agoFix comment.
Eric Christopher [Wed, 1 Feb 2012 21:44:56 +0000 (21:44 +0000)]
Fix comment.

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

12 years agocmake: revert r149496
Dylan Noblesmith [Wed, 1 Feb 2012 21:17:55 +0000 (21:17 +0000)]
cmake: revert r149496

It *looks* like this caused PR11903, somehow.

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

12 years agoMake sure that imported definitions get completed before we add
Douglas Gregor [Wed, 1 Feb 2012 21:00:38 +0000 (21:00 +0000)]
Make sure that imported definitions get completed before we add
anything into the corresponding DeclContext. Co-hacked with Sean;
fixes <rdar://problem/10768928>.

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

12 years agolibclang: Mark clang_Cursor_isNull with CINDEX_LINKAGE to make it available on windows.
Benjamin Kramer [Wed, 1 Feb 2012 20:37:28 +0000 (20:37 +0000)]
libclang: Mark clang_Cursor_isNull with CINDEX_LINKAGE to make it available on windows.

Patch by Timothy J Fontaine!

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

12 years ago[libclang] Make sure we don't ever leave a StoredDiagnostic associated with
Argyrios Kyrtzidis [Wed, 1 Feb 2012 19:54:02 +0000 (19:54 +0000)]
[libclang] Make sure we don't ever leave a StoredDiagnostic associated with
a SourceManager that has already been deleted, rdar://10768346.

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

12 years agoAdd missing dependency to unbreak the CMake build
Douglas Gregor [Wed, 1 Feb 2012 19:53:01 +0000 (19:53 +0000)]
Add missing dependency to unbreak the CMake build

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

12 years agosize() == 0 -> empty().
David Chisnall [Wed, 1 Feb 2012 19:16:56 +0000 (19:16 +0000)]
size() == 0 -> empty().

Spotted by rjmcall.

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

12 years ago[analyzer] Fix a crash in CheckerContext::isCLibraryFunction for C++
Anna Zaks [Wed, 1 Feb 2012 19:16:20 +0000 (19:16 +0000)]
[analyzer] Fix a crash in CheckerContext::isCLibraryFunction for C++
declarations with special names.

A patch by Dmitri Gribenko.

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

12 years agoAdd a new compiler warning, which flags anti-patterns used as the size
Anna Zaks [Wed, 1 Feb 2012 19:08:57 +0000 (19:08 +0000)]
Add a new compiler warning, which flags anti-patterns used as the size
argument in strncat.

The warning is ignored by default since it needs more qualification.

TODO: The warning message and the note are messy when
strncat is a builtin due to the macro expansion.

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

12 years agoDiagnose the restriction on default arguments in C++11 [expr.prim.lambda]p5.
Douglas Gregor [Wed, 1 Feb 2012 17:18:19 +0000 (17:18 +0000)]
Diagnose the restriction on default arguments in C++11 [expr.prim.lambda]p5.

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

12 years agoIntroduce the lambda scope before determining explicit captures, which
Douglas Gregor [Wed, 1 Feb 2012 17:04:21 +0000 (17:04 +0000)]
Introduce the lambda scope before determining explicit captures, which
cleans up and improves a few things:
  - We get rid of the ugly dance of computing all of the captures in
  data structures that clone those of CapturingScopeInfo, centralizing
  the logic for accessing/updating these data structures
  - We re-use the existing capture logic for 'this', which actually
  works now.

Cleaned up some diagnostic wording in minor ways as well.

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

12 years ago[analyzer] Testing: add 2 new checkers to the buildbot script.
Anna Zaks [Wed, 1 Feb 2012 16:46:57 +0000 (16:46 +0000)]
[analyzer] Testing: add 2 new checkers to the buildbot script.

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

12 years agotest/Driver/target.c: Relax expression for "gcc.exe" on win32.
NAKAMURA Takumi [Wed, 1 Feb 2012 15:16:22 +0000 (15:16 +0000)]
test/Driver/target.c: Relax expression for "gcc.exe" on win32.

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

12 years agoinclude clang's config.h unconditionally
Dylan Noblesmith [Wed, 1 Feb 2012 14:25:28 +0000 (14:25 +0000)]
include clang's config.h unconditionally

And remove HAVE_CLANG_CONFIG_H, now that the header is generated
in the autoconf build, too. (clang r149497 / llvm r149498)

Also include the config.h header after all other headers, per
the LLVM coding standards.

It also turns out WindowsToolChain.cpp wasn't using the config
header at all, so that include's just deleted now.

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

12 years agotest/Modules/compiler_builtins.m: Appease Cygwin to add -D__need_wint_t.
NAKAMURA Takumi [Wed, 1 Feb 2012 14:09:19 +0000 (14:09 +0000)]
test/Modules/compiler_builtins.m: Appease Cygwin to add -D__need_wint_t.

On Cygwin, at first, <stddef.h> is included without __need_wint_t.
Next, <stddef.h> is included with __need_wint_t, though Modules feature would not process <stddef.h> twice.
Then, wint_t is not found in system headers.

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

12 years agotest/Modules/compiler_builtins.m: Mark this as XFAIL:win32. MS limits.h provides...
NAKAMURA Takumi [Wed, 1 Feb 2012 14:09:13 +0000 (14:09 +0000)]
test/Modules/compiler_builtins.m: Mark this as XFAIL:win32. MS limits.h provides size_t.

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

12 years agoautoconf: add private config.h to clang
Dylan Noblesmith [Wed, 1 Feb 2012 13:50:25 +0000 (13:50 +0000)]
autoconf: add private config.h to clang

This already exists in the CMake build, which is part of what makes
building clang separately from llvm via cmake possible. This cleans up
that discrepancy between the build systems (and sets the groundwork
for configuring clang separately, too).

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

12 years agocmake: don't install config.h
Dylan Noblesmith [Wed, 1 Feb 2012 13:50:22 +0000 (13:50 +0000)]
cmake: don't install config.h

This header is private and shouldn't be used by clients.

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

12 years agoFrontend: fix comment typos
Dylan Noblesmith [Wed, 1 Feb 2012 13:50:20 +0000 (13:50 +0000)]
Frontend: fix comment typos

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

12 years agoconstexpr: check for overflow in pointer subtraction.
Richard Smith [Wed, 1 Feb 2012 08:10:20 +0000 (08:10 +0000)]
constexpr: check for overflow in pointer subtraction.

This is a mess. According to the C++11 standard, pointer subtraction only has
undefined behavior if the difference of the array indices does not fit into a
ptrdiff_t.

However, common implementations effectively perform a char* subtraction first,
and then divide the result by the element size, which can cause overflows in
some cases. Those cases are not considered to be undefined behavior by this
change; perhaps they should be.

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

12 years agoCompatability fix for SwitchInst refactoring.
Stepan Dyatkovskiy [Wed, 1 Feb 2012 07:50:21 +0000 (07:50 +0000)]
Compatability fix for SwitchInst refactoring.

The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.

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

12 years agoRevert r149363 which was part a series of commits that were reverted in llvm
Argyrios Kyrtzidis [Wed, 1 Feb 2012 06:36:49 +0000 (06:36 +0000)]
Revert r149363 which was part a series of commits that were reverted in llvm
commit 149470. This fixes test/CodeGen/PR3589-freestanding-libcalls.c.

Original log:

    ConstantArray::get() (for strings) is going away, use
    ConstantDataArray::getString instead.

    Many instances of ConstantArray::get() could be moved to
    use more efficient ConstantDataArray methods that avoid a ton
    of intermediate Constant*'s for each element (e.g.
    GetConstantArrayFromStringLiteral).  I don't plan on doing this
    in the short-term though.

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

12 years agoRemove redundant checks in CXXRecordDecl::isCLike(), as suggested by Sebastian.
Argyrios Kyrtzidis [Wed, 1 Feb 2012 06:36:44 +0000 (06:36 +0000)]
Remove redundant checks in CXXRecordDecl::isCLike(), as suggested by Sebastian.

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

12 years agoFor pass-by-value record arguments to functions emit a forward decl
Eric Christopher [Wed, 1 Feb 2012 06:07:23 +0000 (06:07 +0000)]
For pass-by-value record arguments to functions emit a forward decl
instead of the entire class definition.

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

12 years agoconstexpr: overflow checking for integral and floating-point arithmetic.
Richard Smith [Wed, 1 Feb 2012 05:53:12 +0000 (05:53 +0000)]
constexpr: overflow checking for integral and floating-point arithmetic.

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

12 years agoWhen providing code completions for a switch over a scoped enumeration
Douglas Gregor [Wed, 1 Feb 2012 05:02:47 +0000 (05:02 +0000)]
When providing code completions for a switch over a scoped enumeration
type, be sure to add the qualifier for the enumeration type.

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

12 years agoconstexpr: Unlike other incomplete types, 'void' cannot possibly be completed as
Richard Smith [Wed, 1 Feb 2012 04:40:02 +0000 (04:40 +0000)]
constexpr: Unlike other incomplete types, 'void' cannot possibly be completed as
a literal type. Disallow it as the return type of a constexpr function
declaration.

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

12 years agoconstexpr: require 'this' to point to an object in a constexpr method call.
Richard Smith [Wed, 1 Feb 2012 02:39:43 +0000 (02:39 +0000)]
constexpr: require 'this' to point to an object in a constexpr method call.

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

12 years agoconstexpr: add support for comparisons of pointer-to-members.
Richard Smith [Wed, 1 Feb 2012 01:42:44 +0000 (01:42 +0000)]
constexpr: add support for comparisons of pointer-to-members.

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

12 years agoImprove checking of explicit captures in a C++11 lambda expression:
Douglas Gregor [Wed, 1 Feb 2012 01:18:43 +0000 (01:18 +0000)]
Improve checking of explicit captures in a C++11 lambda expression:
  - Actually building the var -> capture mapping properly (there was an off-by-one error)
  - Keeping track of the source location of each capture
  - Minor QoI improvements, e.g, highlighing the prior capture if
  there are multiple captures, pointing at the variable declaration we
  found if we reject it.

As part of this, add standard citations for the various semantic
checks we perform, and note where we're not performing those checks as
we should.

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

12 years agoFix crash on invalid in microsoft anonymous struct extension.
Nico Weber [Wed, 1 Feb 2012 00:41:00 +0000 (00:41 +0000)]
Fix crash on invalid in microsoft anonymous struct extension.

Fixes PR11847. Patch from Jason Haslam!

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

12 years agoDiagnose attempts to explicitly capture a __block variable in a lambda.
Douglas Gregor [Wed, 1 Feb 2012 00:09:55 +0000 (00:09 +0000)]
Diagnose attempts to explicitly capture a __block variable in a lambda.

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

12 years agoUse the new Triple::getMacOSXVersion function in another place.
Bob Wilson [Tue, 31 Jan 2012 23:52:58 +0000 (23:52 +0000)]
Use the new Triple::getMacOSXVersion function in another place.

I removed support for "*-darwin*-iphoneos" triples, since we now have
iOS listed as a separate OS in the triples.

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

12 years agoFix an assertion failure in isMacOSXVersionLT for IOS targets.
Bob Wilson [Tue, 31 Jan 2012 23:52:54 +0000 (23:52 +0000)]
Fix an assertion failure in isMacOSXVersionLT for IOS targets.

Check if the triple OS is IOS instead of checking for arm/thumb architectures
and check that before calling isMacOSXVersionLT.

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

12 years agoMake the callback object to Sema::CorrectTypo mandatory.
Kaelyn Uhrain [Tue, 31 Jan 2012 23:49:25 +0000 (23:49 +0000)]
Make the callback object to Sema::CorrectTypo mandatory.

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

12 years agoExtend for-range temporary cleanups codegen test to catch the bug which Eli
Richard Smith [Tue, 31 Jan 2012 23:43:25 +0000 (23:43 +0000)]
Extend for-range temporary cleanups codegen test to catch the bug which Eli
fixed in r149440.

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

12 years agoobjc-arc: In various diagnostics mention
Fariborz Jahanian [Tue, 31 Jan 2012 23:42:37 +0000 (23:42 +0000)]
objc-arc: In various diagnostics mention
CFBridgingRetain/CFBridgingRelease calls instead
of __bridge_retained/__bridge_transfer casts as preferred
way of moving cf objects to arc land. // rdar://10207950

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

12 years agoconstexpr: Treat INT_MIN % -1 as undefined behavior in C++11. Technically, it
Richard Smith [Tue, 31 Jan 2012 23:24:19 +0000 (23:24 +0000)]
constexpr: Treat INT_MIN % -1 as undefined behavior in C++11. Technically, it
isn't, but this is just a (reported) defect in the wording.

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

12 years agoMake sure we call MaybeCreateExprWithCleanups for the sub-expression of an indirect...
Eli Friedman [Tue, 31 Jan 2012 22:47:07 +0000 (22:47 +0000)]
Make sure we call MaybeCreateExprWithCleanups for the sub-expression of an indirect goto.

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

12 years agoA couple minor fixes to template instantiation for for-range loops.
Eli Friedman [Tue, 31 Jan 2012 22:45:40 +0000 (22:45 +0000)]
A couple minor fixes to template instantiation for for-range loops.

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

12 years agoUse new Triple::getMacOSXVersion function.
Bob Wilson [Tue, 31 Jan 2012 22:43:59 +0000 (22:43 +0000)]
Use new Triple::getMacOSXVersion function.

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

12 years agoarc migrator: twik previous patch to exclude user provided
Fariborz Jahanian [Tue, 31 Jan 2012 22:09:44 +0000 (22:09 +0000)]
arc migrator: twik previous patch to exclude user provided
explicit type cast. // rdar://10521744

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

12 years agoarc migrator: Do not attempt to migrate to bridge casts which
Fariborz Jahanian [Tue, 31 Jan 2012 21:58:23 +0000 (21:58 +0000)]
arc migrator: Do not attempt to migrate to bridge casts which
cancel out each other. Leave it alone so users can take a look
(unmigrated code forces error diagnostic). // rdar://10521744

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

12 years agoSplit compiler builtin module into "stdlib" builtins and "intrinsic"
Douglas Gregor [Tue, 31 Jan 2012 21:57:50 +0000 (21:57 +0000)]
Split compiler builtin module into "stdlib" builtins and "intrinsic"
builds, and bring mm_alloc.h into the fold. Start playing some tricks
with these builtin modules to mirror the include_next tricks that the
headers already perform.

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

12 years agoRemove extraneous whitespace.
Chad Rosier [Tue, 31 Jan 2012 21:45:04 +0000 (21:45 +0000)]
Remove extraneous whitespace.

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

12 years agoFix more fallout from the introduction of "macosx" and "ios" triples.
Bob Wilson [Tue, 31 Jan 2012 21:30:03 +0000 (21:30 +0000)]
Fix more fallout from the introduction of "macosx" and "ios" triples.

The Darwin toolchain constructor was assuming that all Darwin triples would
have an OS string starting with "darwin".  Triples starting with "macosx"
would misinterpret the version number, and "ios" triples would completely
miss the version number (or worse) because the OS name is not 6 characters
long.  We lose some sanity checking of triple strings here, since the
Triple.getOSVersion function doesn't do all the checking that the previous
code did, but this still seems like a step in the right direction.

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

12 years ago[analyzer] Add checks for common anti-patterns in strncat.
Anna Zaks [Tue, 31 Jan 2012 19:33:39 +0000 (19:33 +0000)]
[analyzer] Add checks for common anti-patterns in strncat.
(Since this is syntax only, might be a good candidate for turning into a
compiler warning.)

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

12 years ago[analyzer] Change the warning to suggest 'strlcat/strlcpy' as
Anna Zaks [Tue, 31 Jan 2012 19:33:31 +0000 (19:33 +0000)]
[analyzer] Change the warning to suggest 'strlcat/strlcpy' as
replacements for 'starcat/strcpy' instead of 'strncat/strncpy'.

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

12 years agoFix 80-column violation.
Chad Rosier [Tue, 31 Jan 2012 19:31:12 +0000 (19:31 +0000)]
Fix 80-column violation.

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

12 years agoRevert r149359. This was a hack to a problem with an easy workaround, and it doesn...
Ted Kremenek [Tue, 31 Jan 2012 19:19:25 +0000 (19:19 +0000)]
Revert r149359.  This was a hack to a problem with an easy workaround, and it doesn't feel like general solution.

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

12 years agoPacify gcc's -Wreturn-type.
Matt Beaumont-Gay [Tue, 31 Jan 2012 18:59:25 +0000 (18:59 +0000)]
Pacify gcc's -Wreturn-type.

A separate unreachable message will make it easier to debug if either of the
unreachables is reached.

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