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

1962 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson 15281450f5 Make it an error if an Objective-C declaration is not in the global scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 16:57:32 +00:00
Chris Lattner 21ef7ae45c LinkageSpecDecl is c++ specific, move it to DeclCXX
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58704 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 16:51:42 +00:00
Sebastian Redl f7be9448af Some cleanup of the cast checkers. Don't canonicalize types when not needed. Use distinct diagnostics for distinct errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58700 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 15:59:10 +00:00
Douglas Gregor cd9b46e544 Add a new expression class, ObjCSuperExpr, to handle the Objective-C 'super'. Remove ObjCThis from PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58698 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:56:14 +00:00
Douglas Gregor 796da18402 Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary expression. Remove CXXThis from PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:32:21 +00:00
Douglas Gregor 3996f23ac2 Diagnose use of 'this' in a C++ default argument. Thanks to Eli for correcting my bogus assertion about it already being handled
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 13:41:56 +00:00
Steve Naroff b2f9e51632 Fix <rdar://problem/6339636> clang ObjC rewriter: Assertion failed: FileID-1 < FileIDs.size() && "Invalid FileID!", file c:\cygwin\home\Administrator\llvm\tools\clang\include\clang/Basic/SourceManager.h, line 513
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58654 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 23:29:32 +00:00
Ted Kremenek 4fc82c8458 Hook up the Plist diagnostic client to the driver.
Fix Plist output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 23:18:07 +00:00
Ted Kremenek 5d86625633 Add path diagnostics client for emitting path reports using Plists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58647 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 22:33:57 +00:00
Ted Kremenek ad99dbfc1d Rename 'HTMLDiagnostics.h' to 'PathDiagnosticClients.h'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 22:31:48 +00:00
Douglas Gregor 18fe56863b Implicit support for direct initialization of objects of class type, e.g.,
X x(5, 7);




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58641 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 20:45:27 +00:00
Douglas Gregor 396b7cd9f6 Add implicitly-declared default and copy constructors to C++ classes,
when appropriate.

Conversions for class types now make use of copy constructors. I've
replaced the egregious hack allowing class-to-class conversions with a
slightly less egregious hack calling these conversions standard
conversions (for overloading reasons).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 17:51:48 +00:00
Douglas Gregor d934112e61 Eliminate header dependency ASTContext -> TargetInfo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 15:57:00 +00:00
Douglas Gregor f1f9b4e5c7 Implement C++ DR 106 and C++ DR 540, both of which deal with
reference-collapsing. 

Implement diagnostic for formation of a reference to cv void.

Drop cv-qualifiers added to a reference type when the reference type
comes from a typedef.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58612 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 15:51:28 +00:00
Douglas Gregor b4e66d5259 Connect ASTContext to TargetInfo when determining the size_t, ptrdiff_t, and wchar_t types. Fixes recent breakage on Linux.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 14:12:49 +00:00
Chris Lattner e2f56196e9 Fix PR3001: if we have an error parsing an initializer, make sure to remove
the designator corresponding to it, otherwise Sema and later parsing will
get confused.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 09:28:22 +00:00
Zhongxing Xu 817c67daf8 - Remove AnonTypedRegion, which is not to be used.
- Prepare AnonPointeeRegioin for later use.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58595 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 04:12:24 +00:00
Ted Kremenek 7090ae1a98 Added AllocaRegion, which represents regions created by calls to alloca().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58551 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-02 00:34:33 +00:00
Douglas Gregor 030ff0cdad Semantic checking of constructor declarations and classification of default/copy constructors
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58538 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 20:25:05 +00:00
Douglas Gregor 60d62c29d2 Implement basic support for converting constructors in user-defined
conversions.

