Mercurial > hg > CbC > CbC_llvm
annotate tools/clang/lib/Parse/ParseCbC.cpp @ 59:322ba4588e4f
remove assignment flags
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 02 Feb 2014 17:39:42 +0900 |
parents | 01c954c1b51b |
children | d4de94500cd9 |
rev | line source |
---|---|
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
1 #ifndef noCbC |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
2 |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 #include "clang/Parse/Parser.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 #include "RAIIObjectsForParser.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 #include "clang/AST/ASTContext.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 #include "clang/Basic/Diagnostic.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 #include "clang/Basic/PrettyStackTrace.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 #include "clang/Basic/TargetInfo.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 #include "clang/Sema/DeclSpec.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 #include "clang/Sema/PrettyDeclStackTrace.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 #include "clang/Sema/Scope.h" |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 #include "clang/Sema/Lookup.h" |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
13 #include "clang/Lex/LiteralSupport.h" |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
14 #include "clang/AST/ASTConsumer.h" |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
15 |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
16 #include <sstream> |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
17 #include <string> |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
18 #include "CbCHelper.h" |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
19 |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 using namespace clang; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 |
42
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
22 namespace ExternalSpace { // from ParseExpr.cpp , ParseStmt.cpp |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 class CastExpressionIdValidator : public CorrectionCandidateCallback { |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 public: |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25 CastExpressionIdValidator(bool AllowTypes, bool AllowNonTypes) |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 : AllowNonTypes(AllowNonTypes) { |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27 WantTypeSpecifiers = AllowTypes; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 } |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 virtual bool ValidateCandidate(const TypoCorrection &candidate) { |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 NamedDecl *ND = candidate.getCorrectionDecl(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 if (!ND) |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 return candidate.isKeyword(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 if (isa<TypeDecl>(ND)) |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36 return WantTypeSpecifiers; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 return AllowNonTypes; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 } |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 private: |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41 bool AllowNonTypes; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 }; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 class StatementFilterCCC : public CorrectionCandidateCallback { |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45 public: |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
46 StatementFilterCCC(Token nextTok) : NextToken(nextTok) { |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47 WantTypeSpecifiers = nextTok.is(tok::l_paren) || nextTok.is(tok::less) || |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 nextTok.is(tok::identifier) || nextTok.is(tok::star) || |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 nextTok.is(tok::amp) || nextTok.is(tok::l_square); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 WantExpressionKeywords = nextTok.is(tok::l_paren) || |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 nextTok.is(tok::identifier) || |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 nextTok.is(tok::arrow) || nextTok.is(tok::period); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 WantRemainingKeywords = nextTok.is(tok::l_paren) || nextTok.is(tok::semi) || |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 nextTok.is(tok::identifier) || |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 nextTok.is(tok::l_brace); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56 WantCXXNamedCasts = false; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
57 } |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
58 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
59 virtual bool ValidateCandidate(const TypoCorrection &candidate) { |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
60 if (FieldDecl *FD = candidate.getCorrectionDeclAs<FieldDecl>()) |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
61 return !candidate.getCorrectionSpecifier() || isa<ObjCIvarDecl>(FD); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
62 if (NextToken.is(tok::equal)) |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
63 return candidate.getCorrectionDeclAs<VarDecl>(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
64 if (NextToken.is(tok::period) && |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
65 candidate.getCorrectionDeclAs<NamespaceDecl>()) |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
66 return false; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
67 return CorrectionCandidateCallback::ValidateCandidate(candidate); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
68 } |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
69 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
70 private: |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
71 Token NextToken; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
72 }; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73 } |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
75 namespace CbCSpace{ |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
76 enum DeclarationFlags { |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
77 CbCReturnFunc = 0x04, |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
78 CopyParentType = 0x08 |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
79 }; |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80 |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
81 bool isCbCRetFunc(unsigned F) { return F & CbCReturnFunc; } |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
82 bool shouldCopyParentsType(unsigned F) { return F & CopyParentType; } |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
83 } |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
84 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
85 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
86 ExprResult Parser::Prepare__retForGotoWithTheEnvExpr(){ |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
87 StmtResult innerRes; |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
88 SourceLocation Loc = Tok.getLocation(); |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
89 IdentifierInfo *__CbC_retII = CreateIdentifierInfo(__CBC_RETURN_NAME, Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
90 IdentifierInfo *retcsII = CreateUniqueIdentifierInfo(__CBC_RET_CODE_BASE_NAME, Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
91 Create__CbC_envStruct(Loc, AS_none); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
92 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
93 Actions.ActOnStartStmtExpr(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
94 StmtResult CompoundStmtRes; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
95 ParseScope CompoundScope(this, Scope::DeclScope); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
96 PrettyStackTraceLoc CrashInfo(PP.getSourceManager(),Loc,"in compound statement ('{}')"); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
97 StmtVector CompoundStmts; |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
98 |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
99 if (CreateRetFunction()) { // error check : function type is void or not. |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
100 Diag(Tok, diag::err_cannot_use_goto_with_env); |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
101 return ExprError(); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
102 } |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
103 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
104 innerRes = CreateDeclStmt(__CbC_retII, CbCSpace::CbCReturnFunc, DeclSpec::TST___code); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
105 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
106 CompoundStmts.push_back(innerRes.release()); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
107 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
108 innerRes = CreateAssignmentStmt(__CbC_retII, retcsII); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
109 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
110 CompoundStmts.push_back(innerRes.release()); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
111 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
112 innerRes = CreateComplexStmtRet(__CbC_retII, false); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
113 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
114 CompoundStmts.push_back(innerRes.release()); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
115 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
116 CompoundStmtRes = Actions.ActOnCompoundStmt(Loc,Loc,CompoundStmts,true); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
117 ConsumeToken(); // eat the '__return'. |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
118 return Actions.ActOnStmtExpr(Loc, CompoundStmtRes.take(), Loc); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
119 } |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
120 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
121 ExprResult Parser::Prepare__envForGotoWithTheEnvExpr(){ |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
122 StmtResult innerRes; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
123 SourceLocation Loc = Tok.getLocation(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
124 IdentifierInfo *bufII = CreateUniqueIdentifierInfo(__CBC_BUF_NAME, Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
125 IdentifierInfo *retvalII = CreateUniqueIdentifierInfo(__CBC_RETVAL_NAME, Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
126 IdentifierInfo *structII = CreateIdentifierInfo(__CBC_STRUCT_NAME, Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
127 IdentifierInfo *__CbC_envII = CreateIdentifierInfo(__CBC_ENVIRONMENT_NAME, Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
128 IdentifierInfo *envII = CreateIdentifierInfo(__CBC_STRUCT_ENV_NAME, Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
129 IdentifierInfo *ret_pII = CreateIdentifierInfo(__CBC_STRUCT_POINTER_NAME, Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
130 Create__CbC_envStruct(Loc, AS_none); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
131 Actions.ActOnStartStmtExpr(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
132 ParseScope CompoundScope(this, Scope::DeclScope); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
133 PrettyStackTraceLoc CrashInfo(PP.getSourceManager(),Loc,"in compound statement ('{}')"); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
134 StmtVector CompoundStmts; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
135 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
136 innerRes = CreateDeclStmt(__CbC_envII, 0, DeclSpec::TST_struct, structII); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
137 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
138 CompoundStmts.push_back(innerRes.release()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
139 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
140 innerRes = CreateDeclStmt(retvalII, CbCSpace::CopyParentType); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
141 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
142 CompoundStmts.push_back(innerRes.release()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
143 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
144 innerRes = CreateDeclStmt(bufII, 0, DeclSpec::TST_typename, CreateIdentifierInfo("jmp_buf", Loc)); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
145 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
146 CompoundStmts.push_back(innerRes.release()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
147 |
59
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
148 innerRes = CreateAssignmentStmt(__CbC_envII, retvalII, true, true, ret_pII); |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
149 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
150 CompoundStmts.push_back(innerRes.release()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
151 |
59
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
152 innerRes = CreateAssignmentStmt(__CbC_envII, bufII, true, false, envII); |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
153 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
154 CompoundStmts.push_back(innerRes.release()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
155 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
156 innerRes = CreateSjForContinuationWithEnv(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
157 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
158 CompoundStmts.push_back(innerRes.release()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
159 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
160 innerRes = CreateComplexStmtRet(__CbC_envII, true); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
161 if (innerRes.isUsable()) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
162 CompoundStmts.push_back(innerRes.release()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
163 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
164 StmtResult CompoundStmtRes = Actions.ActOnCompoundStmt(Loc,Loc,CompoundStmts,true); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
165 ConsumeToken(); // eat the '__environment'. |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
166 return Actions.ActOnStmtExpr(Loc, CompoundStmtRes.take(), Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
167 } |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
168 |
59
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
169 /// CreateAssignmentStmt - Create assignment statement such as "aaa = bbb;", "auaua = llll;", etc. |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
170 /// It can create kinds of statement. |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
171 /// 1. common assignment statement: |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
172 /// variable '=' variable ';' |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
173 /// 2. LHS variable is member of struct: |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
174 /// structVar '.' member '=' variable ';' |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
175 /// 3. RHS variable is address of operand: |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
176 /// variable '=' '&' variable ';' |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
177 /// 4. 2+3: |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
178 /// structVar '.' member '=' '&' variable ';' |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
179 StmtResult Parser::CreateAssignmentStmt(IdentifierInfo* LHSII, IdentifierInfo* RHSII, bool LHSisMemberAccess, bool RHShasAmp, |
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
180 IdentifierInfo* extraLHSII, IdentifierInfo* extraRHSII){ |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
181 ExprResult Expr,LHS,RHS; |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
182 |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
183 Token Next,LHSToken; |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
184 SourceLocation Loc = Tok.getLocation(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
185 CXXScopeSpec SS; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
186 Next.startToken(); |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
187 Next.setKind(tok::period); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
188 LHSToken.startToken(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
189 LHSToken.setLocation(Loc); |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
190 LHSToken.setIdentifierInfo(LHSII); |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
191 LHSToken.setKind(tok::annot_primary_expr); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
192 ExternalSpace::StatementFilterCCC Validator(Next); |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
193 Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, LHSII, Loc, Next, false, SS.isEmpty() ? &Validator : 0); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
194 setExprAnnotation(LHSToken, Classification.getExpression()); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
195 LHSToken.setAnnotationEndLoc(Loc); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
196 PP.AnnotateCachedTokens(LHSToken); |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
197 |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
198 LHS = getExprAnnotation(LHSToken); |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
199 |
59
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
200 if (LHSisMemberAccess) |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
201 LHS = LookupMemberAndBuildExpr(extraLHSII, LHS.take(), false); |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
202 |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
203 RHS = LookupAndDeclareName(RHSII); |
59
322ba4588e4f
remove assignment flags
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
204 if (RHShasAmp) |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
205 RHS = Actions.ActOnUnaryOp(getCurScope(), Loc, tok::amp, RHS.get()); |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
206 |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
207 Expr = Actions.ActOnBinOp(getCurScope(), Loc,tok::equal,LHS.take(),RHS.take()); |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
208 |
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
209 return Actions.ActOnExprStmt(Expr); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
210 } |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
211 |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
212 StmtResult Parser::CreateDeclStmt(IdentifierInfo *II, unsigned DeclFlags, DeclSpec::TST valueType, IdentifierInfo* Name, const char* size){ |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
213 SourceLocation Loc = Tok.getLocation(); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
214 DeclGroupPtrTy DeclGPT; |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
215 ParsingDeclSpec DS(*this); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
216 DeclSpec *DSp; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
217 DSp = &DS; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
218 |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
219 setTST(&DS, valueType, Name); |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
220 ParsingDeclarator D(*this, DS, static_cast<Declarator::TheContext>(Declarator::BlockContext)); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
221 D.SetIdentifier(II, Loc); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
222 |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
223 if (CbCSpace::isCbCRetFunc(DeclFlags)) { |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
224 D.setEllipsisLoc(SourceLocation()); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
225 bool hadGroupingParens = D.hasGroupingParens(); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
226 D.setGroupingParens(true); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
227 D.SetRangeEnd(Loc); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
228 DeclSpec FDS(AttrFactory); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
229 DS.Finish(Diags, PP); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
230 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
231 D.AddTypeInfo(DeclaratorChunk::getPointer(FDS.getTypeQualifiers(), Loc, FDS.getConstSpecLoc(), FDS.getVolatileSpecLoc(), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
232 FDS.getRestrictSpecLoc()), FDS.getAttributes(), SourceLocation()); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
233 D.setGroupingParens(hadGroupingParens); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
234 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
235 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
236 ParseScope PrototypeScope(this,Scope::FunctionPrototypeScope|Scope::DeclScope| |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
237 (D.isFunctionDeclaratorAFunctionDeclaration() ? Scope::FunctionDeclarationScope : 0)); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
238 bool HasProto = false; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
239 SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
240 SourceLocation EllipsisLoc, RefQualifierLoc, ConstQualifierLoc, VolatileQualifierLoc; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
241 DeclSpec FPDS(AttrFactory); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
242 bool RefQualifierIsLValueRef = true; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
243 ExceptionSpecificationType ESpecType = EST_None; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
244 SourceRange ESpecRange; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
245 SmallVector<ParsedType, 2> DynamicExceptions; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
246 SmallVector<SourceRange, 2> DynamicExceptionRanges; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
247 ExprResult NoexceptExpr; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
248 ParsedAttributes FnAttrs(AttrFactory); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
249 TypeResult TrailingReturnType; |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
250 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
251 ParmVarDecl *Param; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
252 FunctionDecl *CurFunctionDecl = Actions.getCurFunctionDecl(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
253 QualType CurFuncResQT = CurFunctionDecl->getResultType(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
254 TypeSourceInfo *CurFuncTI = Actions.Context.CreateTypeSourceInfo(CurFuncResQT); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
255 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
256 Param = CreateParam(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
257 Param->setTypeSourceInfo(CurFuncTI); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
258 Param->setType(CurFuncResQT); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
259 ParamInfo.push_back(DeclaratorChunk::ParamInfo(0, Loc, Param, 0)); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
260 Param = CreateParam(0, 1, DeclSpec::TST_void); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
261 ParamInfo.push_back(DeclaratorChunk::ParamInfo(0, Loc, Param, 0)); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
262 HasProto = true; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
263 |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
264 D.AddTypeInfo(DeclaratorChunk::getFunction(HasProto,false,Loc,ParamInfo.data(), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
265 ParamInfo.size(),EllipsisLoc, Loc, FPDS.getTypeQualifiers(), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
266 RefQualifierIsLValueRef,RefQualifierLoc, ConstQualifierLoc, |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
267 VolatileQualifierLoc,SourceLocation(),ESpecType, ESpecRange.getBegin(), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
268 DynamicExceptions.data(),DynamicExceptionRanges.data(), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
269 DynamicExceptions.size(), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
270 NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0,Loc, Loc, D,TrailingReturnType), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
271 FnAttrs, Loc); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
272 PrototypeScope.Exit(); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
273 DSp = &FDS; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
274 } |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
275 |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
276 SmallVector<Decl *, 8> DeclsInGroup; |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
277 Decl *FirstDecl; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
278 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
279 if (CbCSpace::shouldCopyParentsType(DeclFlags)) |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
280 FirstDecl = HandleDeclAndChangeDeclType(D); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
281 else |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
282 FirstDecl = ParseDeclarationAfterDeclaratorAndAttributes(D); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
283 |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
284 D.complete(FirstDecl); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
285 DeclsInGroup.push_back(FirstDecl); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
286 DeclGPT = Actions.FinalizeDeclaratorGroup(getCurScope(), *DSp, DeclsInGroup); |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
287 return Actions.ActOnDeclStmt(DeclGPT, Loc, Loc); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
288 } |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
289 |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
290 /* |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
291 * This function imitated Parser::ParseDeclarationAfterDeclaratorAndAttributes() and Sema::ActOnDeclarator(). |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
292 * The origins get Type from Declarator but this function get Type from current function. |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
293 * It is useful for CbC to create statements for the continuation with the environments. |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
294 */ |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
295 Decl* Parser::HandleDeclAndChangeDeclType(Declarator &D) { |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
296 D.setFunctionDefinitionKind(FDK_Declaration); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
297 DeclarationNameInfo NameInfo = Actions.GetNameForDeclarator(D); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
298 DeclContext *DC = Actions.CurContext; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
299 QualType R = Actions.getCurFunctionDecl()->getResultType(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
300 TypeSourceInfo *TInfo = Actions.Context.CreateTypeSourceInfo(R); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
301 Scope *S = getCurScope(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
302 LookupResult Previous(Actions, NameInfo, Actions.LookupOrdinaryName, Actions.ForRedeclaration); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
303 bool IsLinkageLookup = false; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
304 bool CreateBuiltins = false; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
305 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
306 // If the declaration we're planning to build will be a function |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
307 // or object with linkage, then look for another declaration with |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
308 // linkage (C99 6.2.2p4-5 and C++ [basic.link]p6). |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
309 // |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
310 // If the declaration we're planning to build will be declared with |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
311 // external linkage in the translation unit, create any builtin with |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
312 // the same name. |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
313 if (R->isFunctionType()) { |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
314 IsLinkageLookup = true; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
315 CreateBuiltins = |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
316 Actions.CurContext->getEnclosingNamespaceContext()->isTranslationUnit(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
317 } else if (Actions.CurContext->getRedeclContext()->isTranslationUnit()) |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
318 CreateBuiltins = true; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
319 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
320 if (IsLinkageLookup) |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
321 Previous.clear(Actions.LookupRedeclarationWithLinkage); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
322 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
323 Actions.LookupName(Previous, S, CreateBuiltins); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
324 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
325 // In C++, the previous declaration we find might be a tag type |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
326 // (class or enum). In this case, the new declaration will hide the |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
327 // tag type. Note that this does does not apply if we're declaring a |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
328 // typedef (C++ [dcl.typedef]p4). |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
329 if (Previous.isSingleTagDecl()) |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
330 Previous.clear(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
331 NamedDecl *New; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
332 bool AddToScope = true; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
333 if (R->isFunctionType()) { |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
334 New = Actions.ActOnFunctionDeclarator(S, D, DC, TInfo, Previous, |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
335 MultiTemplateParamsArg(), AddToScope); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
336 } else { |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
337 New = Actions.ActOnVariableDeclarator(S, D, DC, TInfo, Previous, |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
338 MultiTemplateParamsArg(), AddToScope); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
339 } |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
340 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
341 if (New->getDeclName() && AddToScope) { |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
342 // Only make a locally-scoped extern declaration visible if it is the first |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
343 // declaration of this entity. Qualified lookup for such an entity should |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
344 // only find this declaration if there is no visible declaration of it. |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
345 bool AddToContext = !D.isRedeclaration() || !New->isLocalExternDecl(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
346 Actions.PushOnScopeChains(New, S, AddToContext); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
347 if (!AddToContext) |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
348 Actions.CurContext->addHiddenDecl(New); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
349 } |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
350 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
351 return New; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
352 } |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
353 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
354 void Parser::CreateArrayDecl(ParsingDeclarator &D, SourceLocation Loc, const char* size){ |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
355 ExprResult ExprRes; |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
356 ParsedAttributesWithRange attrs(AttrFactory); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
357 SmallString<128> SpellingBuffer; |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
358 SpellingBuffer.resize(strlen(size) + 1); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
359 StringRef TokSpelling = StringRef(size, strlen(size)); |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
360 NumericLiteralParser Literal(TokSpelling, Loc, PP); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
361 Expr *sizeRes; |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
362 QualType Ty; |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
363 unsigned MaxWidth = Actions.Context.getTargetInfo().getIntMaxTWidth(); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
364 llvm::APInt ResultVal(MaxWidth, 0); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
365 Literal.GetIntegerValue(ResultVal); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
366 unsigned Width = 0; |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
367 unsigned IntSize = Actions.Context.getTargetInfo().getIntWidth(); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
368 Ty = Actions.Context.IntTy; |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
369 Width = IntSize; |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
370 ResultVal = ResultVal.trunc(Width); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
371 sizeRes = IntegerLiteral::Create(Actions.Context, ResultVal, Ty, Loc); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
372 ExprRes = Actions.Owned(sizeRes); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
373 D.AddTypeInfo(DeclaratorChunk::getArray(0, false, false,ExprRes.release(),Loc,Loc),attrs,Loc); |
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
374 } |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
375 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
376 StmtResult Parser::CreateSjForContinuationWithEnv(){ |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
377 SourceLocation Loc = Tok.getLocation(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
378 StmtResult IfRes; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
379 ParseScope IfScope(this, Scope::DeclScope | Scope::ControlScope, true/* C99 or CXX */); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
380 ExprResult CondExp; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
381 Decl *CondVar = 0; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
382 |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
383 CondExp = LookupAndDeclareName(CreateIdentifierInfo("setjmp", Loc)); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
384 ExprVector ArgExprs; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
385 ExprResult __envExprRes = CondExp.get(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
386 |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
387 __envExprRes = LookupAndDeclareName(CreateIdentifierInfo(__CBC_ENVIRONMENT_NAME, Loc)); |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
388 __envExprRes = LookupMemberAndBuildExpr(CreateIdentifierInfo(__CBC_STRUCT_ENV_NAME, Loc), __envExprRes.take(), false); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
389 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
390 ArgExprs.push_back(__envExprRes.release()); |
42
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
391 CondExp = Actions.ActOnCallExpr(getCurScope(), CondExp.take(), Loc, ArgExprs, Loc, 0); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
392 CondExp = Actions.ActOnBooleanCondition(getCurScope(), Loc, CondExp.get()); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
393 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
394 FullExprArg FullCondExp(Actions.MakeFullExpr(CondExp.get(), Loc)); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
395 ParseScope InnerScope(this, Scope::DeclScope,false); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
396 SourceLocation InnerStatementTrailingElseLoc; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
397 |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
398 StmtResult StmtRes; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
399 ParseScope CompoundScope(this, Scope::DeclScope); |
44
aabc64b7263e
create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
400 PrettyStackTraceLoc CrashInfo(PP.getSourceManager(),Loc,"in create setjmp statement for CbC"); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
401 StmtVector innerStmts; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
402 StmtResult innerStmtRes; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
403 ExprResult innerExprRes; |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
404 innerExprRes = LookupAndDeclareName(CreateUniqueIdentifierInfo(__CBC_RETVAL_NAME, Loc)); |
41
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
405 innerStmtRes = Actions.ActOnReturnStmt(Loc, innerExprRes.take()); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
406 if (innerStmtRes.isUsable()) |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
407 innerStmts.push_back(innerStmtRes.release()); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
408 StmtRes = Actions.ActOnCompoundStmt(Loc, Loc,innerStmts, false); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
409 StmtResult ThenStmt(StmtRes); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
410 InnerScope.Exit(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
411 IfScope.Exit(); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
412 StmtResult ElseStmt; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
413 IfRes = Actions.ActOnIfStmt(Loc, FullCondExp, CondVar, ThenStmt.get(),Loc, ElseStmt.get()); |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
414 return IfRes; |
1d6c745cd57d
move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
415 } |
42
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
416 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
417 ExprResult Parser::LookupAndDeclareName(IdentifierInfo *II, bool IsAddressOfOperand){ |
42
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
418 SourceLocation Loc = Tok.getLocation(); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
419 UnqualifiedId Name; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
420 CXXScopeSpec SS; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
421 SourceLocation TemplateKWLoc; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
422 ExternalSpace::CastExpressionIdValidator Validator(false,true); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
423 Name.setIdentifier(II, Loc); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
424 return Actions.ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Name, false, IsAddressOfOperand, &Validator); |
42
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
425 } |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
426 |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
427 ExprResult Parser::LookupMemberAndBuildExpr(IdentifierInfo *II, Expr* Base, bool IsArrow){ |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
428 SourceLocation Loc = Tok.getLocation(); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
429 ExprResult Res; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
430 CXXScopeSpec SS; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
431 UnqualifiedId Name; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
432 SourceLocation TemplateKWLoc; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
433 Name.setIdentifier(II,Loc); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
434 TemplateArgumentListInfo TemplateArgsBuffer; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
435 DeclarationNameInfo NameInfo; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
436 const TemplateArgumentListInfo *TemplateArgs; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
437 Actions.DecomposeUnqualifiedId(Name, TemplateArgsBuffer, NameInfo, TemplateArgs); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
438 Res = Actions.MaybeConvertParenListExprToParenExpr(getCurScope(), Base); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
439 Base = Res.take(); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
440 LookupResult R(Actions, NameInfo, Actions.LookupMemberName); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
441 ExprResult BaseResult = Actions.Owned(Base); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
442 Actions.LookupMemberExpr(R, BaseResult, IsArrow, Loc, SS, 0, TemplateArgs != 0); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
443 Base = BaseResult.take(); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
444 Sema::ActOnMemberAccessExtraArgs ExtraArgs = {getCurScope(), Name, 0, false}; |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
445 return Actions.BuildMemberReferenceExpr(Base, Base->getType(), Loc, IsArrow, SS, TemplateKWLoc, 0, R, TemplateArgs,false, &ExtraArgs); |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
446 |
3e178477409f
made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
41
diff
changeset
|
447 } |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
448 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
449 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
450 /// Create__CbC_envStruct - This method create "struct __CbC_env" which is used to continuation with environment. |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
451 /// If the __CbC_env has been already defined, it doesn't create __CbC_env again. |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
452 void Parser::Create__CbC_envStruct(SourceLocation Loc, AccessSpecifier AS) { |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
453 |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
454 IdentifierInfo *Name = CreateIdentifierInfo(__CBC_STRUCT_NAME, Loc); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
455 // Check previous definition. If the __CbC_env has been already defined, we have not to create again. |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
456 LookupResult Previous(Actions, Name, Loc, Actions.LookupTagName, Actions.ForRedeclaration); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
457 if(Actions.LookupName(Previous, getCurScope())) |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
458 return; |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
459 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
460 Scope *SavedScope = getCurScope(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
461 DeclContext *SavedContext = Actions.CurContext; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
462 sema::FunctionScopeInfo *SavedFSI = Actions.FunctionScopes.pop_back_val(); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
463 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
464 Actions.CurContext = static_cast<DeclContext *>(Actions.Context.getTranslationUnitDecl()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
465 Scope *TopScope = getCurScope(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
466 while(TopScope->getParent() != NULL) |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
467 TopScope = TopScope->getParent(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
468 Actions.CurScope = TopScope; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
469 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
470 ParsingDeclSpec SDS(*this); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
471 SDS.SetRangeStart(Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
472 SDS.SetRangeEnd(Loc); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
473 DeclSpec::TST TagType = DeclSpec::TST_struct; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
474 DeclResult TagOrTempResult = true; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
475 bool Owned = false; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
476 bool IsDependent = false; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
477 ParsedAttributesWithRange attrs(AttrFactory); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
478 MultiTemplateParamsArg TParams; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
479 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
480 TagOrTempResult = Actions.ActOnTag(getCurScope(), TagType, Sema::TUK_Definition, Loc, |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
481 SDS.getTypeSpecScope(), Name, Loc, attrs.getList(), AS, |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
482 SDS.getModulePrivateSpecLoc(), TParams, Owned, IsDependent, |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
483 SourceLocation(), false, clang::TypeResult()); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
484 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
485 Decl *TagDecl = TagOrTempResult.get(); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
486 PrettyDeclStackTraceEntry CrashInfo(Actions, TagDecl, Loc, "parsing struct/union body"); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
487 ParseScope StructScope(this, Scope::ClassScope|Scope::DeclScope); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
488 Actions.ActOnTagStartDefinition(getCurScope(), TagDecl); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
489 SmallVector<Decl *, 32> FieldDecls; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
490 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
491 const char *PrevSpec = 0; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
492 unsigned DiagID = 0; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
493 |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
494 FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_void, Loc, __CBC_STRUCT_POINTER_NAME)); |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
495 FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_int, Loc, __CBC_STRUCT_ENV_NAME)); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
496 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
497 Actions.ActOnFields(getCurScope(),Loc, TagDecl, FieldDecls,Loc, Loc,attrs.getList()); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
498 StructScope.Exit(); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
499 Actions.ActOnTagFinishDefinition(getCurScope(), TagDecl,Loc); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
500 bool Result = SDS.SetTypeSpecType(TagType, Loc,Loc.isValid() ? Loc : Loc, PrevSpec, DiagID, TagOrTempResult.get(), Owned); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
501 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
502 if (Result){ |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
503 Diag(Loc, DiagID) << PrevSpec; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
504 } |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
505 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
506 SDS.Finish(Diags,PP); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
507 Decl *TheDecl = Actions.ParsedFreeStandingDeclSpec(getCurScope(), AS, SDS); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
508 SDS.complete(TheDecl); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
509 Actions.ConvertDeclToDeclGroup(TheDecl); |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
510 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
511 Actions.CurScope = SavedScope; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
512 Actions.CurContext = SavedContext; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
513 Actions.FunctionScopes.push_back(SavedFSI); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
514 } |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
515 |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
516 Decl* Parser::Create__CbC_envBody(Decl* TagDecl, DeclSpec::TST T, SourceLocation Loc, const char* Name){ |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
517 ParsingDeclSpec PDS(*this); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
518 setTST(&PDS, T); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
519 SourceLocation CommaLoc; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
520 ParsingFieldDeclarator DeclaratorInfo(*this, PDS); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
521 DeclaratorInfo.D.setCommaLoc(CommaLoc); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
522 DeclaratorInfo.D.SetRangeEnd(Loc); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
523 DeclSpec DS(AttrFactory); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
524 DS.Finish(Diags,PP); |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
525 DeclaratorInfo.D.SetIdentifier(CreateIdentifierInfo(Name, Loc),Loc); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
526 |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
527 DeclaratorInfo.D.AddTypeInfo(DeclaratorChunk::getPointer(DS.getTypeQualifiers(), Loc,DS.getConstSpecLoc(), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
528 DS.getVolatileSpecLoc(),DS.getRestrictSpecLoc()), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
529 DS.getAttributes(),SourceLocation()); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
530 Decl *Field = Actions.ActOnField(getCurScope(), TagDecl, |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
531 DeclaratorInfo.D.getDeclSpec().getSourceRange().getBegin(), |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
532 DeclaratorInfo.D, DeclaratorInfo.BitfieldSize); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
533 DeclaratorInfo.complete(Field); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
534 return Field; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
535 } |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
536 |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
537 IdentifierInfo* Parser::CreateIdentifierInfo(const char* Name, SourceLocation Loc) { |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
538 int length = strlen(Name); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
539 Token TokenForII; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
540 TokenForII.startToken(); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
541 TokenForII.setLocation(Loc); |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
542 TokenForII.setLength(length); |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
543 TokenForII.setKind(tok::raw_identifier); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
544 TokenForII.setRawIdentifierData(Name); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
545 IdentifierInfo *II; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
546 II = PP.getIdentifierInfo(StringRef(TokenForII.getRawIdentifierData(),TokenForII.getLength())); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
547 TokenForII.setIdentifierInfo(II); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
548 TokenForII.setKind(II->getTokenID()); |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
549 return II; |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
550 } |
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
551 |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
552 IdentifierInfo* Parser::CreateUniqueIdentifierInfo(const char* Name, SourceLocation Loc){ |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
553 IdentifierInfo *II; |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
554 std::ostringstream os; |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
555 os << curFuncName << ".." /* separator */ << Name; |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
556 II = CreateIdentifierInfo(os.str().c_str(), Loc); |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
557 return II; |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
558 } |
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
559 |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
560 bool Parser::CreateRetFunction(){ |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
561 FunctionDecl *CurFunctionDecl = Actions.getCurFunctionDecl(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
562 QualType CurFuncResQT = CurFunctionDecl->getResultType(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
563 if (CurFuncResQT.getTypePtr()->isVoidType()) // this function cannot use continuation with the environment. |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
564 return true; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
565 |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
566 Scope *SavedScope = getCurScope(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
567 DeclContext *SavedContext = Actions.CurContext; |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
568 TypeSourceInfo *CurFuncTI = Actions.Context.CreateTypeSourceInfo(CurFuncResQT); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
569 sema::FunctionScopeInfo *SavedFSI = Actions.FunctionScopes.pop_back_val(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
570 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
571 Actions.CurContext = static_cast<DeclContext *>(Actions.Context.getTranslationUnitDecl()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
572 Scope *TopScope = getCurScope(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
573 while(TopScope->getParent() != NULL) |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
574 TopScope = TopScope->getParent(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
575 Actions.CurScope = TopScope; |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
576 |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
577 DeclGroupPtrTy returnDecl = DeclGroupPtrTy(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
578 SourceLocation Loc = Tok.getLocation(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
579 ParsingDeclSpec PDS(*this); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
580 setTST(&PDS, DeclSpec::TST___code); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
581 ParsingDeclarator D(*this, PDS, static_cast<Declarator::TheContext>(Declarator::FileContext)); |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
582 D.SetIdentifier(CreateUniqueIdentifierInfo(__CBC_RET_CODE_BASE_NAME, Loc),Loc); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
583 ParseScope PrototypeScope(this,Scope::FunctionPrototypeScope|Scope::DeclScope|Scope::FunctionDeclarationScope); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
584 bool IsAmbiguous = false; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
585 bool HasProto = true; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
586 SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
587 SourceLocation EllipsisLoc, RefQualifierLoc, ConstQualifierLoc, VolatileQualifierLoc; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
588 DeclSpec FDS(AttrFactory); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
589 bool RefQualifierIsLValueRef = true; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
590 ExceptionSpecificationType ESpecType = EST_None; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
591 SourceRange ESpecRange; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
592 SmallVector<ParsedType, 2> DynamicExceptions; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
593 SmallVector<SourceRange, 2> DynamicExceptionRanges; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
594 ExprResult NoexceptExpr; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
595 ParsedAttributes FnAttrs(AttrFactory); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
596 TypeResult TrailingReturnType; |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
597 ParmVarDecl *Param; |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
598 |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
599 IdentifierInfo *retvalII = CreateIdentifierInfo(__CBC_RETVAL_NAME, Loc); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
600 Param = CreateParam(retvalII); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
601 Param->setTypeSourceInfo(CurFuncTI); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
602 Param->setType(CurFuncResQT); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
603 |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
604 ParamInfo.push_back(DeclaratorChunk::ParamInfo(retvalII, Loc, Param, 0)); |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
605 IdentifierInfo *envII = CreateIdentifierInfo(__CBC_STRUCT_ENV_NAME, Loc); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
606 Param = CreateParam(envII, 1, DeclSpec::TST_void); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
607 ParamInfo.push_back(DeclaratorChunk::ParamInfo(envII, Loc, Param, 0)); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
608 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
609 D.AddTypeInfo(DeclaratorChunk::getFunction(HasProto, IsAmbiguous, Loc, ParamInfo.data(), ParamInfo.size(), EllipsisLoc, Loc, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
610 FDS.getTypeQualifiers(), RefQualifierIsLValueRef, RefQualifierLoc, ConstQualifierLoc, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
611 VolatileQualifierLoc, SourceLocation(), ESpecType, ESpecRange.getBegin(), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
612 DynamicExceptions.data(), DynamicExceptionRanges.data(), DynamicExceptions.size(), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
613 NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
614 Loc, Loc, D, TrailingReturnType), FnAttrs, Loc); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
615 PrototypeScope.Exit(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
616 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
617 Decl *TheDecl; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
618 ParseScope BodyScope(this, Scope::FnScope|Scope::DeclScope); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
619 Decl *BodyRes = Actions.ActOnStartOfFunctionDef(getCurScope(), D); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
620 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
621 D.complete(BodyRes); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
622 D.getMutableDeclSpec().abort(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
623 Actions.ActOnDefaultCtorInitializers(BodyRes); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
624 StmtResult FnBody; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
625 StmtVector FnStmts; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
626 StmtResult innerR; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
627 ExprResult retvalAssginmentExpr,LHS; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
628 ExprVector ArgExprs; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
629 CommaLocsTy CommaLocs; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
630 DeclSpec envDS(AttrFactory); |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
631 IdentifierInfo *structName = CreateIdentifierInfo(__CBC_STRUCT_NAME, Loc); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
632 setTST(&envDS, DeclSpec::TST_struct, structName); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
633 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
634 Declarator envDInfo(envDS, Declarator::TypeNameContext); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
635 envDInfo.SetRangeEnd(Loc); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
636 DeclSpec starDS(AttrFactory); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
637 starDS.Finish(Diags, PP); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
638 envDInfo.SetIdentifier(0,Loc); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
639 envDInfo.AddTypeInfo(DeclaratorChunk::getPointer(starDS.getTypeQualifiers(), Loc, |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
640 starDS.getConstSpecLoc(), |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
641 starDS.getVolatileSpecLoc(), |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
642 starDS.getRestrictSpecLoc()), |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
643 starDS.getAttributes(), |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
644 SourceLocation()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
645 ExprVector ArgExprs2; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
646 LHS = LookupAndDeclareName(envII); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
647 ArgExprs2.push_back(LHS.release()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
648 LHS = Actions.ActOnParenListExpr(Loc, Loc, ArgExprs2); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
649 Expr *envCastExpr = LHS.take(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
650 TypeSourceInfo *castTInfo = Actions.GetTypeForDeclaratorCast(envDInfo, envCastExpr->getType()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
651 LHS = Actions.MaybeConvertParenListExprToParenExpr(getCurScope(), envCastExpr); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
652 envCastExpr = LHS.take(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
653 LHS = Actions.BuildCStyleCastExpr(Loc, castTInfo, Loc, envCastExpr); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
654 ArgExprs.push_back(LHS.release()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
655 LHS = Actions.ActOnParenListExpr(Loc, Loc, ArgExprs); |
52
c22698ecb2a9
modified CreateIdentifierInfo and create new function which was named 'CreateUniqueIdentifierInfo'.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
48
diff
changeset
|
656 LHS = LookupMemberAndBuildExpr(CreateIdentifierInfo(__CBC_STRUCT_POINTER_NAME, Loc), |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
657 LHS.take(), true); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
658 Expr *ret_pCastExpr = LHS.take(); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
659 DeclarationName noValDeclName; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
660 TypeSourceInfo *CurFuncTypesPointerTI = Actions.Context.CreateTypeSourceInfo(Actions.BuildPointerType(CurFuncResQT, Loc, noValDeclName)); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
661 LHS = Actions.BuildCStyleCastExpr(Loc, CurFuncTypesPointerTI, Loc, ret_pCastExpr); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
662 LHS = Actions.ActOnUnaryOp(getCurScope(), Loc, tok::star, LHS.get()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
663 ExprResult RHS; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
664 RHS = LookupAndDeclareName(retvalII); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
665 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
666 retvalAssginmentExpr = Actions.ActOnBinOp(getCurScope(), Loc, tok::equal, LHS.take(), RHS.take()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
667 innerR = Actions.ActOnExprStmt(retvalAssginmentExpr); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
668 if(innerR.isUsable()) |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
669 FnStmts.push_back(innerR.release()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
670 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
671 ExprResult ljExpr,ljLHS; |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
672 ljExpr = IIToExpr(CreateIdentifierInfo("longjmp", Loc), tok::l_paren); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
673 ExprVector ljArgExprs; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
674 DeclSpec ljDS(AttrFactory); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
675 setTST(&ljDS, DeclSpec::TST_struct, structName); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
676 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
677 Declarator ljD(ljDS, Declarator::TypeNameContext); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
678 ljD.SetRangeEnd(Loc); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
679 DeclSpec starDS2(AttrFactory); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
680 starDS2.Finish(Diags, PP); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
681 ljD.ExtendWithDeclSpec(starDS2); |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
682 ljD.SetIdentifier(0, Loc); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
683 ljD.AddTypeInfo(DeclaratorChunk::getPointer(ljDS.getTypeQualifiers(), Loc, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
684 ljDS.getConstSpecLoc(), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
685 ljDS.getVolatileSpecLoc(), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
686 ljDS.getRestrictSpecLoc()), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
687 ljDS.getAttributes(), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
688 SourceLocation()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
689 ljLHS = LookupAndDeclareName(envII); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
690 Expr *ljCastExpr = ljLHS.take(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
691 TypeSourceInfo *ljCastTInfo = Actions.GetTypeForDeclaratorCast(ljD, ljCastExpr->getType()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
692 ljLHS = Actions.BuildCStyleCastExpr(Loc, ljCastTInfo, Loc, ljCastExpr); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
693 ljLHS = Actions.ActOnParenExpr(Loc, Loc, ljLHS.take()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
694 ljLHS = LookupMemberAndBuildExpr(envII, ljLHS.take(), true); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
695 ljLHS = Actions.ActOnParenExpr(Loc, Loc, ljLHS.take()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
696 ljArgExprs.push_back(ljLHS.release()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
697 CommaLocs.push_back(Loc); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
698 ljLHS = Actions.ActOnIntegerConstant(Loc, 1 /* return value for setjmp */); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
699 ljArgExprs.push_back(ljLHS.release()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
700 ljExpr = Actions.ActOnCallExpr(getCurScope(), ljExpr.take(), Loc, ljArgExprs, Loc, 0); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
701 innerR = Actions.ActOnExprStmt(ljExpr); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
702 if(innerR.isUsable()) |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
703 FnStmts.push_back(innerR.release()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
704 FnBody = Actions.ActOnCompoundStmt(Loc, Loc, FnStmts, false); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
705 BodyScope.Exit(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
706 TheDecl = Actions.ActOnFinishFunctionBody(BodyRes, FnBody.take()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
707 returnDecl = Actions.ConvertDeclToDeclGroup(TheDecl); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
708 (&Actions.getASTConsumer())->HandleTopLevelDecl(returnDecl.get()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
709 Actions.CurScope = SavedScope; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
710 Actions.CurContext = SavedContext; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
711 Actions.FunctionScopes.push_back(SavedFSI); |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
712 return false; |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
713 } |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
714 |
57
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
715 /* Create ExprResult from IdentifierInfo. |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
716 * It is used when II is a not primary expression such as not primary types, a function's name, etc. |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
717 */ |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
718 ExprResult Parser::IIToExpr(IdentifierInfo *II, tok::TokenKind Kind){ |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
719 SourceLocation Loc = Tok.getLocation(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
720 Token Next,IITok; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
721 Next.setKind(Kind); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
722 ExternalSpace::StatementFilterCCC CCCValidator(Next); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
723 CXXScopeSpec SS; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
724 Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, II, Loc, Next, false, &CCCValidator); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
725 IITok.startToken(); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
726 IITok.setLocation(Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
727 IITok.setIdentifierInfo(II); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
728 IITok.setKind(tok::annot_primary_expr); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
729 setExprAnnotation(IITok, Classification.getExpression()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
730 IITok.setAnnotationEndLoc(Loc); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
731 PP.AnnotateCachedTokens(IITok); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
732 return getExprAnnotation(IITok); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
733 } |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
734 |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
735 StmtResult Parser::CreateComplexStmtRet(IdentifierInfo *II, bool IsAddressOfOperand){ |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
736 ExprResult ER; |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
737 if (IsAddressOfOperand) { |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
738 ER = LookupAndDeclareName(II, true); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
739 ER = Actions.ActOnUnaryOp(getCurScope(), Tok.getLocation(), tok::amp, ER.get()); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
740 } |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
741 else |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
742 ER = IIToExpr(II,tok::semi); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
743 return Actions.ActOnExprStmt(ER); |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
744 } |
88b0e1f890d7
Use complex statements for goto with the environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
745 |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
746 ParmVarDecl* Parser::CreateParam(IdentifierInfo *II, int pointerNum, DeclSpec::TST T){ |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
747 SourceLocation Loc = Tok.getLocation(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
748 DeclSpec DS(AttrFactory); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
749 setTST(&DS, T); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
750 Declarator ParamDeclarator(DS, Declarator::PrototypeContext); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
751 ParamDeclarator.SetIdentifier(II, Loc); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
752 for(int i = 0;i<pointerNum; i++){ |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
753 DeclSpec pointerDS(AttrFactory); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
754 pointerDS.Finish(Diags, PP); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
755 ParamDeclarator.AddTypeInfo(DeclaratorChunk::getPointer(pointerDS.getTypeQualifiers(), Loc, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
756 pointerDS.getConstSpecLoc(), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
757 pointerDS.getVolatileSpecLoc(), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
758 pointerDS.getRestrictSpecLoc()), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
759 pointerDS.getAttributes(),SourceLocation()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
760 } |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
761 ParmVarDecl *Param = dyn_cast<ParmVarDecl>(Actions.ActOnParamDeclarator(getCurScope(), ParamDeclarator)); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
762 return Param; |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
763 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
764 } |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
765 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
766 void Parser::setTST(DeclSpec *DS, DeclSpec::TST T, IdentifierInfo* Name){ |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
767 SourceLocation Loc = Tok.getLocation(); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
768 bool isInvalid = false; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
769 const char *PrevSpec = 0; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
770 unsigned DiagID = 0; |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
771 CXXScopeSpec SS; |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
772 DS->SetRangeStart(Loc); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
773 DS->SetRangeEnd(Loc); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
774 if (T == DeclSpec::TST_struct) { |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
775 ParsedAttributesWithRange attrs(AttrFactory); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
776 DeclResult TagOrTempResult = true; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
777 bool Owned = false; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
778 bool IsDependent = false; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
779 MultiTemplateParamsArg TParams; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
780 TagOrTempResult = Actions.ActOnTag(getCurScope(), T, Sema::TUK_Reference, Loc, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
781 SS, Name, Loc, attrs.getList(), AS_none, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
782 DS->getModulePrivateSpecLoc(), |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
783 TParams, Owned, IsDependent, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
784 SourceLocation(), false, |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
785 clang::TypeResult()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
786 isInvalid = DS->SetTypeSpecType(T, Loc, Loc, PrevSpec, DiagID, TagOrTempResult.get(), Owned); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
787 } |
56
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
788 else if (T == DeclSpec::TST_typename) { |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
789 Token Next,TypeTok; |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
790 Next.setKind(tok::identifier); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
791 ExternalSpace::StatementFilterCCC CCCValidator(Next); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
792 Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, Name, Loc, Next, false, &CCCValidator); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
793 TypeTok.startToken(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
794 TypeTok.setLocation(Loc); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
795 TypeTok.setIdentifierInfo(Name); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
796 TypeTok.setKind(tok::annot_typename); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
797 setTypeAnnotation(TypeTok, Classification.getType()); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
798 TypeTok.setAnnotationEndLoc(Loc); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
799 PP.AnnotateCachedTokens(TypeTok); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
800 if (TypeTok.getAnnotationValue()) { |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
801 ParsedType PT = getTypeAnnotation(TypeTok); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
802 isInvalid = DS->SetTypeSpecType(T, Loc, PrevSpec, DiagID, PT); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
803 } else |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
804 DS->SetTypeSpecError(); |
bdef5c940791
copy the previous function's return type to return value
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
805 } |
48
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
806 else |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
807 isInvalid = DS->SetTypeSpecType(T, Loc, PrevSpec, DiagID); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
808 |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
809 DS->Finish(Diags, PP); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
810 if (isInvalid) { |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
811 assert(PrevSpec && "Method did not return previous specifier!"); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
812 assert(DiagID); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
813 if (DiagID == diag::ext_duplicate_declspec) |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
814 Diag(Tok, DiagID) |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
815 << PrevSpec << FixItHint::CreateRemoval(Tok.getLocation()); |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
816 else |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
817 Diag(Tok, DiagID) << PrevSpec; |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
818 } |
4b59af982ef3
create return function for continuation with the environment automatically, but it can return only int value and it's name is not unique now
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
47
diff
changeset
|
819 } |
45
9ebfb52ddd9b
create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
44
diff
changeset
|
820 |
58
01c954c1b51b
include setjmp.h automatically without checking __code
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
821 /// CheckTheSjHeader - Check whether setjmp.h has been already included or not. |
01c954c1b51b
include setjmp.h automatically without checking __code
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
822 /// If not, include it. |
01c954c1b51b
include setjmp.h automatically without checking __code
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
823 void Parser::CheckTheSjHeader(){ |
53
f679cc5126db
include setjmp.h automatically
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
52
diff
changeset
|
824 SourceLocation Loc = Tok.getLocation(); |
f679cc5126db
include setjmp.h automatically
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
52
diff
changeset
|
825 LookupResult R(Actions, CreateIdentifierInfo("setjmp", Loc), Loc, Actions.LookupOrdinaryName, Actions.ForRedeclaration); |
58
01c954c1b51b
include setjmp.h automatically without checking __code
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
826 if (!Actions.LookupName(R, getCurScope())){ // look up the setjmp |
01c954c1b51b
include setjmp.h automatically without checking __code
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
827 if (PP.IncludeHeader(Tok, "setjmp.h")) |
01c954c1b51b
include setjmp.h automatically without checking __code
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
828 ConsumeToken(); |
53
f679cc5126db
include setjmp.h automatically
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
52
diff
changeset
|
829 } |
f679cc5126db
include setjmp.h automatically
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
52
diff
changeset
|
830 } |
43
7116d17d6428
Two assignment statements, __CbC_environment.env = i_buf and _CbC_environment.ret_p = &retval, were createed automarically when we found __return.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
831 #endif |