Commit Graph

7305 Commits

Author SHA1 Message Date
Sebastian Redl
e0b2b1bf8c Update C++ status: class support improved due to nested name parsing.
llvm-svn: 58932
2008-11-09 11:32:32 +00:00
Argyrios Kyrtzidis
16ac9be7f0 Implement Sema support for C++ nested-name-specifiers.
llvm-svn: 58916
2008-11-08 17:17:31 +00:00
Argyrios Kyrtzidis
430a58edd8 Silence a GCC member initialization order warning.
llvm-svn: 58914
2008-11-08 16:47:38 +00:00
Argyrios Kyrtzidis
32a0379575 Implement support for C++ nested-name-specifiers ('foo::bar::x') in the Parser side.
No Sema functionality change, just the signatures of the Action/Sema methods.

llvm-svn: 58913
2008-11-08 16:45:02 +00:00
Argyrios Kyrtzidis
c7e67a04c3 Introduce annotation tokens, a special kind of token, created and used only by the parser to replace a group of tokens with a single token encoding semantic information.
Will be fully utilized later for C++ nested-name-specifiers.

llvm-svn: 58911
2008-11-08 16:17:04 +00:00
Sebastian Redl
f4485de48a Update C++ status to reflect parser capabilities for chapter 9 (classes). Slightly extend the class parser test.
llvm-svn: 58909
2008-11-08 15:40:37 +00:00
Sebastian Redl
2e133e47aa Update C++ status: dynamic_cast is sema-complete.
llvm-svn: 58907
2008-11-08 14:43:13 +00:00
Sebastian Redl
842ef52ff3 Move named cast helpers out of Sema, as Chris requested. This requirse making a few functions public that weren't before.
llvm-svn: 58906
2008-11-08 13:00:26 +00:00
Argyrios Kyrtzidis
0d9ee2eb2e Revert r58880, it breaks test/SemaCXX/constructor.cpp
llvm-svn: 58904
2008-11-08 12:02:25 +00:00
Argyrios Kyrtzidis
13042a4a4a Use only one constructor for CXXMethodDecl. Keep initialization stuff into one place.
llvm-svn: 58902
2008-11-08 11:24:06 +00:00
Daniel Dunbar
238475c8ca Avoid redundant cast<>s / simplify type dispatch.
llvm-svn: 58892
2008-11-08 06:12:46 +00:00
Daniel Dunbar
bbc0af7e37 Support getTypeInfo, getTypeAlign, getTypeSize on const Type*s.
- Size/align are not effected by CVR qualifiers.

Support getCanonicalType: const Type* -> const Type*.

llvm-svn: 58891
2008-11-08 05:48:37 +00:00
Daniel Dunbar
8ec8048f93 "Fix" PR3021, don't crash on generating record types when we can't
generate the type of a member.

llvm-svn: 58889
2008-11-08 04:42:29 +00:00
Daniel Dunbar
ad0a0f9cd2 Silence a gcc warning.
llvm-svn: 58888
2008-11-08 04:28:37 +00:00
Zhongxing Xu
3d43015bc7 Add a boilerplate for out-of-bound array checking. This has no real function currently.
llvm-svn: 58886
2008-11-08 03:45:42 +00:00
Argyrios Kyrtzidis
19b66a5e32 In a declarator, consider an identifier a constructor only if it is followed by '('.
Previously:

class C {
  int C;  // Declarator::SetConstructor was called here.
};

llvm-svn: 58880
2008-11-08 01:09:16 +00:00
Ted Kremenek
58b1c2d54a update post-build step
llvm-svn: 58878
2008-11-08 01:02:26 +00:00
Sebastian Redl
015085fafa Greatly improve static_cast diagnostics
llvm-svn: 58873
2008-11-07 23:29:29 +00:00
Douglas Gregor
a1f013e8ed Initial, partially-baked support for implicit user-defined conversions by conversion functions
llvm-svn: 58870
2008-11-07 22:36:19 +00:00
Cedric Venet
571c662350 Use css style instead of hard coded color in cxx_status. No visible change.
llvm-svn: 58867
2008-11-07 22:24:44 +00:00
Argyrios Kyrtzidis
e442635c37 Changes in preparation for nested-name-specifiers.
-When parsing declarators, don't depend on "CurScope->isCXXClassScope() == true" for constructors/destructors
-For C++ member declarations, don't depend on "Declarator.getContext() == Declarator::MemberContext"

