]> granicus.if.org Git - clang/log
clang
13 years agoReenable test.
Argyrios Kyrtzidis [Mon, 11 Jul 2011 21:58:47 +0000 (21:58 +0000)]
Reenable test.

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

13 years agoAdd missing header file for the test.
Argyrios Kyrtzidis [Mon, 11 Jul 2011 21:58:44 +0000 (21:58 +0000)]
Add missing header file for the test.

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

13 years agoAdd diagnostic for constructs like "va_arg(l, float)" which have undefined behavior...
Eli Friedman [Mon, 11 Jul 2011 21:45:59 +0000 (21:45 +0000)]
Add diagnostic for constructs like "va_arg(l, float)" which have undefined behavior. PR10201.

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

13 years agoTest is broken; XFAIL it until Argyrios gets a chance to look at it.
Eli Friedman [Mon, 11 Jul 2011 21:44:14 +0000 (21:44 +0000)]
Test is broken; XFAIL it until Argyrios gets a chance to look at it.

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

13 years agoDon't warn for unused macro when undef'ing it, if it comes from an included file...
Argyrios Kyrtzidis [Mon, 11 Jul 2011 20:39:47 +0000 (20:39 +0000)]
Don't warn for unused macro when undef'ing it, if it comes from an included file. rdar://9745065

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

13 years agoFix CMake.
Argyrios Kyrtzidis [Mon, 11 Jul 2011 20:28:59 +0000 (20:28 +0000)]
Fix CMake.

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

13 years ago[arcmt] Move the remapping functions to clang-c/Index.h and change 'arcmt_' prefix...
Argyrios Kyrtzidis [Mon, 11 Jul 2011 20:15:00 +0000 (20:15 +0000)]
[arcmt] Move the remapping functions to clang-c/Index.h and change 'arcmt_' prefix to 'clang_'.

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

13 years agoEmit partial destruction of structs with initializer lists.
John McCall [Mon, 11 Jul 2011 19:35:02 +0000 (19:35 +0000)]
Emit partial destruction of structs with initializer lists.

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

13 years agoobjc-arc: Diagnose when captured variable in block literals
Fariborz Jahanian [Mon, 11 Jul 2011 18:04:54 +0000 (18:04 +0000)]
objc-arc: Diagnose when captured variable in block literals
require destruction and there is possibility of that without
construction. Thanks Johnm for review and suggestions offline.
// rdar://9535237.

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

13 years agoApply patch from Richard Trieu to fix PR9548:
Chandler Carruth [Mon, 11 Jul 2011 17:49:21 +0000 (17:49 +0000)]
Apply patch from Richard Trieu to fix PR9548:

When two different types has the same text representation in the same
diagnostic message, print an a.k.a. after the type if the a.k.a. gives extra
information about the type.

class versa_string;

typedef versa_string string;

namespace std {template <typename T> class vector;}

using std::vector;

void f(vector<string> v);

namespace std {
class basic_string;
typedef basic_string string;
template <typename T> class vector {};
void g() {
  vector<string> v;
  f(v);
}
}

Old message:
----------------
test.cc:15:3: error: no matching function for call to 'f'
  f(&v);
  ^
test.cc:7:6: note: candidate function not viable: no known conversion from
      'vector<string>' to 'vector<string>' for 1st argument
void f(vector<string> v);
     ^
1 error generated.

New message:
---------------
test.cc:15:3: error: no matching function for call to 'f'
  f(v);
  ^
test.cc:7:6: note: candidate function not viable: no known conversion from
      'vector<string>' (aka 'std::vector<std::basic_string>') to
      'vector<string>' (aka 'std::vector<versa_string>') for 1st argument
void f(vector<string> v);
     ^
1 error generated.

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

13 years agoTweak two tests with MSYS-bash tolerant.
NAKAMURA Takumi [Mon, 11 Jul 2011 16:21:34 +0000 (16:21 +0000)]
Tweak two tests with MSYS-bash tolerant.

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

13 years agotest/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331.
NAKAMURA Takumi [Mon, 11 Jul 2011 16:21:28 +0000 (16:21 +0000)]
test/Frontend/dependency-gen.c: Mark XFAIL: mingw due to PR10331.

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

13 years agoDon't complain about missing return statements for naked
Douglas Gregor [Mon, 11 Jul 2011 15:24:01 +0000 (15:24 +0000)]
Don't complain about missing return statements for naked
functions. Fixes <rdar://problem/9731999>.

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

