Граф коммитов

31273 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian edc08821d3 objc-gc: More sema work for properties declared 'weak'
in GC mode. // rdar://10073896


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139235 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 16:24:21 +00:00
Chandler Carruth 5770bb707d Extract the emission of the diagnostic's location into a separate
function. This is really the beginning of the second phase of
refactorings here. The end goal is to have (roughly) three interfaces:

1) Base class to format a single diagnostic suitable for display on the
   console.
2) Extension of the base class which also displays a caret diagnostic
   suitable for display on the console.
3) An adaptor that implements the DiagnosticClient by delegating to #1
   and/or #2 as appropriate.

Once we have these, things like libclang's formatDiagnostic can use #1
and #2 to provide really well formatted (and consistently formatted!)
textual formatting of diagnostics.

Getting there is going to be quite a bit of shuffling. I'm basically
sketching out where the interface boundaries can be drawn for #1 and #2
within the existing classes. That lets me shuffle with a minimum of fuss
and delta. Once that's done, and any of the related interfaces that need
to change are updated, I'll hoist these into separate headers and
re-implement libclang in terms of their interfaces. Long WIP, but
comments at each step welcome. =D

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139228 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 08:05:58 +00:00
Chandler Carruth 6c57ccec99 Move the HilightRange method from TextDiagnosticPrinter down to
CaretDiagnostic. It's completely generic, with nothing to do with the
diagnostic client or info APIs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139227 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 07:02:31 +00:00
Chandler Carruth d2156fcd15 Hoist the tab expansion into a helper function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139226 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 05:36:50 +00:00
Chandler Carruth 0580e7dcce Don't compute the same line number in two places, once inside a loop.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139225 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 05:01:10 +00:00
Eli Friedman 900693b715 Make sure the FunctionDecl's created by "#pragma weak" have correct ParmVarDecl's. PR10878.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139224 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 04:05:06 +00:00
Argyrios Kyrtzidis 6015969a51 [arcmt] Remove xfail on test for windows, Takumi reported that it passes mingw and msvc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139223 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 03:43:41 +00:00
Argyrios Kyrtzidis a1e99cc7e9 operator->() in PreprocessingRecord::iterator is useless since we
are returning a pointer to pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139222 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 03:43:39 +00:00
Richard Trieu befece14a3 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
DiagnoseLogicalAndInLogicalOrLHS()
DiagnoseBinOpPrecedence()
ActOnBinOp()
BuildBinOp()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139219 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 02:02:10 +00:00
Richard Trieu 78ea78bda1 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
CreateBuiltinBinOp()
DiagnoseBitwisePrecedence()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139218 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 01:49:20 +00:00
Chandler Carruth 5182a1858f Switch the CharSourceRange array to a small vector. The array was
a stack array of a magical size with an assert() that we never
overflowed it. That seems incredibly risky. We also have a very nice API
for bundling up a vector we expect to usually have a small size without
loss of functionality or security if the size is excessive.

The fallout is to remove the last pointer+size parameter pair that are
traced through the recursive caret diagnostic emission.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139217 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 01:47:09 +00:00
Eli Friedman c83b975f1f Switch clang over to using fence/atomicrmw/cmpxchg instead of the intrinsics (which will go away). LLVM CodeGen does almost exactly the same thing with these and the old intrinsics, so I'm reasonably confident this will not break anything.
There are still a few issues which need to be resolved with code generation for atomic load and store, so I'm not converting the places which need those for now.