Notes:
  - Overload resolution for converting constructors need to prohibit
    user-defined conversions (hence, the test isn't -verify safe yet).
  - We still use hacks for conversions from a class type to itself. 
    This will be the case until we start implicitly declaring the appropriate
    special member functions. (That's next on my list)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 16:23:19 +00:00
Sebastian Redl 0777972d38 Implement semantic checking of static_cast and dynamic_cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 14:43:28 +00:00
Sanjiv Gupta 31fc07df7f Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wchar
etc more generic. For some targets, long may not be equal to pointer size. For
example: PIC16 has int as i16, ptr as i16 but long as i32.

Also fixed a few build warnings in assert() functions in CFRefCount.cpp,
CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 09:52:39 +00:00
Douglas Gregor b48fe38120 Add support for parsing and representing C++ constructor declarations.
Notes:
  - Constructors are never found by name lookup, so they'll never get
    pushed into any scope. Instead, they are stored as an 
    OverloadedFunctionDecl in CXXRecordDecl for easy overloading.
  - There's a new action isCurrentClassName that determines whether an
    identifier is the name of the innermost class currently being defined;
    we use this to identify the declarator-id grammar rule that refers to 
    a type-name. 
  - MinimalAction does *not* support parsing constructors.
  - We now handle virtual and explicit function specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 09:07:45 +00:00
Daniel Dunbar e10b0f236b "One" line fix for -parse-noop failure, "id" and several other things
were being treated as type names for non-Objective-C files.
 - Other lines are just because MinimalAction didn't have access to
   the LangOptions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 08:56:51 +00:00
Zhongxing Xu 77cfac6231 Make CompoundLiteralRegion a subclass of TypedRegiion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58493 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 06:30:35 +00:00
Ted Kremenek 11a83dc7a9 Add accessor method to CompoundLiteralRegion to retrieve the CompoundLiteralExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 00:04:54 +00:00
Ted Kremenek b8b4161e52 Pretty-printing for SVals now mainly uses llvm::raw_ostream. We have an adapter for std::ostream, but this will be removed in the future.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58445 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 18:35:10 +00:00
Ted Kremenek a6fac4e446 Added iterators to nonloc::CompoundSVal.
Added pretty-printing for nonloc::CompoundSVal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 18:01:28 +00:00
Ted Kremenek a693d4fa7a Update #includes since SVals.h no longer includes BasicValueFactory.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58439 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 17:46:51 +00:00
Ted Kremenek 7fcfa4a9b5 Add iterator/reverse_iterator to InitListExpr for iteration over the subexpressions of an initializer list. This is basically the same as child_iterator except reverse iteration is possible (which will be used by GRExprEngine::VisitInitListExpr).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58438 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 17:45:53 +00:00
Ted Kremenek 632e8b8497 CompoundVal now uses an ImmutableList<SVal> to store its set of SVals. This change was motivated by the need to allow state-splitting in GRExprEngine::VisitInitListExpr. As a side-benefit, we no longer need to perform any copies of SVals when creating a CompoundSVal, and the profiling of CompoundSVal is now constant time.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58437 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 17:44:46 +00:00
Zhongxing Xu 8cd5aaea92 Rename:
- SetSVal(GRState*, Loc, SVal) => BindLoc
 - SetSVal(GRState*, Expr*, SVal) => BindExpr 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 05:33:54 +00:00
Zhongxing Xu c4f8706b65 Implement VisitInitListExpr(). InitListExpr will have a nonloc::CompoundVal value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 05:02:23 +00:00
Zhongxing Xu 6764b72f6f Add CompoundVal and CompoundValData for representing the value of InitListExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 04:58:00 +00:00
Douglas Gregor f7c2aa0b04 Make the non-reference check in Expr work always
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58388 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 18:00:54 +00:00
Daniel Dunbar 8e8f3b7f61 Choose CompileOptions (optimization passes) to match llvm-gcc more
closely.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 03:42:18 +00:00
Zhongxing Xu 8b2e05d9ee Rename: AddDecl => BindDecl
BindDecl better describes what the function does:
  - Bind the VarDecl to its memory region
  - Bind the memory region to some initial value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 02:34:02 +00:00
Zhongxing Xu ce63911d6b MemSpaceRegions could be uninitialized. We only require R is a real region.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 01:13:28 +00:00
Douglas Gregor 27c8dc06f6 Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle:

  - Try/Perform-ImplicitConversion now handles implicit conversions
    that don't involve references.
  - Try/Perform-CopyInitialization uses
    CheckSingleAssignmentConstraints for C. PerformCopyInitialization
    is now used for all argument passing and returning values from a
    function.
  - Diagnose errors with declaring references and const values without
    an initializer. (Uses a new Action callback, ActOnUninitializedDecl).
  
We do not yet have implicit conversion sequences for reference
binding, which means that we don't have any overloading support for
reference parameters yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 00:13:59 +00:00
Daniel Dunbar 8320aaaa01 80-col fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 19:12:58 +00:00
Douglas Gregor 6eec8e883d Rename ExplicitCCastExpr to CStyleCastExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 15:36:24 +00:00
Zhongxing Xu c540b261ac Add isGlobalsRegion() predicate to MemRegionManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 05:15:23 +00:00
Chris Lattner 21ec0e4c5d clarify comment, rename argument to avoid a subtle conflict
with an ivar that wasn't a bug but was confusing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58311 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 01:02:17 +00:00
Douglas Gregor 9d293dfc0a Improve our handling of (C++) references within Clang. Specifically:
- Do not allow expressions to ever have reference type
  - Extend Expr::isLvalue to handle more cases where having written a
    reference into the source implies that the expression is an lvalue
    (e.g., function calls, C++ casts).
  - Make GRExprEngine::VisitCall treat the call arguments as lvalues when
    they are being bound to a reference parameter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 00:22:11 +00:00
Daniel Dunbar af668b0e7d Add attribute always_inline support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58304 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 00:17:57 +00:00
Ted Kremenek 0d958e7066 - Fix type-punning warning in SVals.cpp by using a real iterator class for symbol_iterator.
- Add symbol_iterator support for SymbolicRegions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58300 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 23:39:39 +00:00
Daniel Dunbar d6a1c5daec Comment fix, ParseAST does not take ownership of the consumer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58281 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 22:01:05 +00:00
Ted Kremenek 4f09027385 Added preliminary support for CompoundLiterals in the static analyzer:
- GRExprEngine::VisitCompoundLiteral...
   (1) visits the initializer list (generating ExplodedNodes)
   (2) creates a CompoundMemRegion for the literal
   (3) creates a new state with the bound literal values using
       GRStateManager::BindCompoundLiteral

- GRStateManager::BindCompoundLiteral simply calls 
  StoreManager::BindCompoundLiteral to get a new store and returns a persistent
  GRState with that store.

- BasicStore::BindCompoundLiteral simply returns the same store, as it
  doesn't handle field sensitivity
  
- RegionStore::BindCompoundLiteral currently fires an assert (pending discussion
  of how to best implement mappings for CompoundLiteralRegion).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 21:54:31 +00:00
Ted Kremenek 9a1f03afc5 Pull determination of the super region for a VarRegion into a single getVarRegion() method. This provides a common clean API for clients.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58272 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 21:01:26 +00:00
Ted Kremenek 329d6fde79 Added CompoundLiteralRegion to represent the (temporary) memory allocated for a compound literal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58270 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 20:57:58 +00:00