13 years agotest/Preprocessor/include-directive2.c: Get rid of using <float.h> to avoid #include_...
NAKAMURA Takumi [Mon, 11 Jul 2011 14:53:27 +0000 (14:53 +0000)]
test/Preprocessor/include-directive2.c: Get rid of using <float.h> to avoid #include_next on mingw.

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

13 years agoDe-constify Types in StructType::get() and TargetData::getIntPtrType().
Jay Foad [Mon, 11 Jul 2011 09:56:20 +0000 (09:56 +0000)]
De-constify Types in StructType::get() and TargetData::getIntPtrType().

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

13 years agoFixed PR10243.
Abramo Bagnara [Mon, 11 Jul 2011 08:52:40 +0000 (08:52 +0000)]
Fixed PR10243.

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

13 years agoAdded removeBitWidth method.
Abramo Bagnara [Mon, 11 Jul 2011 08:43:20 +0000 (08:43 +0000)]
Added removeBitWidth method.

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

13 years agoFix a lot of problems with the partial destruction of arrays:
John McCall [Mon, 11 Jul 2011 08:38:19 +0000 (08:38 +0000)]
Fix a lot of problems with the partial destruction of arrays:
 - an off-by-one error in emission of irregular array limits for
   InitListExprs
 - use an EH partial-destruction cleanup within the normal
   array-destruction cleanup
 - get the branch destinations right for the empty check
Also some refactoring which unfortunately obscures these changes.

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

13 years agoDe-constify Types in FunctionType::get().
Jay Foad [Mon, 11 Jul 2011 07:56:41 +0000 (07:56 +0000)]
De-constify Types in FunctionType::get().

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

13 years agoMatch createCodeEmitter change.
Evan Cheng [Mon, 11 Jul 2011 04:24:19 +0000 (04:24 +0000)]
Match createCodeEmitter change.

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

13 years agoUse cached types; no functionality change.
John McCall [Sun, 10 Jul 2011 20:11:30 +0000 (20:11 +0000)]
Use cached types;  no functionality change.

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

13 years agoFix ARCMT/migrate.m on MSVC.
Francois Pichet [Sun, 10 Jul 2011 19:48:34 +0000 (19:48 +0000)]
Fix ARCMT/migrate.m on MSVC.
Solution is to set output stdout to binary mode to prevent newline conversion (\n => \r\n).

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

13 years agoUnbreak -cc1as mode after MC subtarget changes
Joerg Sonnenberger [Sun, 10 Jul 2011 19:16:25 +0000 (19:16 +0000)]
Unbreak -cc1as mode after MC subtarget changes

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

13 years ago[arcmt] Remove redundant has_error() check.
Argyrios Kyrtzidis [Sun, 10 Jul 2011 18:57:18 +0000 (18:57 +0000)]
[arcmt] Remove redundant has_error() check.

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

13 years ago[arcmt] Try fixing test/ARCMT/migrate.m for windows hosts.
Argyrios Kyrtzidis [Sun, 10 Jul 2011 18:57:15 +0000 (18:57 +0000)]
[arcmt] Try fixing test/ARCMT/migrate.m for windows hosts.

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

13 years agotest/CMakeLists.txt: clang-test may depend on llc when LLVM is built together.
NAKAMURA Takumi [Sun, 10 Jul 2011 17:45:28 +0000 (17:45 +0000)]
test/CMakeLists.txt: clang-test may depend on llc when LLVM is built together.

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

13 years agotest/CMakeLists.txt: Fix ClangUnitTests to be built with clang-test and check-all.
NAKAMURA Takumi [Sun, 10 Jul 2011 17:45:23 +0000 (17:45 +0000)]
test/CMakeLists.txt: Fix ClangUnitTests to be built with clang-test and check-all.

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

13 years agotools/c-arcmt-test/Makefile: Add clangARCMigrate.a clangRewrite.a to USEDLIBS to...
NAKAMURA Takumi [Sun, 10 Jul 2011 15:50:19 +0000 (15:50 +0000)]
tools/c-arcmt-test/Makefile: Add clangARCMigrate.a clangRewrite.a to USEDLIBS to satisfy linking on cygming.

FIXME: tools/c-*.exe should be linked to clang.dll on cygming. llvm/Makefile.rules is not aware of bin/clang.dll.

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

13 years agorelax this test a bit to hopefully work with VC++
Chris Lattner [Sun, 10 Jul 2011 14:52:52 +0000 (14:52 +0000)]
relax this test a bit to hopefully work with VC++

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