llvm-svn: 58866
2008-11-07 22:02:30 +00:00
Ted Kremenek
47a6235491 Updated checker build.
llvm-svn: 58864
2008-11-07 20:55:59 +00:00
Douglas Gregor
60e64cfc43 Update C++ status
llvm-svn: 58862
2008-11-07 20:16:04 +00:00
Douglas Gregor
dbc5daf058 Parsing, ASTs, and semantic analysis for the declaration of conversion
functions in C++, e.g.,

  struct X {
    operator bool() const;
  };

Note that these conversions don't actually do anything, since we don't
yet have the ability to use them for implicit or explicit conversions.

llvm-svn: 58860
2008-11-07 20:08:42 +00:00
Argyrios Kyrtzidis
56fa31bc87 Assert that Parser::MaybeParseOperatorFunctionId is called when token is kw_operator, and replace ExpectAndConsume for the 'operator' token with a ConsumeToken.
llvm-svn: 58855
2008-11-07 15:54:02 +00:00
Douglas Gregor
450c75a15f Separate the parsing of type-specifiers from other declaration specifiers, so that we can parse a C++ type-specifier-seq
llvm-svn: 58854
2008-11-07 15:42:26 +00:00
Anders Carlsson
aaa183e944 include alloca.h instead of malloc.h. If this doesn't work for everyone we can just declare alloca directly in the file.
llvm-svn: 58853
2008-11-07 15:41:33 +00:00
Argyrios Kyrtzidis
a848ced426 Append the test runs with '&&'.
llvm-svn: 58851
2008-11-07 14:28:18 +00:00
Argyrios Kyrtzidis
3175fa5139 Properly deserialize ParamInfo of FunctionDecl.
When allocating an array for ParamInfo, the "decl->getNumParams()" call was used, but this will return 0 since it checks ParamInfo (which isn't yet defined and is null).
The result was that ParamInfo got an array of zero length to hold the ParmVarDecls.

llvm-svn: 58850
2008-11-07 14:22:23 +00:00
Argyrios Kyrtzidis
c118934d12 Bring in 'alloca' for the Analysis/stack-addr-ps.c test case.
llvm-svn: 58849
2008-11-07 14:00:25 +00:00
Zhongxing Xu
86d6d9b5bf Add simple get method.
llvm-svn: 58848
2008-11-07 13:13:41 +00:00
Zhongxing Xu
f66d0a187f Join two lines.
llvm-svn: 58847
2008-11-07 13:05:39 +00:00
Argyrios Kyrtzidis
6709e7d4cc Fix crash caused by this:
void f() {
   int +; // crash here
}

llvm-svn: 58846
2008-11-07 13:01:22 +00:00
Argyrios Kyrtzidis
f2ad9491f5 Shut off an unsigned/signed comparison warning for GCC.
llvm-svn: 58842
2008-11-07 12:15:16 +00:00
Zhongxing Xu
2c677c34d5 Finish the implementation of VisitCompoundLiteralExpr. As VisitInitListExpr is
available, things get much simplified.

One addition is that CompoundLiteralExpr can appear both in rvalue and lvalue
context.

llvm-svn: 58837
2008-11-07 10:38:33 +00:00
Zhongxing Xu
e79a4e667b Make the assertion real.
llvm-svn: 58833
2008-11-07 08:57:30 +00:00
Ted Kremenek
3391cb00fc Patch by Nikita Zhuk: Add TranslationUnitActions to AnalysisConsumer.
llvm-svn: 58831
2008-11-07 02:09:25 +00:00
Douglas Gregor
7d5fc7e28b Initial, rudimentary implementation of operator overloading for binary
operators. For example, one can now write "x + y" where x or y is a
class or enumeration type, and Clang will perform overload resolution
for "+" based on the overloaded operators it finds.

The other kinds of overloadable operators in C++ will follow this same
approach. 

Three major issues remain:
  1) We don't find member operators
  2) Since we don't have user-defined conversion operators, we can't
  call any of the built-in overloaded operators in C++ [over.built].
  3) Once we've done the semantic checks, we drop the overloaded
  operator on the floor; it doesn't get into the AST at all.

