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

31293 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor c0244c5c35 Look through SubstNonTypeTemplateParmExpr nodes in the various
Expr::Ignore* methods that also look through implicit casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139303 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:56:33 +00:00
Caitlin Sadowski ed9d84a211 Thread safety: added support for function scopes in attribute arguments.
This patch was written by DeLesley Hutchins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139302 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:42:31 +00:00
Caitlin Sadowski eff98fc356 Thread Safety: Patch to implement delayed parsing of attributes within a
class scope.

This patch was also written by DeLesley Hutchins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139301 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:42:22 +00:00
Douglas Gregor aebb653a28 Document __has_feature(objc_instancetype).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139299 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:19:31 +00:00
Argyrios Kyrtzidis 8f7c540ac4 [libclang] Fix annotation and getting a "macro expansion" cursor
for a builtin macro expansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139298 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:18:41 +00:00
Douglas Gregor 5471bc85b6 Allow C++0x enumerations with a fixed underlying type in
Objective-C. The @encode'ing of such an enumeration type is the same
as its underlying type. <rdar://problem/5276348>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139297 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:18:35 +00:00
Eric Christopher 6aff47db98 Formatting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139296 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:15:04 +00:00
Eric Christopher 29f39425fc Add a block comment explaining how the different source locations work
including some source examples.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139295 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 17:15:01 +00:00
Abramo Bagnara 62f940bff1 Added missing initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139291 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 14:20:25 +00:00
David Blaikie 14068e83f3 Adding FixIts to static/inline main declaration diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139282 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 06:33:04 +00:00
Douglas Gregor e97179c675 Implement the Objective-C 'instancetype' type, which is an alias of
'id' that can be used (only!) via a contextual keyword as the result
type of an Objective-C message send. 'instancetype' then gives the
method a related result type, which we have already been inferring for
a variety of methods (new, alloc, init, self, retain). Addresses
<rdar://problem/9267640>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139275 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 01:46:34 +00:00
Chad Rosier 4fe4d73bce [driver] i386 kext preprocessor jobs also need their unsupported options
filtered.  This happenis when -save-temps is specified. 
<rdar://problem/10088387>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139269 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 00:38:00 +00:00
Douglas Gregor b8db7cd9ac Optimize the preprocessor's handling of the __import_module__
keyword. We now handle this keyword in HandleIdentifier, making a note
for ourselves when we've seen the __import_module__ keyword so that
the next lexed token can trigger a module import (if needed). This
greatly simplifies Preprocessor::Lex(), and completely erases the 5.5%
-Eonly slowdown Argiris noted when I originally implemented
__import_module__. Big thanks to Argiris for noting that horrible
regression!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 23:11:54 +00:00
Argyrios Kyrtzidis 0e2ca014bd [arcmt] Try fixing the windows buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139262 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 21:50:18 +00:00
Argyrios Kyrtzidis a3e9a969fd Revert r139222, operator->() in PreprocessingRecord::iterator. It is useful
to meet the requirements of the InputIterator concept.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139261 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 21:50:10 +00:00
Richard Trieu 5520f23edb Change diagnoseAddressOfInvalidType() to use an enum to determine what error message to display. Also, move the function call into on location instead of having it spread among many places in the if/else statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139260 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 21:46:33 +00:00
Douglas Gregor 2eef427c86 When parsing a function-try-block that does not have a
ctor-initializer, remember to call the Sema action to generate default
ctor-initializers. What a delightful little miscompile. Fixes PR10578
/ <rdar://problem/9877267>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139253 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 20:36:12 +00:00
Kaelyn Uhrain 82340e8cbd Fix Sema::CorrectTypo to ignore found but unresolved symbols
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139252 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 20:25:59 +00:00
Peter Collingbourne 3f5af5d793 More missing dependencies picked up by Ninja.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139248 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 19:12:36 +00:00
James Molloy 066d502b2d Fix up MCInstPrinter creation to take the new SubtargetInfo parameter (see LLVM r139237)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139238 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-07 17:25:30 +00:00
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