13 years agoChange __debugbreak signature to void __debugbreak(void); MSVC compatibility.
Francois Pichet [Sun, 10 Jul 2011 14:15:07 +0000 (14:15 +0000)]
Change __debugbreak signature to void __debugbreak(void); MSVC compatibility.

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

13 years agoimplement a nice new optimization: CodeGenTypes::UpdateCompletedType
Chris Lattner [Sun, 10 Jul 2011 06:03:22 +0000 (06:03 +0000)]
implement a nice new optimization: CodeGenTypes::UpdateCompletedType
is called whenever a tag type is completed.  We previously used that
as the sign to layout the codegen representation for the tag type,
which worked but meant that we laid out *every* completed type, whether
it was used or not.

Now we just lay out the type if we've already seen it somehow else.
This means that we lay out types we've used but haven't seen a body
for, but we don't lay out tons of stuff that noone cares about.

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

13 years agoenhance EmitLValueForFieldInitialization to do the proper pointer adjustment, allowing
Chris Lattner [Sun, 10 Jul 2011 05:53:24 +0000 (05:53 +0000)]
enhance EmitLValueForFieldInitialization to do the proper pointer adjustment, allowing
us to revert the other half of r134860.  Now things are back to a relatively tidy state.

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

13 years agorevert part of r134860, which is empirically unnecessary after the proper fix
Chris Lattner [Sun, 10 Jul 2011 05:44:18 +0000 (05:44 +0000)]
revert part of r134860, which is empirically unnecessary after the proper fix

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

13 years agokeep track of whether being in a RS_StructPointer state
Chris Lattner [Sun, 10 Jul 2011 05:39:13 +0000 (05:39 +0000)]
keep track of whether being in a RS_StructPointer state
caused us to skip layout out a function accurately.  If
so, flush the type cache for both the function and struct
case to ensure that any pointers to the functions get
recomputed.  This is overconservative, but with this patch
clang can build itself again.

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

13 years agochange EmitLValueForField to cast the returned lvalue to the right
Chris Lattner [Sun, 10 Jul 2011 05:34:54 +0000 (05:34 +0000)]
change EmitLValueForField to cast the returned lvalue to the right
type, even when in the struct case.  This was one root issue that was
causing type mismatches throughout the compiler.

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

13 years agoFix the clang bootstrap and Jay's testcase from llvm-dev by being completely
Chris Lattner [Sun, 10 Jul 2011 03:47:27 +0000 (03:47 +0000)]
Fix the clang bootstrap and Jay's testcase from llvm-dev by being completely
conservative when converting a functiontype to IR when in a "pointer within
a struct" context.  This has the unfortunate sideeffect of compiling all
function pointers inside of structs into "{}*" which, though correct, is
ugly.  This has the positive side effect of being correct, and it is pretty
straight-forward to improve on this.

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

13 years agowhen emitting pointer load from an lvalue or storing to an lvalue,
Chris Lattner [Sun, 10 Jul 2011 03:38:35 +0000 (03:38 +0000)]
when emitting pointer load from an lvalue or storing to an lvalue,
do an explicit bitcast to whatever ConvertType produces.  This will
go with the next patch.

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

13 years agoc-arcmt-test.c: MSVCRT does not have setenv. Use putenv instead.
NAKAMURA Takumi [Sun, 10 Jul 2011 03:10:43 +0000 (03:10 +0000)]
c-arcmt-test.c: MSVCRT does not have setenv. Use putenv instead.

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

13 years agohow about we initialize RecursionState.
Chris Lattner [Sun, 10 Jul 2011 01:10:18 +0000 (01:10 +0000)]
how about we initialize RecursionState.

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

13 years agoRename CGT::VerifyFuncTypeComplete to isFuncTypeConvertible since
Chris Lattner [Sun, 10 Jul 2011 00:18:59 +0000 (00:18 +0000)]
Rename CGT::VerifyFuncTypeComplete to isFuncTypeConvertible since
it is a predicate, not an action.  Change the return type to be a bool,
not the incomplete member.  Enhace it to detect the recursive compilation
case, allowing us to compile Eli's testcase on llvmdev:

struct T {
 struct T (*p)(void);
} t;

into:

%struct.T = type { {}* }

@t = common global %struct.T zeroinitializer, align 8

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

13 years agotest/CMakeLists.txt: Add missing c-arcmt-test to clang-test.deps.
NAKAMURA Takumi [Sat, 9 Jul 2011 23:36:37 +0000 (23:36 +0000)]
test/CMakeLists.txt: Add missing c-arcmt-test to clang-test.deps.

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