llvm-svn: 58821
2008-11-06 23:29:22 +00:00
Douglas Gregor
11d0c4c098 Parsing, ASTs, and semantic analysis for the declaration of overloaded
operators in C++. Overloaded operators can be called directly via
their operator-function-ids, e.g., "operator+(foo, bar)", but we don't
yet implement the semantics of operator overloading to handle, e.g.,
"foo + bar".

llvm-svn: 58817
2008-11-06 22:13:31 +00:00
Douglas Gregor
2ad7ee9145 Reclaim some bits in IdentifierInfo, for later use as overloaded operator names.
llvm-svn: 58806
2008-11-06 16:32:23 +00:00
Sebastian Redl
b426f63302 Sema-check virtual declarations. Complete dynamic_cast checking.
llvm-svn: 58804
2008-11-06 15:59:35 +00:00
Douglas Gregor
d7fc872d5c Add the remaining C++0x keywords
llvm-svn: 58802
2008-11-06 15:17:27 +00:00
Steve Naroff
7e53df94e3 Update VC++ proj.
llvm-svn: 58797
2008-11-06 06:24:22 +00:00
Zhongxing Xu
d952b247d1 Bring back RegionExtent classes.
llvm-svn: 58795
2008-11-06 04:55:21 +00:00
Ted Kremenek
efc44cbf1f Updated checker build.
llvm-svn: 58776
2008-11-05 22:47:25 +00:00
Ted Kremenek
eb39732d53 Add a test case for CFMakeCollectable.
llvm-svn: 58772
2008-11-05 22:17:39 +00:00
Ted Kremenek
ab4782510b Fix regression with handling of CFMakeCollectable.
llvm-svn: 58771
2008-11-05 22:17:20 +00:00
Sebastian Redl
75c54764fd Improve assert messages.
llvm-svn: 58770
2008-11-05 22:15:14 +00:00
Sebastian Redl
3c5aa4d1a9 Move named cast sema functions to their own file.
llvm-svn: 58769
2008-11-05 21:50:06 +00:00
Douglas Gregor
831c93f6c0 Parsing, representation, and preliminary semantic analysis of destructors.
Implicit declaration of destructors (when necessary).

Extended Declarator to store information about parsed constructors
and destructors; this will be extended to deal with declarators that
name overloaded operators (e.g., "operator +") and user-defined
conversion operators (e.g., "operator int").

llvm-svn: 58767
2008-11-05 20:51:48 +00:00
Ted Kremenek
b4ebbc5a86 AnalysisManager can now be used to for analyses over TranslationUnits.
llvm-svn: 58766
2008-11-05 19:05:06 +00:00
Sebastian Redl
6a43b1c435 A small error message improvement and some comment cleanup for static_cast.
llvm-svn: 58762
2008-11-05 17:54:26 +00:00
Ted Kremenek
2855a93f07 initXXX methods can return owned objects
llvm-svn: 58758
2008-11-05 16:54:44 +00:00
Douglas Gregor
cfd8ddc6de Keep track of whether a C++ class is an aggregate. Don't allow initialization of non-aggregates with initializer lists.
llvm-svn: 58757
2008-11-05 16:20:31 +00:00
Douglas Gregor
6f5431543a Implement C++ copy-initialization for declarations. There is now some
duplication in the handling of copy-initialization by constructor,
which occurs both for initialization of a declaration and for
overloading. The initialization code is due for some refactoring.

llvm-svn: 58756
2008-11-05 15:29:30 +00:00
Douglas Gregor
e8381c00eb Initial implementation of parsing, semantic analysis, and AST-building
for constructor initializations, e.g.,

  class A { };
  class B : public A { 
    int m;
  public:
    B() : A(), m(17) { };
  };

