Mercurial > hg > CbC > CbC_llvm
changeset 86:99580de8d21d
Fix compile error to update llvm 3.7
## Change variable types tools/clang/lib/Parse/ParseCbC.cpp
* ExternalSpace::StatementFilterCCC Validator
-> std::unique_ptr<ExternalSpace::StatementFilterCCC> Validator(new ExternalSpace::StatementFilterCCC(Next))
* ExternalSpace::CastExpressionIdValidator Validator
-> std::unique_ptr<ExternalSpace::CastExpressionIdValidator> Validator(new ExternalSpace::CastExpressionIdValidator(false,true))
## Change arguments
* DeclaratorChunk::getFunction arguments:23 -> 25
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Feb 2015 06:05:01 +0900 |
parents | 5e5d649e25d2 |
children | ff9ec87918d4 |
files | tools/clang/include/clang/Basic/LangOptions.def tools/clang/lib/Lex/PPDirectives.cpp tools/clang/lib/Parse/ParseCbC.cpp |
diffstat | 3 files changed, 69 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/clang/include/clang/Basic/LangOptions.def Thu Feb 19 15:19:25 2015 +0900 +++ b/tools/clang/include/clang/Basic/LangOptions.def Tue Feb 24 06:05:01 2015 +0900 @@ -9,38 +9,63 @@ // // This file defines the language options. Users of this file must // define the LANGOPT macro to make use of this information. -// Optionally, the user may also define BENIGN_LANGOPT -// (for options that don't affect the construction of the AST in an -// incompatible way), ENUM_LANGOPT (for options that have enumeration, -// rather than unsigned, type), BENIGN_ENUM_LANGOPT (for benign -// options that have enumeration type), and VALUE_LANGOPT is a language option -// that describes a value rather than a flag. +// +// Optionally, the user may also define: +// +// BENIGN_LANGOPT: for options that don't affect the construction of the AST in +// any way (that is, the value can be different between an implicit module +// and the user of that module). +// +// COMPATIBLE_LANGOPT: for options that affect the construction of the AST in +// a way that doesn't prevent interoperability (that is, the value can be +// different between an explicit module and the user of that module). // +// ENUM_LANGOPT: for options that have enumeration, rather than unsigned, type. +// +// VALUE_LANGOPT: for options that describe a value rather than a flag. +// +// BENIGN_ENUM_LANGOPT, COMPATIBLE_ENUM_LANGOPT: combinations of the above. +// +// FIXME: Clients should be able to more easily select whether they want +// different levels of compatibility versus how to handle different kinds +// of option. //===----------------------------------------------------------------------===// + #ifndef LANGOPT # error Define the LANGOPT macro to handle language options #endif +#ifndef COMPATIBLE_LANGOPT +# define COMPATIBLE_LANGOPT(Name, Bits, Default, Description) \ + LANGOPT(Name, Bits, Default, Description) +#endif + +#ifndef BENIGN_LANGOPT +# define BENIGN_LANGOPT(Name, Bits, Default, Description) \ + COMPATIBLE_LANGOPT(Name, Bits, Default, Description) +#endif + +#ifndef ENUM_LANGOPT +# define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ + LANGOPT(Name, Bits, Default, Description) +#endif + +#ifndef COMPATIBLE_ENUM_LANGOPT +# define COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ + ENUM_LANGOPT(Name, Type, Bits, Default, Description) +#endif + +#ifndef BENIGN_ENUM_LANGOPT +# define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ + COMPATIBLE_ENUM_LANGOPT(Name, Type, Bits, Default, Description) +#endif + #ifndef VALUE_LANGOPT # define VALUE_LANGOPT(Name, Bits, Default, Description) \ LANGOPT(Name, Bits, Default, Description) #endif -#ifndef BENIGN_LANGOPT -# define BENIGN_LANGOPT(Name, Bits, Default, Description) \ - LANGOPT(Name, Bits, Default, Description) -#endif - -#ifndef ENUM_LANGOPT -# define ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ - LANGOPT(Name, Bits, Default, Description) -#endif - -#ifndef BENIGN_ENUM_LANGOPT -# define BENIGN_ENUM_LANGOPT(Name, Type, Bits, Default, Description) \ - ENUM_LANGOPT(Name, Type, Bits, Default, Description) -#endif - +// FIXME: A lot of the BENIGN_ options should be COMPATIBLE_ instead. LANGOPT(C99 , 1, 0, "C99") LANGOPT(C11 , 1, 0, "C11") LANGOPT(MSVCCompat , 1, 0, "Microsoft Visual C++ full compatibility mode")
--- a/tools/clang/lib/Lex/PPDirectives.cpp Thu Feb 19 15:19:25 2015 +0900 +++ b/tools/clang/lib/Lex/PPDirectives.cpp Tue Feb 24 06:05:01 2015 +0900 @@ -2545,7 +2545,7 @@ bool isAngled = true; // '<' header name '>' const DirectoryLookup *CurDir; ModuleMap::KnownHeader SuggestedModule; - const FileEntry *File = LookupFile(Loc, Filename, isAngled, LookupFrom, CurDir, NULL, NULL, + const FileEntry *File = LookupFile(Loc, Filename, isAngled, LookupFrom, NULL, CurDir, NULL, NULL, HeaderInfo.getHeaderSearchOpts().ModuleMaps ? &SuggestedModule : 0); if (File == 0) { Diag(FilenameTok, diag::err_pp_file_not_found) << Filename; // setjmp.h was not found
--- a/tools/clang/lib/Parse/ParseCbC.cpp Thu Feb 19 15:19:25 2015 +0900 +++ b/tools/clang/lib/Parse/ParseCbC.cpp Tue Feb 24 06:05:01 2015 +0900 @@ -239,8 +239,8 @@ LHSToken.setLocation(Loc); LHSToken.setIdentifierInfo(LHSII); LHSToken.setKind(tok::annot_primary_expr); - ExternalSpace::StatementFilterCCC Validator(Next); - Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, LHSII, Loc, Next, false, SS.isEmpty() ? &Validator : 0); + std::unique_ptr<ExternalSpace::StatementFilterCCC> Validator(new ExternalSpace::StatementFilterCCC(Next)); + Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, LHSII, Loc, Next, false, SS.isEmpty() ? std::move(Validator) : 0); setExprAnnotation(LHSToken, Classification.getExpression()); LHSToken.setAnnotationEndLoc(Loc); PP.AnnotateCachedTokens(LHSToken); @@ -291,7 +291,7 @@ (D.isFunctionDeclaratorAFunctionDeclaration() ? Scope::FunctionDeclarationScope : 0)); bool HasProto = false; SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo; - SourceLocation EllipsisLoc, RefQualifierLoc, ConstQualifierLoc, VolatileQualifierLoc; + SourceLocation EllipsisLoc, RefQualifierLoc, ConstQualifierLoc, VolatileQualifierLoc, RestrictQualifierLoc; DeclSpec FPDS(AttrFactory); bool RefQualifierIsLValueRef = true; ExceptionSpecificationType ESpecType = EST_None; @@ -299,6 +299,7 @@ SmallVector<ParsedType, 2> DynamicExceptions; SmallVector<SourceRange, 2> DynamicExceptionRanges; ExprResult NoexceptExpr; + CachedTokens *ExceptionSpecTokens = 0; ParsedAttributes FnAttrs(AttrFactory); TypeResult TrailingReturnType; @@ -315,13 +316,14 @@ ParamInfo.push_back(DeclaratorChunk::ParamInfo(0, Loc, Param, 0)); HasProto = true; - D.AddTypeInfo(DeclaratorChunk::getFunction(HasProto,false,Loc,ParamInfo.data(), - ParamInfo.size(),EllipsisLoc, Loc, FPDS.getTypeQualifiers(), - RefQualifierIsLValueRef,RefQualifierLoc, ConstQualifierLoc, - VolatileQualifierLoc,SourceLocation(),ESpecType, ESpecRange.getBegin(), - DynamicExceptions.data(),DynamicExceptionRanges.data(), + D.AddTypeInfo(DeclaratorChunk::getFunction(HasProto, false, Loc, ParamInfo.data(), + ParamInfo.size(), EllipsisLoc, Loc, FPDS.getTypeQualifiers(), + RefQualifierIsLValueRef, RefQualifierLoc, ConstQualifierLoc, + VolatileQualifierLoc, RefQualifierLoc, SourceLocation(), + ESpecType, ESpecRange.getBegin(), + DynamicExceptions.data(), DynamicExceptionRanges.data(), DynamicExceptions.size(), - NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0,Loc, Loc, D,TrailingReturnType), + NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, ExceptionSpecTokens, Loc, Loc, D, TrailingReturnType), FnAttrs, Loc); PrototypeScope.Exit(); DSp = &FDS; @@ -458,9 +460,9 @@ UnqualifiedId Name; CXXScopeSpec SS; SourceLocation TemplateKWLoc; - ExternalSpace::CastExpressionIdValidator Validator(false,true); + std::unique_ptr<ExternalSpace::CastExpressionIdValidator> Validator(new ExternalSpace::CastExpressionIdValidator(false,true)); Name.setIdentifier(II, Loc); - return Actions.ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Name, false, IsAddressOfOperand, &Validator); + return Actions.ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Name, false, IsAddressOfOperand, std::move(Validator)); } /// LookupMemberAndBuildExpr - Look up member name, create ExprResult and return it. @@ -621,7 +623,7 @@ bool IsAmbiguous = false; bool HasProto = true; SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo; - SourceLocation EllipsisLoc, RefQualifierLoc, ConstQualifierLoc, VolatileQualifierLoc; + SourceLocation EllipsisLoc, RefQualifierLoc, ConstQualifierLoc, VolatileQualifierLoc, RestrictQualifierLoc; DeclSpec FDS(AttrFactory); bool RefQualifierIsLValueRef = true; ExceptionSpecificationType ESpecType = EST_None; @@ -629,6 +631,7 @@ SmallVector<ParsedType, 2> DynamicExceptions; SmallVector<SourceRange, 2> DynamicExceptionRanges; ExprResult NoexceptExpr; + CachedTokens *ExceptionSpecTokens = 0; ParsedAttributes FnAttrs(AttrFactory); TypeResult TrailingReturnType; ParmVarDecl *Param; @@ -645,9 +648,10 @@ D.AddTypeInfo(DeclaratorChunk::getFunction(HasProto, IsAmbiguous, Loc, ParamInfo.data(), ParamInfo.size(), EllipsisLoc, Loc, FDS.getTypeQualifiers(), RefQualifierIsLValueRef, RefQualifierLoc, ConstQualifierLoc, - VolatileQualifierLoc, SourceLocation(), ESpecType, ESpecRange.getBegin(), + VolatileQualifierLoc, RestrictQualifierLoc, SourceLocation(), + ESpecType, ESpecRange.getBegin(), DynamicExceptions.data(), DynamicExceptionRanges.data(), DynamicExceptions.size(), - NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, + NoexceptExpr.isUsable() ? NoexceptExpr.get() : 0, ExceptionSpecTokens, Loc, Loc, D, TrailingReturnType), FnAttrs, Loc); PrototypeScope.Exit(); @@ -754,9 +758,9 @@ SourceLocation Loc = Tok.getLocation(); Token Next,IITok; Next.setKind(Kind); - ExternalSpace::StatementFilterCCC CCCValidator(Next); + std::unique_ptr<ExternalSpace::StatementFilterCCC> CCCValidator(new ExternalSpace::StatementFilterCCC(Next)); CXXScopeSpec SS; - Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, II, Loc, Next, false, &CCCValidator); + Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, II, Loc, Next, false, std::move(CCCValidator)); IITok.startToken(); IITok.setLocation(Loc); IITok.setIdentifierInfo(II); @@ -836,8 +840,8 @@ else if (T == DeclSpec::TST_typename) { Token Next,TypeTok; Next.setKind(tok::identifier); - ExternalSpace::StatementFilterCCC CCCValidator(Next); - Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, Name, Loc, Next, false, &CCCValidator); + std::unique_ptr<ExternalSpace::StatementFilterCCC> CCCValidator(new ExternalSpace::StatementFilterCCC(Next)); + Sema::NameClassification Classification = Actions.ClassifyName(getCurScope(), SS, Name, Loc, Next, false, std::move(CCCValidator)); TypeTok.startToken(); TypeTok.setLocation(Loc); TypeTok.setIdentifierInfo(Name);