13 years agoFix linker problem in buildbot.
Argyrios Kyrtzidis [Sat, 9 Jul 2011 22:35:06 +0000 (22:35 +0000)]
Fix linker problem in buildbot.

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

13 years agoUgh, fix CMake.
Argyrios Kyrtzidis [Sat, 9 Jul 2011 22:05:50 +0000 (22:05 +0000)]
Ugh, fix CMake.

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

13 years ago[libclang] Fix linker error in buildbots.
Argyrios Kyrtzidis [Sat, 9 Jul 2011 21:35:58 +0000 (21:35 +0000)]
[libclang] Fix linker error in buildbots.

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

13 years ago[arcmt] Remove test/ARCMT/with-working-dir.m which fails at windows hosts and is...
Argyrios Kyrtzidis [Sat, 9 Jul 2011 20:01:02 +0000 (20:01 +0000)]
[arcmt] Remove test/ARCMT/with-working-dir.m which fails at windows hosts and is not that useful
in the first place. http://llvm.org/PR10312.

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

13 years ago[arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.
Argyrios Kyrtzidis [Sat, 9 Jul 2011 20:00:58 +0000 (20:00 +0000)]
[arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.

This is a new mode of migration, where we avoid modifying the original files but
we emit temporary files instead.

<path> will be used to keep migration process metadata. Currently the temporary files
that are produced are put in the system's temp directory but we can put them
in the <path> if is necessary.

Also introduce new ARC migration functions in libclang whose only purpose,
currently, is to accept <path> and provide pairs of original file/transformed file
to map from the originals to the files after transformations are applied.

Finally introduce the c-arcmt-test utility that exercises the new libclang functions,
update arcmt-test, and add tests for the whole process.

rdar://9735086.

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

13 years agowhen an enum type is completed, only flush the type cache when
Chris Lattner [Sat, 9 Jul 2011 18:53:56 +0000 (18:53 +0000)]
when an enum type is completed, only flush the type cache when
the enum has already been converted.  If not, there cannot be any types
built on top of it, so there is no need to flush the cache.

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

13 years agofix this on 32-bit hosts.
Chris Lattner [Sat, 9 Jul 2011 18:33:01 +0000 (18:33 +0000)]
fix this on 32-bit hosts.

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

13 years agoclang side to match the LLVM IR type system rewrite patch.
Chris Lattner [Sat, 9 Jul 2011 17:41:47 +0000 (17:41 +0000)]
clang side to match the LLVM IR type system rewrite patch.

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

13 years agoMore compiler workarounds. I have to admit that I was not
John McCall [Sat, 9 Jul 2011 09:09:00 +0000 (09:09 +0000)]
More compiler workarounds.  I have to admit that I was not
expecting so much concentrated oddity on what seemed like a
trivial feature.  Thanks to François Pichet for doing the
MSVC legwork here.

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

13 years agocc1 must initialize MC subtarget infos for inline asm parsing. Re-enable asm-errors.c
Evan Cheng [Sat, 9 Jul 2011 07:32:07 +0000 (07:32 +0000)]
cc1 must initialize MC subtarget infos for inline asm parsing. Re-enable asm-errors.c

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

13 years agodisable this test to get the botz green again.
Chris Lattner [Sat, 9 Jul 2011 07:14:54 +0000 (07:14 +0000)]
disable this test to get the botz green again.

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

13 years agocreateAsmParser API change.
Evan Cheng [Sat, 9 Jul 2011 06:04:17 +0000 (06:04 +0000)]
createAsmParser API change.

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

13 years agoGCC 4.2 compatibility hack.
John McCall [Sat, 9 Jul 2011 02:30:03 +0000 (02:30 +0000)]
GCC 4.2 compatibility hack.

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

13 years agoA number of array-related IR-gen cleanups.
John McCall [Sat, 9 Jul 2011 01:37:26 +0000 (01:37 +0000)]
A number of array-related IR-gen cleanups.
  - Emit default-initialization of arrays that were partially initialized
    with initializer lists with a loop, rather than emitting the default
    initializer N times;
  - support destroying VLAs of non-trivial type, although this is not
    yet exposed to users; and
  - support the partial destruction of arrays initialized with
    initializer lists when an initializer throws an exception.

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

13 years agoSilly typo in test for r134770.
Eli Friedman [Fri, 8 Jul 2011 23:57:18 +0000 (23:57 +0000)]
Silly typo in test for r134770.

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

13 years agoChange -mno-mmx to be more compatible with gcc. Specifically, -mno-mmx should not...
Eli Friedman [Fri, 8 Jul 2011 23:31:17 +0000 (23:31 +0000)]
Change -mno-mmx to be more compatible with gcc.  Specifically, -mno-mmx should not imply -mno-sse.

Note that because we don't usually touch the MMX registers anyway, all -mno-mmx needs to do is tweak the x86-32 calling convention a little for vectors that look like MMX vectors, and prevent the definition of __MMX__.

clang doesn't actually stop the user from using MMX inline asm operands or MMX builtins in -mno-mmx mode; as a QOI issue, it would be nice to diagnose, but I doubt it really matters much.

<rdar://problem/9694837>

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

13 years agoRevert x86_64 ABI changes until I have time to check the items raised by Eli.
Bruno Cardoso Lopes [Fri, 8 Jul 2011 22:57:35 +0000 (22:57 +0000)]
Revert x86_64 ABI changes until I have time to check the items raised by Eli.

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

13 years agoIntroduce __builtin_expect() intrinsic support.
Jakub Staszak [Fri, 8 Jul 2011 22:45:14 +0000 (22:45 +0000)]
Introduce __builtin_expect() intrinsic support.

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

13 years agoAdd support for AVX 256-bit in the x86_64 ABI (as in the 0.99.5 draft)
Bruno Cardoso Lopes [Fri, 8 Jul 2011 22:18:40 +0000 (22:18 +0000)]
Add support for AVX 256-bit in the x86_64 ABI (as in the 0.99.5 draft)

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

13 years agoAdd codegen support for the fma/fmal/fmaf builtins.
Cameron Zwarich [Fri, 8 Jul 2011 21:39:34 +0000 (21:39 +0000)]
Add codegen support for the fma/fmal/fmaf builtins.

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

13 years agoInitialize all the AnalysisBasedWarnings statistics to zero.
Benjamin Kramer [Fri, 8 Jul 2011 20:38:53 +0000 (20:38 +0000)]
Initialize all the AnalysisBasedWarnings statistics to zero.

Found by valgrind.

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

13 years agoRemove unused variable.
Benjamin Kramer [Fri, 8 Jul 2011 20:20:17 +0000 (20:20 +0000)]
Remove unused variable.

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

13 years agoFix up dependency file name printing to more closely match that of gcc, including...
Eli Friedman [Fri, 8 Jul 2011 20:17:28 +0000 (20:17 +0000)]
Fix up dependency file name printing to more closely match that of gcc, including fixing a nasty recent regression that could make us print "/foo.h" with a command-line including "-I ./".

rdar://problem/9734352

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

13 years agoobjc++-arc: more diagnosis of converting a weak-unavailable
Fariborz Jahanian [Fri, 8 Jul 2011 17:41:42 +0000 (17:41 +0000)]
objc++-arc: more diagnosis of converting a weak-unavailable
object to a __weak object type. // rdar://9732636

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

13 years agoTeach CXXUnresolvedConstructExpr when it should be an
Douglas Gregor [Fri, 8 Jul 2011 15:50:43 +0000 (15:50 +0000)]
Teach CXXUnresolvedConstructExpr when it should be an
lvalue/xvalue/rvalue, rather than just (incorrectly) assuming it's an
lvalue. Fixes PR10285 / <rdar://problem/9743926>.

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

13 years agoAdd several CFG-stress-testing input source files. These use the
Chandler Carruth [Fri, 8 Jul 2011 11:20:51 +0000 (11:20 +0000)]
Add several CFG-stress-testing input source files. These use the
preprocessor to build up very large CFGs in various shapes that can
produce different algorithmic behavior in CFG-walking code.

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

13 years agoMake the worklist in the uninitialized values checker actually a queue.
Chandler Carruth [Fri, 8 Jul 2011 11:19:06 +0000 (11:19 +0000)]
Make the worklist in the uninitialized values checker actually a queue.
Previously, despite the names 'enqueue' and 'dequeue', it behaved as
a stack and visited blocks in a LIFO fashion. This interacts badly with
extremely broad CFGs *inside* of a loop (such as a large switch inside
a state machine) where every block updates a different variable.

When encountering such a CFG, the checker visited blocks in essentially
a "depth first" order due to the stack-like behavior of the work list.
Combined with each block updating a different variable, the saturation
logic of the checker caused it to re-traverse blocks [1,N-1] of the
broad CFG inside the loop after traversing block N. These re-traversals
were to propagate the variable values derived from block N. Assuming
approximately the same number of variables as inner blocks exist, the
end result is O(N^2) updates. By making this a queue, we also make the
traversal essentially "breadth-first" across each of the N inner blocks
of the loop. Then all of this state is propagated around to all N inner
blocks of the loop. The result is O(N) updates.

The truth is in the numbers:
Before, gcc.c:   96409 block visits  (max: 61546,   avg: 591)
After,  gcc.c:   69958 block visits  (max: 33090,   avg: 429)
Before, PR10183: 2540494 block vists (max: 2536495, avg: 37360)
After,  PR10183: 137803 block visits (max: 134406,  avg: 2026)

The nearly 20x reduction in work for PR10183 corresponds to a roughly
100x speedup in compile time.

I've tested it on all the code I can get my hands on, and I've seen no
slowdowns due to this change. Where I've collected stats, the ammount of
work done is on average less. I'll also commit shortly some synthetic
test cases useful in analyzing the performance of CFG-based warnings.

Submitting this based on Doug's feedback that post-commit review should
be good. Ted, please review! Hopefully this helps compile times until
then.

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

13 years agoFix a FIXME in clang ARM driver that was exposed as a bug with ARM backend
Evan Cheng [Fri, 8 Jul 2011 06:40:11 +0000 (06:40 +0000)]
Fix a FIXME in clang ARM driver that was exposed as a bug with ARM backend
change.

Previously clang was passing the following feature strings to the ARM backend
when CPU is cortex-a8: +neon,-vfp2,-vfp3

This used to work because -vfp2,-vfp3 had no effect after +neon. Now that the
features are controlled by individual bits (with implied hierarchy), the net
effect is all three features will be turned off.

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

13 years agoRandom cleanup:
Francois Pichet [Fri, 8 Jul 2011 06:21:47 +0000 (06:21 +0000)]
Random cleanup:
- fix a comment.
- Remove an unnecessary { } block.

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

13 years agoRemove a no-op break after a return, and correct one of the most
Chandler Carruth [Fri, 8 Jul 2011 04:59:44 +0000 (04:59 +0000)]
Remove a no-op break after a return, and correct one of the most
confusing indentations I've seen recently... Just noticed these while
making a change elsewhere.

No functionality changed.

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

13 years agoMinor style cleanup.
Chandler Carruth [Fri, 8 Jul 2011 04:28:55 +0000 (04:28 +0000)]
Minor style cleanup.

Original patch by John Freeman, some style tweaks by me.

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

13 years agoUpdate the creation of the TargetAsmParser based on API change in r134678.
Chandler Carruth [Fri, 8 Jul 2011 03:15:48 +0000 (03:15 +0000)]
Update the creation of the TargetAsmParser based on API change in r134678.

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

13 years agoTweak formatting.
Chandler Carruth [Fri, 8 Jul 2011 01:04:24 +0000 (01:04 +0000)]
Tweak formatting.

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

13 years agoSwitch the token-paste source locations inside of function style macro
Chandler Carruth [Fri, 8 Jul 2011 01:04:21 +0000 (01:04 +0000)]
Switch the token-paste source locations inside of function style macro
argument expansion to use the macro argument source locations as well.
Add a few tests to exercise this. There is still a bit more work needed
here though.

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

13 years agoKeep track of which source locations are part of a macro argument
Chandler Carruth [Thu, 7 Jul 2011 23:56:36 +0000 (23:56 +0000)]
Keep track of which source locations are part of a macro argument
instantiation and improve diagnostics which are stem from macro
arguments to trace the argument itself back through the layers of macro
expansion.

This requires some tricky handling of the source locations, as the
argument appears to be expanded in the opposite direction from the
surrounding macro. This patch provides helper routines that encapsulate
the logic and explain the reasoning behind how we step through macros
during diagnostic printing.

This fixes the rest of the test cases originially in PR9279, and later
split out into PR10214 and PR10215.

There is still some more work we can do here to improve the macro
backtrace, but those will follow as separate patches.

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

13 years agoAdd a testcase for the previous commit and update an existing test for an
Eric Christopher [Thu, 7 Jul 2011 23:11:01 +0000 (23:11 +0000)]
Add a testcase for the previous commit and update an existing test for an
extra register.

Part of PR10299 and rdar://9740322

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

13 years agoobjc++-arc: diagnose assignment/cast of a weak-unavailable
Fariborz Jahanian [Thu, 7 Jul 2011 23:04:17 +0000 (23:04 +0000)]
objc++-arc: diagnose assignment/cast of a weak-unavailable
object to a __weak object/type. // rdar://9732636.
One item is yet todo.

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

13 years agoFix a typo in the fpsr register and add the fpcr register.
Eric Christopher [Thu, 7 Jul 2011 22:55:26 +0000 (22:55 +0000)]
Fix a typo in the fpsr register and add the fpcr register.

Fixes PR10299 and rdar://9740322

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

13 years agoRemove BoostCon-specific code from Clang. FWIW, I'm a fan of things like this living...
Jonathan D. Turner [Thu, 7 Jul 2011 22:40:15 +0000 (22:40 +0000)]
Remove BoostCon-specific code from Clang.  FWIW, I'm a fan of things like this living in a separate branch.

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

13 years agoMove SourceManager::isAt[Start/End]OfMacroInstantiation functions to the Lexer, since...
Argyrios Kyrtzidis [Thu, 7 Jul 2011 21:54:45 +0000 (21:54 +0000)]
Move SourceManager::isAt[Start/End]OfMacroInstantiation functions to the Lexer, since they depend on it now.

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

13 years agoLayout the code for trapping arithmetic so that the overflow case comes after
Bill Wendling [Thu, 7 Jul 2011 21:13:10 +0000 (21:13 +0000)]
Layout the code for trapping arithmetic so that the overflow case comes after
the normal case.

Before, for this:

$ cat t.c
int test(int x) { return x * 2; }

We would get this:

   addl  %edi, %edi
   jno   LBB0_2
## BB#1:                                ## %overflow
   ud2
LBB0_2:                                 ## %nooverflow
   movl    %edi, %eax
   popq    %rbp
   ret

Now we get this:

   addl   %edi, %edi
   jo     LBB0_2
## BB#1:                                ## %nooverflow
   movl                                 %edi, %eax
   popq                                 %rbp
   ret
LBB0_2:                                 ## %overflow
   ud2

<rdar://problem/8283919>

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

13 years agor134634 causes a failure on MultiSource/Benchmarks/Olden/bh with TEST=nightly,
Cameron Zwarich [Thu, 7 Jul 2011 21:03:28 +0000 (21:03 +0000)]
r134634 causes a failure on MultiSource/Benchmarks/Olden/bh with TEST=nightly,
so roll it out.

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

13 years agoA redeclaration of an inline method in C99 mode should trigger emission of that
Nick Lewycky [Thu, 7 Jul 2011 20:25:10 +0000 (20:25 +0000)]
A redeclaration of an inline method in C99 mode should trigger emission of that
function. Fixes PR10233!

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

13 years agoUndo r134587 as the bug was actually a deep and hideous one in the
Sean Hunt [Thu, 7 Jul 2011 20:14:21 +0000 (20:14 +0000)]
Undo r134587 as the bug was actually a deep and hideous one in the
client code.

My bad.

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

13 years agoobjc-arc: diagnose assignment/cast of a weak-unavailable
Fariborz Jahanian [Thu, 7 Jul 2011 18:55:47 +0000 (18:55 +0000)]
objc-arc: diagnose assignment/cast of a weak-unavailable
object to a __weak object/type. // rdar://9732636.
This is objc side of things. objc++ side tbd.

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

13 years agoTurn hashhash into tok::unkwown when it comes from expanding an argument, per Chris...
Argyrios Kyrtzidis [Thu, 7 Jul 2011 18:04:47 +0000 (18:04 +0000)]
Turn hashhash into tok::unkwown when it comes from expanding an argument, per Chris' suggestion.

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

13 years agoFreeBSD gets FreeBSD target, just mipsel.
Joerg Sonnenberger [Thu, 7 Jul 2011 17:01:45 +0000 (17:01 +0000)]
FreeBSD gets FreeBSD target, just mipsel.

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

13 years agoSlightly improve the code to derive target from program name to not
Joerg Sonnenberger [Thu, 7 Jul 2011 16:57:26 +0000 (16:57 +0000)]
Slightly improve the code to derive target from program name to not
fault if no arguments are given.

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

13 years agoIntroduce a new libclang aPI function,
Douglas Gregor [Thu, 7 Jul 2011 16:03:39 +0000 (16:03 +0000)]
Introduce a new libclang aPI function,
clang_codeCompleteGetContexts(), that provides the client with
information about the context in which code completion has occurred
and what kinds of entities make sense as completions at that
point. Patch by Connor Wakamo!

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

13 years agoIf we're using the pure non-fragile ABI, then skip some of the contortions required...
David Chisnall [Thu, 7 Jul 2011 12:34:51 +0000 (12:34 +0000)]
If we're using the pure non-fragile ABI, then skip some of the contortions required to support the transitional ABI.

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

13 years agoSet a flag to tell the runtime when we're compiling in ARC mode and use the pure...
David Chisnall [Thu, 7 Jul 2011 11:22:31 +0000 (11:22 +0000)]
Set a flag to tell the runtime when we're compiling in ARC mode and use the pure-nonfragile ABI for both ARC and GC mode.

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

13 years agoFix example: variable is initialized to 10 and then has 11 stored in it, but in the...
David Chisnall [Thu, 7 Jul 2011 09:49:59 +0000 (09:49 +0000)]
Fix example: variable is initialized to 10 and then has 11 stored in it, but in the expanded version is initialized to 11.

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

13 years agoIn ARC, reclaim all return values of retainable type, not just those
John McCall [Thu, 7 Jul 2011 06:58:02 +0000 (06:58 +0000)]
In ARC, reclaim all return values of retainable type, not just those
where we have an immediate need of a retained value.

As an exception, don't do this when the call is made as the immediate
operand of a __bridge retain.  This is more in the way of a workaround
than an actual guarantee, so it's acceptable to be brittle here.

rdar://problem/9504800

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

13 years ago[arcmt] Add -ccc-arcmt-check/-ccc-arcmt-modify driver option aliases.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 04:00:39 +0000 (04:00 +0000)]
[arcmt] Add -ccc-arcmt-check/-ccc-arcmt-modify driver option aliases.

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

13 years agoSort #includes.
Nick Lewycky [Thu, 7 Jul 2011 03:54:51 +0000 (03:54 +0000)]
Sort #includes.

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

13 years agoWhen expanding macro arguments, treat '##' coming from an argument as a normal token.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 03:40:37 +0000 (03:40 +0000)]
When expanding macro arguments, treat '##' coming from an argument as a normal token.