llvm-svn: 58749
2008-11-05 04:29:56 +00:00
Cedric Venet
0ce19ba350 Update CMakeLists.txt
llvm-svn: 58716
2008-11-04 20:31:17 +00:00
Daniel Dunbar
40346506f1 Remove stray character.
llvm-svn: 58713
2008-11-04 18:44:31 +00:00
Ted Kremenek
2afad46626 Update Xcode project.
llvm-svn: 58711
2008-11-04 18:39:58 +00:00
Anders Carlsson
a6b508a28c Make it an error if an Objective-C declaration is not in the global scope.
llvm-svn: 58705
2008-11-04 16:57:32 +00:00
Chris Lattner
b8c18fa59a LinkageSpecDecl is c++ specific, move it to DeclCXX
llvm-svn: 58704
2008-11-04 16:51:42 +00:00
Sebastian Redl
ee54797234 Some cleanup of the cast checkers. Don't canonicalize types when not needed. Use distinct diagnostics for distinct errors.
llvm-svn: 58700
2008-11-04 15:59:10 +00:00
Douglas Gregor
242ee9dfae Fine-grained C++ status page
llvm-svn: 58699
2008-11-04 15:52:45 +00:00
Douglas Gregor
8ea1f53420 Add a new expression class, ObjCSuperExpr, to handle the Objective-C 'super'. Remove ObjCThis from PredefinedExpr
llvm-svn: 58698
2008-11-04 14:56:14 +00:00
Douglas Gregor
97a9c81b05 Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary expression. Remove CXXThis from PredefinedExpr
llvm-svn: 58695
2008-11-04 14:32:21 +00:00
Douglas Gregor
5496d4caa0 Now that we have copy initialization support, use it for checking the default arguments
llvm-svn: 58692
2008-11-04 13:57:51 +00:00
Douglas Gregor
8e12c38115 Diagnose use of 'this' in a C++ default argument. Thanks to Eli for correcting my bogus assertion about it already being handled
llvm-svn: 58691
2008-11-04 13:41:56 +00:00
Sebastian Redl
273ce56d7a Trivial style fix.
llvm-svn: 58689
2008-11-04 11:45:54 +00:00
Anders Carlsson
6b0dc85119 #define NULL as 0 when compiling as C++. This fixes the carbon.cpp and cocoa.mm test failures.
llvm-svn: 58685
2008-11-04 06:53:14 +00:00
Anders Carlsson
13abd7e98b Implement lowering of va_arg in clang directly. (This is 32-bit X86 only for now).
llvm-svn: 58681
2008-11-04 05:30:00 +00:00
Anders Carlsson
4961890c07 Fix bug in va_copy
llvm-svn: 58680
2008-11-04 05:29:05 +00:00
Ted Kremenek
307b2c4078 Updated checker build.
llvm-svn: 58672
2008-11-04 01:24:32 +00:00
Ted Kremenek
24b1d9f57e Handle prefix '_' that may appear in front of the name of 'Release' functions
llvm-svn: 58666
2008-11-04 00:36:12 +00:00
Ted Kremenek
eefdcea2ba Fix use of uninitialized variable.
llvm-svn: 58663
2008-11-04 00:22:12 +00:00
Ted Kremenek
a3199323fe Updated checker build.
llvm-svn: 58658
2008-11-04 00:03:24 +00:00
Ted Kremenek
90230557d7 Allow user toggling between plist and html output with scan-build/ccc-analyzer.
llvm-svn: 58657
2008-11-04 00:02:53 +00:00
Steve Naroff
8f97373af0 Update VC++ project file.
llvm-svn: 58656
2008-11-04 00:01:14 +00:00
Steve Naroff
c989a7b6c0 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
llvm-svn: 58654
2008-11-03 23:29:32 +00:00
Ted Kremenek
14f18653f6 Hook up the Plist diagnostic client to the driver.
Fix Plist output.

llvm-svn: 58652
2008-11-03 23:18:07 +00:00
Douglas Gregor
fa7431a807 Check that this cannot be used in a default argument. Happily, it was already implemented
llvm-svn: 58649
2008-11-03 22:47:57 +00:00
Ted Kremenek
0cbd963817 Add path diagnostics client for emitting path reports using Plists.
llvm-svn: 58647
2008-11-03 22:33:57 +00:00
Ted Kremenek
e868c00d5a Rename 'HTMLDiagnostics.h' to 'PathDiagnosticClients.h'
llvm-svn: 58646
2008-11-03 22:31:48 +00:00
Douglas Gregor
c28b57d703 Implicit support for direct initialization of objects of class type, e.g.,
X x(5, 7);