I'm not entirely sure what to do about __builtin_llvm_memory_barrier: the fence instruction doesn't expose all the possibilities which can be expressed by __builtin_llvm_memory_barrier.  I would appreciate hearing from anyone who is using this intrinsic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139216 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 01:41:24 +00:00
Richard Trieu 268942b224 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
CheckAssignmentOperands()
DiagnoseSelfAssignment()
checkArithmeticNull()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139215 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 01:33:52 +00:00
Richard Trieu 9f60dee66e Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
CheckVectorCompareOperands()
CheckBitwiseOperands()
CheckLogicalOperands()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139214 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 01:19:57 +00:00
Richard Trieu 47eb89871e Change the self-reference visitor (which gives the warning for self-reference oninitalization warning of -Wuninitialized) to exclude member variables that can decay into pointers. This will cause it to no longer warn on this code:
struct foo { char a[100], *e; } bar = { .e = bar.a };


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139213 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 00:58:53 +00:00
Fariborz Jahanian 9a776695e9 objc-gc: Don't force a __strong type'd property
to be 'weak'. This prevents a crash and should 
probably be flagged as error - later to come.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139211 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 00:38:49 +00:00
Francois Pichet 0f74d1e441 In Microsoft mode, if we are inside a template class member function and we can't resolve a function call then create a type-dependent CallExpr even if the function has no type dependent arguments. The goal is to postpone name lookup to instantiation time to be able to search into type dependent base classes.
With this patch in, clang will generate only 37 errors (down from 212) when parsing a typical MFC source file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139210 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 00:14:57 +00:00
Chad Rosier 46e3908af1 [driver] When clang crashes, don't try to generate diagnostics (i.e.,
preprocessor output) with multiple -arch options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139207 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 23:52:36 +00:00
Fariborz Jahanian 4019f7d384 objc-gc: Adds support for "weak" property attribute under GC.
// rdar://10073896


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139203 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 23:32:40 +00:00
Chandler Carruth c79a0d22f8 Remove the doxyment for this now defunct parameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139197 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 22:34:36 +00:00
Chandler Carruth f15651a3af Don't recompute the presumed loc twice in 5 lines of code... Spotted by
inspection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139196 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 22:34:33 +00:00
Chandler Carruth 8a7b3f73d0 Use ArrayRef for the fixit hint array rather than a pointer and a size.
Clean up loops over the hints to use the more idiomatic iterator form in
LLVM and Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139195 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 22:31:44 +00:00
Chandler Carruth 682630ccaa Hoist the construction of the FixItHint line into a member function with
a defined interface. This isn't as nice as the previous one, but should
get better as I push through better data types in all these functions.

Also, I'm hoping to pull some aspects of this out into a common routine
(such as tab expansion).

Again, WIP, comments welcome as I'm going through.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139190 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 22:01:04 +00:00
Richard Trieu f1775fb108 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
CheckCompareOperands()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139187 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 21:43:51 +00:00
Douglas Gregor 1ddc9c4674 When extracting the callee declaration from a call expression, be sure
to look through SubstNonTypeTemplateParmExprs. Then, update the IR
generation of CallExprs to actually use CallExpr::getCalleeDecl()
rather than attempting to mimick its behavior (badly).

Fixes <rdar://problem/10063539>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139185 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 21:41:04 +00:00
Richard Trieu ba26149eb7 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
checkEnumComparison()
diagnoseDistinctPointerComparison()
convertPointersToCompositeType()
diagnoseFunctionPointerToVoidComparison()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139184 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 21:27:33 +00:00
Richard Trieu 1c8cfbfc8b Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
DiagnoseBadShiftValues()
CheckShiftOperands()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139183 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 21:21:28 +00:00
Richard Trieu def75847c5 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
diagnoseArithmeticOnTwoVoidPointers()
checkArithmeticBinOpPointerOperands()
diagnosePointerIncompatibility()
CheckAdditionOperands()
CheckSubtractionOperands()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139182 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 21:13:51 +00:00
Richard Trieu 08062aaaa5 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
CheckVectorOperands()
CheckMultiplyDivideOperands()
CheckRemainderOperands()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139181 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 21:01:04 +00:00
Ted Kremenek f1bb0b049f Place 'equality comparison with extraneous parentheses...' into a subgroup of -Wparentheses called -Wparentheses-equality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139180 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 20:58:32 +00:00
Douglas Gregor f8b7f7177d Implement the Named Return Value Optimization (NRVO) for blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139178 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 20:46:03 +00:00
Richard Trieu f7720da157 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
CheckTransparentUnionArgumentConstraints()
CheckSingleAssignmentConstraints()
InvalidOperands()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139176 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 20:40:12 +00:00
Douglas Gregor f7603f6ca7 Implement the Named Return Value Optimization (NRVO) for Objective-C++
methods. Fixes PR10835 / <rdar://problem/10050178>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139175 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 20:33:37 +00:00
Richard Trieu facef2ef39 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
CheckAssignmentConstraints()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139173 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 20:30:53 +00:00
Richard Trieu 1da27a1caa Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
checkPointerTypesForAssignment()
checkBlockPointerTypesForAssignment()
checkObjCPointerTypesForAssignment()
CheckAssignmentConstraints()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139170 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 20:21:22 +00:00
Richard Trieu 33fc757102 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
DiagnoseConditionalForNull()
CheckConditionalOperands()
IsArithmeticBinaryExpr()
DiagnoseConditionalPrecedence()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139167 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 20:06:39 +00:00
Benjamin Kramer 5cc86807bb Spelling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139165 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 19:57:14 +00:00
Richard Trieu 2e8a95dd3c Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
handleIntegerConversion()
UsualArithmeticConversions()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139164 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 19:52:52 +00:00
Ted Kremenek ae5860e178 Don't emit -Wpadded warnings without a valid SourceLocation. This can happen when RecordLayoutBuilder is used by Codegen, not Sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139162 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 19:40:45 +00:00
Eli Friedman 576cf17055 Rearrange code so that we pass the right pointer to delete[] when an exception is thrown constructing the array elements in an array new expression. Fixes PR10870.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139158 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 18:53:03 +00:00
Richard Trieu 8ef5c8ef41 Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
handleFloatConversion()
handleComplexIntConvsersion()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139153 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 18:38:41 +00:00
Richard Trieu cafd30b4cd Rename variables in SemaExpr.cpp to give a more consistant naming scheme.
ExprResult LHS, RHS,
Expr *LHSExpr, *RHSExpr
QualType LHSType, RHSType