e.g.

#define M(x) A x B
M(##) // should expand to 'A ## B', not 'AB'

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

13 years agoMake the Preprocessor more memory efficient and improve macro instantiation diagnostics.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 03:40:34 +0000 (03:40 +0000)]
Make the Preprocessor more memory efficient and improve macro instantiation diagnostics.

When a macro instantiation occurs, reserve a SLocEntry chunk with length the
full length of the macro definition source. Set the spelling location of this chunk
to point to the start of the macro definition and any tokens that are lexed directly
from the macro definition will get a location from this chunk with the appropriate offset.

For any tokens that come from argument expansion, '##' paste operator, etc. have their
instantiation location point at the appropriate place in the instantiated macro definition
(the argument identifier and the '##' token respectively).
This improves macro instantiation diagnostics:

Before:

t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
int y = M(/);
        ^~~~
t.c:5:11: note: instantiated from:
int y = M(/);
          ^

After:

t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int')
int y = M(/);
        ^~~~
t.c:3:20: note: instantiated from:
\#define M(op) (foo op 3);
                ~~~ ^  ~
t.c:5:11: note: instantiated from:
int y = M(/);
          ^

The memory savings for a candidate boost library that abuses the preprocessor are:

- 32% less SLocEntries (37M -> 25M)
- 30% reduction in PCH file size (900M -> 635M)
- 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M)

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

13 years agoFix bug in SourceManager::getDecomposedInstantiationLocSlowCase.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 03:40:27 +0000 (03:40 +0000)]
Fix bug in SourceManager::getDecomposedInstantiationLocSlowCase.

It would add up relative (decomposed) offsets like in getDecomposedSpellingLocSlowCase, but while
it makes sense to preserve the offset among lexed spelling locations, it doesn't make
sense to add anything to the offset of the instantiation location. The instantiation
location will be the same regardless of the relative offset in the tokens that were
instantiated.

This bug didn't actually affect anything because, currently, in practice we never create macro
locations with relative offset greater than 0.

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

13 years agoFor -print-stats, add the number of bytes that SLocEntryTable consumes.
Argyrios Kyrtzidis [Thu, 7 Jul 2011 03:40:24 +0000 (03:40 +0000)]
For -print-stats, add the number of bytes that SLocEntryTable consumes.

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