llvm-svn: 58641
2008-11-03 20:45:27 +00:00
Daniel Dunbar
925dc26d51 Clarify performance experiments description based on feedback from
Eric C, thanks!

llvm-svn: 58634
2008-11-03 20:03:58 +00:00
Douglas Gregor
2fe9883a96 Standard conversion sequences now have a CopyConstructor field, to
cope with the case where a user-defined conversion is actually a copy
construction, and therefore can be compared against other standard
conversion sequences. While I called this a hack before, now I'm
convinced that it's the right way to go.

Compare overloads based on derived-to-base conversions that invoke
copy constructors. 

Suppress user-defined conversions when attempting to call a
user-defined conversion.

llvm-svn: 58629
2008-11-03 19:09:14 +00:00
Douglas Gregor
0537942f3c 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).

llvm-svn: 58622
2008-11-03 17:51:48 +00:00
Douglas Gregor
ab13857072 Eliminate header dependency ASTContext -> TargetInfo
llvm-svn: 58613
2008-11-03 15:57:00 +00:00
Douglas Gregor
66583c5ff3 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.

llvm-svn: 58612
2008-11-03 15:51:28 +00:00
Douglas Gregor
8af6e6d415 Connect ASTContext to TargetInfo when determining the size_t, ptrdiff_t, and wchar_t types. Fixes recent breakage on Linux.
llvm-svn: 58609
2008-11-03 14:12:49 +00:00
Steve Naroff
3e7ced125b Fix <rdar://problem/6336774> clang block rewriter: Assertion failed: Offset+NumBytes <= size() && "Invalid region to erase!", file c:\cygwin\home\Administrator\llvm\to ols\clang\include\clang/Rewrite/RewriteRope.h, line 219.
llvm-svn: 58607
2008-11-03 11:20:24 +00:00
Chris Lattner
8cc7be369c 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.

llvm-svn: 58603
2008-11-03 09:28:22 +00:00
Chris Lattner
7d7fff2303 privatize some methods.
llvm-svn: 58602
2008-11-03 09:11:11 +00:00
Ted Kremenek
3a5d515a82 Simplify the functions HtmlEsape and ShellEscape. We now properly print out the following command line in the HTML output: scan-build gcc -x c /dev/null -c -Dfoo='"string abc"'
Fixes <rdar://problem/6338651>

llvm-svn: 58600
2008-11-03 07:44:16 +00:00
Zhongxing Xu
c8c71979a6 Add some notes for SCA.
llvm-svn: 58597
2008-11-03 06:04:23 +00:00
Zhongxing Xu
8ea09cc542 Fix 80-col violations.
llvm-svn: 58596
2008-11-03 05:18:34 +00:00
Zhongxing Xu
2d330ef8fa - Remove AnonTypedRegion, which is not to be used.
- Prepare AnonPointeeRegioin for later use.

llvm-svn: 58595
2008-11-03 04:12:24 +00:00
Sebastian Redl
1384553cbe Source ranges for named cast diagnostics.
llvm-svn: 58570
2008-11-02 22:21:33 +00:00
Cedric Venet
1bb549685b Add header files to CMake build solution. It use globing so it doesn't need to be manually maintained, but it won't automatically detect a new header. I think this is a good compromise for the header files, since there presence in the solution is just an help for the user. Moreover, a new header is often introduced with a new cpp source file which need a makefile change, which will regenerate the solution and detect the new header.
llvm-svn: 58566
2008-11-02 16:28:53 +00:00
Zhongxing Xu
de297f8198 Add function side-effect test cast.
llvm-svn: 58565
2008-11-02 13:17:44 +00:00
Zhongxing Xu
2e8e604704 1. When a pointer to struct is used as an argument, GRSimpleVals::EvalCall()
sets the whole struct to Unknown. Then we cannot assume the V passed to
   BindStruct() is always a CompoundVal. When it is an UnknownVal, we call
   BindStructToVal(UnknownVal).

2. Change the signature of InitializeStructToUndefined() to BindStructToVal()
   to reuse the code.

llvm-svn: 58564
2008-11-02 12:13:30 +00:00