changeset 242:b2ae1833b9d9

bug fixing
author matac
date Thu, 10 Aug 2023 16:52:17 +0900
parents 631279f04749
children a916df8444bf
files clang/include/clang/Parse/Parser.h clang/lib/Lex/Preprocessor.cpp clang/lib/Parse/ParseStmt.cpp
diffstat 3 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/clang/include/clang/Parse/Parser.h	Thu Aug 10 15:24:13 2023 +0900
+++ b/clang/include/clang/Parse/Parser.h	Thu Aug 10 16:52:17 2023 +0900
@@ -2125,7 +2125,7 @@
   StmtResult ParseForStatement(SourceLocation *TrailingElseLoc);
   StmtResult ParseGotoStatement();
 #ifndef noCbC
-  StmtResult ParseCbCGotoStatement(ParsedAttributesWithRange &Attrs,StmtVector &Stmts);
+  StmtResult ParseCbCGotoStatement(ParsedAttributes &Attrs,StmtVector &Stmts);
   void CompileFromString(const char *str, StmtVector &CompoundStmts);
 #endif
   StmtResult ParseContinueStatement();
@@ -2475,13 +2475,9 @@
   ExprResult LookupNameAndBuildExpr(IdentifierInfo *II = 0, bool IsAddressOfOperand = false);
   ExprResult LookupMemberAndBuildExpr(IdentifierInfo *II, Expr* Base, bool IsArrow);
   StmtResult CreateSjForContinuationWithTheEnv();
-  StmtResult CreateAssignmentStmt(IdentifierInfo* LHSII = 0, IdentifierInfo* RHSII = 0, bool LHSisM
-mberAccess = false,
-                                  bool RHShasAmp = false, IdentifierInfo* extraLHSII = 0, Identifie
-Info* extraRHSII = 0);
-  StmtResult CreateDeclStmt(IdentifierInfo *II = 0, bool isRetCS = false, bool copyType = false, in
- array = 0, DeclSpec::TST valueType = DeclSpec::TST_int, IdentifierInfo* Name = 0, DeclSpec::TQ TQ
- DeclSpec::TQ_unspecified);
+  StmtResult CreateAssignmentStmt(IdentifierInfo* LHSII = 0, IdentifierInfo* RHSII = 0, bool LHSisMemberAccess = false,
+                                  bool RHShasAmp = false, IdentifierInfo* extraLHSII = 0, IdentifierInfo* extraRHSII = 0);
+  StmtResult CreateDeclStmt(IdentifierInfo *II = 0, bool isRetCS = false, bool copyType = false, int array = 0, DeclSpec::TST valueType = DeclSpec::TST_int, IdentifierInfo* Name = 0, DeclSpec::TQ TQ = DeclSpec::TQ_unspecified);
   IdentifierInfo* CreateUniqueIdentifierInfo(const char* Name, SourceLocation Loc);
   ParmVarDecl* CreateParam(IdentifierInfo *II = 0, int pointerNum = 0, DeclSpec::TST T = DeclSpec::TST_int);
   Decl* HandleDeclAndChangeDeclType(Declarator &D);
--- a/clang/lib/Lex/Preprocessor.cpp	Thu Aug 10 15:24:13 2023 +0900
+++ b/clang/lib/Lex/Preprocessor.cpp	Thu Aug 10 16:52:17 2023 +0900
@@ -1487,6 +1487,7 @@
 Token Preprocessor::ReadFromString(const char *src , SourceLocation Loc) {
     // Push the ( "string" ) tokens into the token stream.
     MacroInfo *MI = AllocateMacroInfo(Loc);
+    SmallVector<Token, 16> Tokens;
     Token Tok;
     std::unique_ptr<Lexer> lx(new Lexer(CurLexer->getFileID(),getSourceManager().getBufferOrFake(CurLexer->getFileID(), Loc),*this));
     lx->InitLexer(src,src,src + strlen(src));
@@ -1495,14 +1496,16 @@
     int i = 0;
     while (Tok.getKind() != tok::TokenKind::eof) {
       Tok.setLocation(Loc);
-      MI->AddTokenToBody(Tok);
+      Tokens.push_back(Tok);
       Lex(Tok); i++;
     }
     Tok.setLocation(Loc);
-    MI->AddTokenToBody(Tok); i++;
+    Tokens.push_back(Tok);
+    i++;
     MI->DefinitionLength = i;
     CurLexer = std::move(lx);
     CurPPLexer = CurLexer.get();
+    MI->setTokens(Tokens, BP);
     EnterMacro(Tok, Loc, MI , 0 );
     CurTokenLexer->MacroDefLength = i;
     return Tok;
--- a/clang/lib/Parse/ParseStmt.cpp	Thu Aug 10 15:24:13 2023 +0900
+++ b/clang/lib/Parse/ParseStmt.cpp	Thu Aug 10 16:52:17 2023 +0900
@@ -317,7 +317,7 @@
       if (!(Next.is(tok::identifier) && PP.LookAhead(1).is(tok::semi)) && // C: 'goto' identifier ';'
           Next.isNot(tok::star)) {                                        // C: 'goto' '*' expression ';'
         SemiError = "goto code segment";
-        return ParseCbCGotoStatement(Attrs, Stmts);                       // CbC: goto codesegment statement
+        return ParseCbCGotoStatement(GNUAttrs, Stmts);                       // CbC: goto codesegment statement
       }
     }
 #endif