annotate tools/clang/lib/Parse/ParseCbC.cpp @ 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
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Sun, 12 Jan 2014 19:15:16 +0900
parents 5b813d18f000
children c22698ecb2a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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/SourceManager.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/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
10 #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
11 #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
12 #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
13 #include "clang/Sema/TypoCorrection.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 #include "llvm/MC/MCAsmInfo.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 #include "llvm/MC/MCContext.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 #include "llvm/MC/MCObjectFileInfo.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 #include "llvm/MC/MCParser/MCAsmParser.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 #include "llvm/MC/MCRegisterInfo.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 #include "llvm/MC/MCStreamer.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 #include "llvm/MC/MCSubtargetInfo.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #include "llvm/MC/MCTargetAsmParser.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 #include "llvm/Support/SourceMgr.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "llvm/Support/TargetRegistry.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "llvm/Support/TargetSelect.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "llvm/ADT/SmallString.h"
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 #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
27 #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
28 #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
29
44
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
30 #include <cmath>
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
31 #include <sstream>
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
32
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
33 #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
34
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 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
36
42
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
37 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
38 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
39 public:
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 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
41 : 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
42 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
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
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 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
46 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
47 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
48 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
49
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 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
51 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
52 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
53 }
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 private:
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 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
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 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
60 public:
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71 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
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 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
75 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
76 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
77 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
78 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
79 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
80 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
81 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
82 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
83 }
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 private:
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 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
87 };
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 }
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
90 namespace CbCSpace{
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
91 enum AssignmentFlags {
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
92 HasStar = 0x01,
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
93 HasAmp = 0x02,
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
94 HasPeriod = 0x04,
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
95 HasArrow = 0x08
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
96 };
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
97
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
98 bool hasStar(unsigned F) { return F & HasStar; }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
99 bool hasAmp(unsigned F) { return F & HasAmp; }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
100 bool hasPeriod(unsigned F) { return F & HasPeriod; }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
101 bool hasArrow(unsigned F) { return F & HasArrow; }
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
102
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
103 enum DeclarationFlags {
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
104 ArrayType = 0x01,
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
105 PointerType = 0x02,
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
106 FunctionType = 0x04
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
107 };
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
109 bool isArray(unsigned F) { return F & ArrayType; }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
110 bool isPointer(unsigned F) { return F & PointerType; }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
111 bool isFunction(unsigned F) { return F & FunctionType; }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
112 }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
113
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
114
47
5b813d18f000 replace __environment with &__CbC_environment in a code segment's arguments
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 45
diff changeset
115 void Parser::PrepareForGotoWithTheEnv(){
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
116 StmtResult Res;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
117 SourceLocation Loc = Tok.getLocation();
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
118
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
119 CreateRetFunction();
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
120 Res = CreateDeclStmt(CreateIdentifierInfo(__CBC_STRUCT_NAME, __CBC_STRUCT_LENGTH, Loc), CbCSpace::FunctionType, DeclSpec::TST___code);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
121 if (Res.isUsable())
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
122 Stmtsp->push_back(Res.release());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
123
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
124 Res = CreateDeclStmt(CreateIdentifierInfo(__CBC_ENVIRONMENT_NAME, __CBC_ENVIRONMENT_LENGTH, Loc), 0, DeclSpec::TST_struct,
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
125 CreateIdentifierInfo(__CBC_STRUCT_NAME, __CBC_STRUCT_LENGTH, Loc));
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
126 if (Res.isUsable())
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
127 Stmtsp->push_back(Res.release());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
128
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
129 bufII = CreateSingleIdentifierInfo(__CBC_BUF_NAME, __CBC_BUF_LENGTH, Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
130 Res = CreateDeclStmt(bufII, CbCSpace::ArrayType, DeclSpec::TST_int);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
131 if (Res.isUsable())
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
132 Stmtsp->push_back(Res.release());
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
134 retvalII = CreateSingleIdentifierInfo(__CBC_RETVAL_NAME, __CBC_RETVAL_LENGTH, Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
135 Res = CreateDeclStmt(retvalII, 0, DeclSpec::TST_int);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
136 if (Res.isUsable())
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
137 Stmtsp->push_back(Res.release());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
138
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
139 Res = CreateAssignmentStmt(CreateIdentifierInfo(__CBC_ENVIRONMENT_NAME, __CBC_ENVIRONMENT_LENGTH, Loc),
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
140 retvalII, CbCSpace::HasPeriod, CbCSpace::HasAmp, CreateIdentifierInfo(__CBC_STRUCT_POINTER_NAME, __CBC_STRUCT_POINTER_LENGTH, Loc));
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
141 if (Res.isUsable())
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
142 Stmtsp->push_back(Res.release());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
143
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
144 Res = CreateAssignmentStmt(CreateIdentifierInfo(__CBC_ENVIRONMENT_NAME, __CBC_ENVIRONMENT_LENGTH, Loc),
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
145 bufII, CbCSpace::HasPeriod, 0, CreateIdentifierInfo(__CBC_STRUCT_ENV_NAME, __CBC_STRUCT_ENV_LENGTH, Loc));
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
146 if (Res.isUsable())
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
147 Stmtsp->push_back(Res.release());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
148
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
149 Res = CreateSjForContinuationWithEnv();
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
150 if (Res.isUsable())
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
151 Stmtsp->push_back(Res.release());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
152
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
153 Res = CreateAssignmentStmt(CreateIdentifierInfo(__CBC_RETURN_NAME, __CBC_RETURN_LENGTH, Loc),
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
154 CreateIdentifierInfo("return1", 7, Loc));
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
155 if (Res.isUsable())
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
156 Stmtsp->push_back(Res.release());
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 }
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
159
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
160 StmtResult Parser::CreateAssignmentStmt(IdentifierInfo* LHSII,IdentifierInfo* RHSII,unsigned LHSFlags,unsigned RHSFlags,
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
161 IdentifierInfo* extraLHSII,IdentifierInfo* extraRHSII){
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
162 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
163
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
164 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
165 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
166 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
167 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
168 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
169 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
170 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
171 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
172 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
173 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
174 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
175 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
176 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
177 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
178
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 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
180
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
181 if ( CbCSpace::hasPeriod(LHSFlags) )
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
182 LHS = LookupMemberAndBuildExpr(extraLHSII, LHS.take(), false);
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
183 else if ( CbCSpace::hasArrow(LHSFlags) )
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
184 LHS = LookupMemberAndBuildExpr(extraLHSII, LHS.take(), true); // It is not sure.
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
185
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
186 RHS = LookupAndDeclareName(RHSII);
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
187 if ( CbCSpace::hasAmp(RHSFlags) )
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
188 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
189
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
190 else if ( CbCSpace::hasStar(RHSFlags) )
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
191 RHS = Actions.ActOnUnaryOp(getCurScope(), Loc, tok::star, RHS.get()); // It is not sure.
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
192
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 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
194
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
195 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
196 }
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197
44
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
198 IdentifierInfo* Parser::CreateSingleIdentifierInfo(const char* Name, int length, SourceLocation Loc){
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
199 IdentifierInfo *II;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
200 int i = 0;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
201 std::ostringstream os;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
202
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
203 while (true) {
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
204 i++;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
205 os << Name << i;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
206 II = CreateIdentifierInfo(os.str().c_str(),length + (int)(floor(log10(i))+1),Loc);
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
207 LookupResult Previous(Actions, II, Loc, Actions.LookupOrdinaryName, Actions.ForRedeclaration);
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
208 if (!Actions.LookupName(Previous, getCurScope()))
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
209 return II;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
210 }
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
211 }
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
212
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
213 StmtResult Parser::CreateDeclStmt(IdentifierInfo *II, unsigned DeclFlags, DeclSpec::TST valueType, IdentifierInfo* Name){
44
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
214 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
215 DeclGroupPtrTy DeclGPT;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
216 ParsingDeclSpec DS(*this);
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
217 DeclSpec *DSp;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
218 DSp = &DS;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
219
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
220 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
221 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
222 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
223
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
224 if (CbCSpace::isFunction(DeclFlags)) {
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
225 D.setEllipsisLoc(SourceLocation());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
226 bool hadGroupingParens = D.hasGroupingParens();
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
227 D.setGroupingParens(true);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
228 IdentifierInfo* II = CreateIdentifierInfo(__CBC_RETURN_NAME, __CBC_RETURN_LENGTH, Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
229 D.SetRangeEnd(Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
230 DeclSpec FDS(AttrFactory);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
231
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
232 DS.Finish(Diags, PP);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
233 D.SetIdentifier(II, Loc);
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 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
236 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
237 D.setGroupingParens(hadGroupingParens);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
238
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
239
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
240 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
241 (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
242 bool HasProto = false;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
243 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
244 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
245 DeclSpec FPDS(AttrFactory);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
246 bool RefQualifierIsLValueRef = true;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
247 ExceptionSpecificationType ESpecType = EST_None;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
248 SourceRange ESpecRange;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
249 SmallVector<ParsedType, 2> DynamicExceptions;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
250 SmallVector<SourceRange, 2> DynamicExceptionRanges;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
251 ExprResult NoexceptExpr;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
252 ParsedAttributes FnAttrs(AttrFactory);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
253 TypeResult TrailingReturnType;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
254 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
255 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
256 RefQualifierIsLValueRef,RefQualifierLoc, ConstQualifierLoc,
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
257 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
258 DynamicExceptions.data(),DynamicExceptionRanges.data(),
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
259 DynamicExceptions.size(),
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
260 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
261 FnAttrs, Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
262 PrototypeScope.Exit();
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
263 DSp = &FDS;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
264 }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
265 if (CbCSpace::isArray(DeclFlags))
44
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
266 CreateArrayDecl(D, Loc);
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
267
44
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
268 SmallVector<Decl *, 8> DeclsInGroup;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
269 Decl *FirstDecl = ParseDeclarationAfterDeclaratorAndAttributes(D);
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
270 D.complete(FirstDecl);
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
271 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
272 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
273 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
274 }
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
275
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
276 void Parser::CreateArrayDecl(ParsingDeclarator &D, SourceLocation Loc){
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
277 ExprResult ExprRes;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
278 ParsedAttributesWithRange attrs(AttrFactory);
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
279 SmallString<128> SpellingBuffer;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
280 SpellingBuffer.resize(__JMP_BUF_SIZE_LENGTH + 1);
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
281 StringRef TokSpelling = StringRef(__JMP_BUF_SIZE,__JMP_BUF_SIZE_LENGTH);
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
282 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
283 Expr *sizeRes;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
284 QualType Ty;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
285 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
286 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
287 Literal.GetIntegerValue(ResultVal);
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
288 unsigned Width = 0;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
289 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
290 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
291 Width = IntSize;
aabc64b7263e create two declaration statements, env_buf and retval.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 43
diff changeset
292 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
293 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
294 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
295 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
296 }
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
297
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
298 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
299 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
300 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
301 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
302 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
303 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
304
42
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
305 CondExp = LookupAndDeclareName(CreateIdentifierInfo("setjmp",6,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
306 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
307 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
308
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
309 __envExprRes = LookupAndDeclareName(CreateIdentifierInfo(__CBC_ENVIRONMENT_NAME, __CBC_ENVIRONMENT_LENGTH, Loc));
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
310 __envExprRes = LookupMemberAndBuildExpr(CreateIdentifierInfo(__CBC_STRUCT_ENV_NAME, __CBC_STRUCT_ENV_LENGTH,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
311
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 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
313 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
314 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
315
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 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
317 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
318 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
319
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 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
321 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
322 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
323 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
324 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
325 ExprResult innerExprRes;
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
326 DeclSpec CastDS(AttrFactory);
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
327
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
328 setTST(&CastDS, DeclSpec::TST_int);
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
329 Declarator CastDeclaratorInfo(CastDS, Declarator::TypeNameContext);
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
330 CastDeclaratorInfo.SetRangeEnd(Loc);
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 DeclSpec pointerDS(AttrFactory);
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
332 pointerDS.Finish(Diags, PP);
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
333 DeclaratorScopeObj DeclScopeObj(*this, CastDeclaratorInfo.getCXXScopeSpec());
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
334 CastDeclaratorInfo.SetIdentifier(0, Loc);
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
335 CastDeclaratorInfo.AddTypeInfo(DeclaratorChunk::getPointer(pointerDS.getTypeQualifiers(), Loc,
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
336 pointerDS.getConstSpecLoc(),
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
337 pointerDS.getVolatileSpecLoc(),
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
338 pointerDS.getRestrictSpecLoc()),
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 pointerDS.getAttributes(),SourceLocation());
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
340
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
341 innerExprRes = LookupAndDeclareName(CreateIdentifierInfo(__CBC_ENVIRONMENT_NAME, __CBC_ENVIRONMENT_LENGTH, Loc));
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
342 innerExprRes = LookupMemberAndBuildExpr(CreateIdentifierInfo(__CBC_STRUCT_POINTER_NAME,__CBC_STRUCT_POINTER_LENGTH,Loc), innerExprRes.take(), false);
42
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
343 Expr *CastExpr = innerExprRes.take();
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
344 TypeSourceInfo *castTInfo = Actions.GetTypeForDeclaratorCast(CastDeclaratorInfo, CastExpr->getType());
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
345 Actions.checkUnusedDeclAttributes(CastDeclaratorInfo);
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
346
42
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
347 innerExprRes = Actions.BuildCStyleCastExpr(Loc, castTInfo, Loc, CastExpr);
41
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
348 innerExprRes = Actions.ActOnParenExpr(Loc, 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
349 innerExprRes = Actions.ActOnUnaryOp(getCurScope(), Loc, tok::star, innerExprRes.get());
1d6c745cd57d move some methods to ParseCbC.cpp which were written by me.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
350 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
351 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
352 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
353 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
354 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
355 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
356 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
357 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
358 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
359 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
360 }
42
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
361
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
362 ExprResult Parser::LookupAndDeclareName(IdentifierInfo *II){
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
363 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
364 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
365 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
366 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
367 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
368 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
369 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
370 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
371 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
372 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
373 DeclarationName DName = NameInfo.getName();
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
374 II = DName.getAsIdentifierInfo();
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
375 SourceLocation NameLoc = NameInfo.getLoc();
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
376 LookupResult R(Actions, NameInfo,Actions.LookupOrdinaryName);
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
377 Actions.LookupParsedName(R, getCurScope(), &SS, true);
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
378
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
379 if (II && R.empty()) {
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
380 NamedDecl *D = Actions.ImplicitlyDefineFunction(NameLoc, *II, getCurScope());
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
381 if (D) R.addDecl(D);
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
382 }
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
383 return Actions.BuildDeclarationNameExpr(SS, R, false);
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
384 }
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
385
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
386 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
387 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
388 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
389 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
390 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
391 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
392 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
393 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
394 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
395 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
396 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
397 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
398 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
399 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
400 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
401 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
402 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
403 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
404 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
405
3e178477409f made some submethods for the methods which emit CbC statements.
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 41
diff changeset
406 }
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
407
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
408
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
409 /// 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
410 /// 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
411 void Parser::Create__CbC_envStruct(SourceLocation Loc, AccessSpecifier AS) {
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
412 ParsingDeclSpec SDS(*this);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
413 if (SDS.getSourceRange().isInvalid()) {
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
414 SDS.SetRangeStart(Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
415 SDS.SetRangeEnd(Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
416 }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
417 IdentifierInfo *Name = CreateIdentifierInfo(__CBC_STRUCT_NAME, __CBC_STRUCT_LENGTH, Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
418
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
419 // 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
420 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
421 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
422 return;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
423
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
424
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
425 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
426 DeclResult TagOrTempResult = true;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
427 bool Owned = false;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
428 bool IsDependent = false;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
429 ParsedAttributesWithRange attrs(AttrFactory);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
430 MultiTemplateParamsArg TParams;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
431
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
432 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
433 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
434 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
435 SourceLocation(), false, clang::TypeResult());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
436
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
437 Decl *TagDecl = TagOrTempResult.get();
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
438 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
439 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
440 Actions.ActOnTagStartDefinition(getCurScope(), TagDecl);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
441 SmallVector<Decl *, 32> FieldDecls;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
442
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
443 const char *PrevSpec = 0;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
444 unsigned DiagID = 0;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
445
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
446 FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_void, Loc, __CBC_STRUCT_POINTER_NAME, __CBC_STRUCT_POINTER_LENGTH));
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
447 FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_int, Loc, __CBC_STRUCT_ENV_NAME, __CBC_STRUCT_ENV_LENGTH));
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 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
450 StructScope.Exit();
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
451 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
452 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
453
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
454 if (Result){
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
455 Diag(Loc, DiagID) << PrevSpec;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
456 }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
457
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
458 SDS.Finish(Diags,PP);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
459 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
460 SDS.complete(TheDecl);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
461 Actions.ConvertDeclToDeclGroup(TheDecl);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
462 }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
463
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
464 Decl* Parser::Create__CbC_envBody(Decl* TagDecl, DeclSpec::TST T, SourceLocation Loc, const char* Name, int NameLen){
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
465 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
466 setTST(&PDS, T);
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
467 SourceLocation CommaLoc;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
468 ParsingFieldDeclarator DeclaratorInfo(*this, PDS);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
469 DeclaratorInfo.D.setCommaLoc(CommaLoc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
470 DeclaratorInfo.D.SetRangeEnd(Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
471 DeclSpec DS(AttrFactory);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
472 DS.Finish(Diags,PP);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
473 DeclaratorInfo.D.SetIdentifier(CreateIdentifierInfo(Name, NameLen,Loc),Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
474
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
475 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
476 DS.getVolatileSpecLoc(),DS.getRestrictSpecLoc()),
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
477 DS.getAttributes(),SourceLocation());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
478 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
479 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
480 DeclaratorInfo.D, DeclaratorInfo.BitfieldSize);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
481 DeclaratorInfo.complete(Field);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
482 return Field;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
483 }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
484
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
485 IdentifierInfo* Parser::CreateIdentifierInfo(const char* Name, int NameLen, SourceLocation Loc) {
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
486 Token TokenForII;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
487 TokenForII.startToken();
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
488 TokenForII.setLocation(Loc);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
489 TokenForII.setLength(NameLen);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
490 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
491 TokenForII.setRawIdentifierData(Name);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
492 IdentifierInfo *II;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
493 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
494 TokenForII.setIdentifierInfo(II);
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
495 TokenForII.setKind(II->getTokenID());
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
496 return II;
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
497 }
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
498
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
499 void Parser::CreateRetFunction(){
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
500 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
501 DeclContext *SavedContext = Actions.CurContext;
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
502 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
503 DeclSpec::TST retvalType = DeclSpec::TST_int;
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
504
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
505 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
506 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
507 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
508 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
509 Actions.CurScope = TopScope;
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
510 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
511 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
512 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
513 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
514 ParsingDeclarator D(*this, PDS, static_cast<Declarator::TheContext>(Declarator::FileContext));
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
515 D.SetIdentifier(CreateIdentifierInfo("return1", 7, Loc),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
516 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
517 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
518 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
519 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
520 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
521 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
522 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
523 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
524 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
525 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
526 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
527 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
528 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
529 TypeResult TrailingReturnType;
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
530
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
531
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
532 IdentifierInfo *retvalII = CreateIdentifierInfo(__CBC_RETVAL_NAME, __CBC_RETVAL_LENGTH, 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
533 // TODO : We should change retval type to a destination function's return type.
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
534 CreateParam(retvalType, retvalII, 0, &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
535 IdentifierInfo *envII = CreateIdentifierInfo(__CBC_STRUCT_ENV_NAME, __CBC_STRUCT_ENV_LENGTH, 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
536 CreateParam(DeclSpec::TST_void, envII, 1, &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
537
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
538 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
539 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
540 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
541 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
542 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
543 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
544 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
545
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
546 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
547 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
548 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
549
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
550 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
551 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
552 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
553 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
554 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
555 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
556 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
557 DeclSpec retvalTypeDS(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
558 setTST(&retvalTypeDS, retvalType);
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
559
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
560 Declarator retvalTypeDInfo(retvalTypeDS, 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
561 retvalTypeDInfo.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
562 DeclSpec starDS(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
563 starDS.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
564 retvalTypeDInfo.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
565 retvalTypeDInfo.AddTypeInfo(DeclaratorChunk::getPointer(starDS.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
566 starDS.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
567 starDS.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
568 starDS.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
569 starDS.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
570 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
571
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 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
573 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
574 DeclSpec envDS(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
575 IdentifierInfo *structName = CreateIdentifierInfo(__CBC_STRUCT_NAME, __CBC_STRUCT_LENGTH, 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
576 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
577
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 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
579 envDInfo.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
580 DeclSpec starDS2(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
581 starDS2.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
582 envDInfo.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
583 envDInfo.AddTypeInfo(DeclaratorChunk::getPointer(starDS2.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
584 starDS2.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
585 starDS2.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
586 starDS2.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
587 starDS2.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
588 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
589 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
590 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
591 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
592 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
593 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
594 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
595 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
596 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
597 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
598 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
599 LHS = Actions.ActOnParenListExpr(Loc, Loc, 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
600 LHS = LookupMemberAndBuildExpr(CreateIdentifierInfo(__CBC_STRUCT_POINTER_NAME, __CBC_STRUCT_POINTER_LENGTH, 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
601 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
602 Expr *ret_pCastExpr = 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
603 TypeSourceInfo *castTInfo2 = Actions.GetTypeForDeclaratorCast(retvalTypeDInfo, ret_pCastExpr->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
604 LHS = Actions.BuildCStyleCastExpr(Loc, castTInfo2, Loc, ret_pCastExpr);
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
605 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
606 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
607 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
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 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
610 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
611 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
612 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
613
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 Token Next,ljTok;
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 Next.setKind(tok::l_paren);
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 ExternalSpace::StatementFilterCCC CCCValidator(Next);
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 CXXScopeSpec SS;
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 IdentifierInfo *ljName = CreateIdentifierInfo("longjmp", 7, 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
619 Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, ljName, Loc, Next, false, &CCCValidator);
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 ljTok.startToken();
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 ljTok.setLocation(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
622 ljTok.setIdentifierInfo(ljName);
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 ljTok.setKind(tok::annot_primary_expr);
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 setExprAnnotation(ljTok, Classification.getExpression());
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 ljTok.setAnnotationEndLoc(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
626 PP.AnnotateCachedTokens(ljTok);
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 ljExpr,ljLHS;
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 ljExpr = getExprAnnotation(ljTok);
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 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
630 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
631 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
632
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 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
634 ljD.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
635 DeclSpec starDS3(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
636 starDS3.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
637 ljD.ExtendWithDeclSpec(starDS3);
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 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
639 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
640 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
641 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
642 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
643 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
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 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
646 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
647 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
648 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
649 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
650 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
651 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
652 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
653 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
654 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
655 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
656 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
657 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
658 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
659 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
660 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
661 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
662 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
663 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
664 (&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
665 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
666 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
667 Actions.FunctionScopes.push_back(SavedFSI);
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 }
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
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 void Parser::CreateParam(DeclSpec::TST T, IdentifierInfo *II, int pointerNum, 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
671 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
672 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
673 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
674 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
675 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
676 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
677 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
678 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
679 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
680 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
681 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
682 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
683 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
684 }
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 Decl *Param = Actions.ActOnParamDeclarator(getCurScope(), ParamDeclarator);
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 ParamInfo->push_back(DeclaratorChunk::ParamInfo(II, ParamDeclarator.getIdentifierLoc(), Param, 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
687
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 }
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
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 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
691 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
692 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
693 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
694 unsigned DiagID = 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
695 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
696 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
697 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
698 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
699 CXXScopeSpec &SS = DS->getTypeSpecScope();
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 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
701 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
702 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
703 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
704 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
705 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
706 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
707 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
708 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
709 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
710 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
711 }
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
712 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
713 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
714
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
715 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
716 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
717 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
718 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
719 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
720 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
721 << 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
722 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
723 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
724 }
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
725 }
45
9ebfb52ddd9b create declaration statement automatically for __CbC_environment
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 44
diff changeset
726
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
727 #endif