Functions changed:
handleComplexFloatToComplexFloatConverstion()
handleComplexFloatConversion()


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139151 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 18:25:09 +00:00
Richard Smith 7640c00703 Advertise support for cxx_range_for as an extension in C++98 mode. Patch by Jean-Daniel Dupas!
Also provide a modicum of test coverage for ranged for in C++98.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139149 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 18:03:41 +00:00
Douglas Gregor 58e9797d00 Finish implementing (de-)serialization of the CXXDefinitionData bits
needed for implicit move constructors and move assignment
operators. Fixes PR10847.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139144 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 16:38:46 +00:00
Douglas Gregor b2b5658a8e When performing a derived-to-base cast on the right-hand side of the
synthesized move assignment within an implicitly-defined move
assignment operator, be sure to treat the derived-to-base cast as an
xvalue (rather than an lvalue). Otherwise, we'll end up getting the
wrong constructor.

Optimize a direct call to a trivial move assignment operator to an
aggregate copy, as we do for trivial copy assignment operators, and
update the the assertion in CodeGenFunction::EmitAggregateCopy() to
cope with this optimization.

Fixes PR10860.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139143 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 16:26:56 +00:00
Richard Smith 2315318436 PR10867: Work around a bug in lit. Multiple RUN: lines are joined with &&, so:
RUN: foo
  RUN: bar || true

is equivalent to:

  RUN: foo && bar || true

which is equivalent to:

  RUN: (foo && bar) || true

This resulted in several of the fixit tests not really testing anything.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139132 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 03:01:15 +00:00
Peter Collingbourne 335a13f069 Add missing dependency
Spotted by Ninja.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139129 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 02:08:40 +00:00
Peter Collingbourne edc41e163c Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 02:08:36 +00:00
Peter Collingbourne 41ee7a3717 Add the resource directory to the search path for Driver::GetFilePath,
as well as the search path printed by -print-search-dirs.

The main purpose of this change is to cause -print-file-name=include
to print the path to the include directory under Clang's resource
directory, instead of the system compiler's include directory, whose
header files Clang may not be able to parse.  Some build scripts will
do something like:
  $(CC) -nostdinc -I`$(CC) -print-file-name=include`
to exclude all header paths except the compiler's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139127 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-06 02:08:31 +00:00
Benjamin Kramer 1daa58ea89 Speed up BCPL comment lexing by looking aggressively for newlines and then scannig backwards to see if the newline is escaped.
3% speedup in preprocessing all of clang with -Eonly. Also includes a small testcase for coverage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139116 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-05 07:19:39 +00:00