Mercurial > hg > CbC > CbC_llvm
changeset 10:e3d004bb4de5
can tell the Type which is void or __code and set tail call flag only __code.
line wrap: on
line diff
--- a/include/llvm/IR/Type.h Thu Jul 04 02:18:09 2013 +0900 +++ b/include/llvm/IR/Type.h Sat Jul 13 18:16:49 2013 +0900 @@ -71,6 +71,7 @@ ArrayTyID, ///< 13: Arrays PointerTyID, ///< 14: Pointers VectorTyID, ///< 15: SIMD 'packed' format, or other vector type + NumTypeIDs, // Must remain as last defined ID LastPrimitiveTyID = X86_MMXTyID, @@ -87,11 +88,18 @@ // Note: TypeID : low 8 bit; SubclassData : high 24 bit. uint32_t IDAndSubclassData; +#ifndef noCbC + bool is__Code; +#endif + protected: friend class LLVMContextImpl; explicit Type(LLVMContext &C, TypeID tid) : Context(C), IDAndSubclassData(0), NumContainedTys(0), ContainedTys(0) { +#ifndef noCbC + is__Code = false; +#endif setTypeID(tid); } ~Type() {} @@ -139,6 +147,13 @@ /// isVoidTy - Return true if this is 'void'. bool isVoidTy() const { return getTypeID() == VoidTyID; } +#ifndef noCbC + void set__CodeFlag(bool f) { is__Code = f;} + + /// is__CodeTy - Return true if this is '__code'. + bool is__CodeTy() const { return is__Code; } +#endif + /// isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type. bool isHalfTy() const { return getTypeID() == HalfTyID; }
--- a/include/llvm/LinkAllPasses.h Thu Jul 04 02:18:09 2013 +0900 +++ b/include/llvm/LinkAllPasses.h Sat Jul 13 18:16:49 2013 +0900 @@ -135,7 +135,11 @@ (void) llvm::createStripNonDebugSymbolsPass(); (void) llvm::createStripDeadDebugInfoPass(); (void) llvm::createStripDeadPrototypesPass(); +#ifndef noCbC + (void) llvm::createTailCallEliminationPass(false); +#else (void) llvm::createTailCallEliminationPass(); +#endif (void) llvm::createJumpThreadingPass(); (void) llvm::createUnifyFunctionExitNodesPass(); (void) llvm::createInstCountPass();
--- a/include/llvm/Transforms/Scalar.h Thu Jul 04 02:18:09 2013 +0900 +++ b/include/llvm/Transforms/Scalar.h Sat Jul 13 18:16:49 2013 +0900 @@ -227,7 +227,11 @@ // TailCallElimination - This pass eliminates call instructions to the current // function which occur immediately before return instructions. // +#ifndef noCbC +FunctionPass *createTailCallEliminationPass(bool isOnlyForCbC); +#else FunctionPass *createTailCallEliminationPass(); +#endif //===----------------------------------------------------------------------===// //
--- a/lib/IR/LLVMContextImpl.h Thu Jul 04 02:18:09 2013 +0900 +++ b/lib/IR/LLVMContextImpl.h Sat Jul 13 18:16:49 2013 +0900 @@ -295,7 +295,6 @@ Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy; Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy; IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty; - /// TypeAllocator - All dynamically allocated types are allocated from this. /// They live forever until the context is torn down.
--- a/lib/Transforms/IPO/PassManagerBuilder.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/lib/Transforms/IPO/PassManagerBuilder.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -134,6 +134,9 @@ if (!GlobalExtensions->empty() || !Extensions.empty()) MPM.add(createBarrierNoopPass()); +#ifndef noCbC + MPM.add(createTailCallEliminationPass(true)); // Eliminate tail calls +#endif addExtensionsToPM(EP_EnabledOnOptLevel0, MPM); return; } @@ -181,7 +184,11 @@ MPM.add(createCFGSimplificationPass()); // Merge & remove BBs MPM.add(createInstructionCombiningPass()); // Combine silly seq's +#ifndef noCbC + MPM.add(createTailCallEliminationPass(false)); // Eliminate tail calls +#else MPM.add(createTailCallEliminationPass()); // Eliminate tail calls +#endif MPM.add(createCFGSimplificationPass()); // Merge & remove BBs MPM.add(createReassociatePass()); // Reassociate expressions MPM.add(createLoopRotatePass()); // Rotate Loop
--- a/lib/Transforms/Scalar/Scalar.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/lib/Transforms/Scalar/Scalar.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -153,7 +153,11 @@ } void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM) { +#ifndef noCbC + unwrap(PM)->add(createTailCallEliminationPass(false)); +#else unwrap(PM)->add(createTailCallEliminationPass()); +#endif } void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM) {
--- a/lib/Transforms/Scalar/TailRecursionElimination.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -86,7 +86,12 @@ TailCallElim() : FunctionPass(ID) { initializeTailCallElimPass(*PassRegistry::getPassRegistry()); } - +#ifndef noCbC + TailCallElim(bool f) : FunctionPass(ID) { + initializeTailCallElimPass(*PassRegistry::getPassRegistry()); + onlyForCbC = f; + } +#endif virtual void getAnalysisUsage(AnalysisUsage &AU) const; virtual bool runOnFunction(Function &F); @@ -110,6 +115,15 @@ bool CannotTailCallElimCallsMarkedTail); bool CanMoveAboveCall(Instruction *I, CallInst *CI); Value *CanTransformAccumulatorRecursion(Instruction *I, CallInst *CI); +#ifndef noCbC + bool onlyForCbC; +#endif + +#ifndef noCbC + public: + void setCbCFlag(bool f); + bool isOnlyForCbC(); +#endif }; } @@ -120,10 +134,17 @@ INITIALIZE_PASS_END(TailCallElim, "tailcallelim", "Tail Call Elimination", false, false) +#ifndef noCbC +// Public interface to the TailCallElimination pass +FunctionPass *llvm::createTailCallEliminationPass(bool isOnlyForCbC) { + return new TailCallElim(isOnlyForCbC); +} +#else // Public interface to the TailCallElimination pass FunctionPass *llvm::createTailCallEliminationPass() { return new TailCallElim(); } +#endif void TailCallElim::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<TargetTransformInfo>(); @@ -176,6 +197,18 @@ // doesn't). bool CannotTCETailMarkedCall = false; +#ifndef noCbC + if (!FunctionContainsEscapingAllocas && !F.callsFunctionThatReturnsTwice()) + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) + if (CallInst *CI = dyn_cast<CallInst>(I)) { + if (CI->getCalledFunction()->getReturnType()->is__CodeTy()) { + CI->setTailCall(); + MadeChange = true; + } + } +#endif + // Loop over the function, looking for any returning blocks, and keeping track // of whether this function has any non-trivially used allocas. for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { @@ -230,10 +263,15 @@ for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (CallInst *CI = dyn_cast<CallInst>(I)) { - CI->setTailCall(); - MadeChange = true; - } - +#ifndef noCbC + if (CI->getCalledFunction()->getReturnType()->is__CodeTy() || !isOnlyForCbC()) { +#endif + CI->setTailCall(); + MadeChange = true; +#ifndef noCbC + } +#endif + } return MadeChange; } @@ -646,3 +684,12 @@ ArgumentPHIs, CannotTailCallElimCallsMarkedTail); } + +#ifndef noCbC + void TailCallElim::setCbCFlag(bool f){ + onlyForCbC = f; +} + bool TailCallElim::isOnlyForCbC(){ + return onlyForCbC; +} +#endif
--- a/tools/clang/include/clang/AST/ASTContext.h Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/include/clang/AST/ASTContext.h Sat Jul 13 18:16:49 2013 +0900 @@ -738,6 +738,9 @@ // Builtin Types. CanQualType VoidTy; +#ifndef noCbC + CanQualType __CodeTy; +#endif CanQualType BoolTy; CanQualType CharTy; CanQualType WCharTy; // [C++ 3.9.1p5].
--- a/tools/clang/include/clang/AST/BuiltinTypes.def Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/include/clang/AST/BuiltinTypes.def Sat Jul 13 18:16:49 2013 +0900 @@ -58,6 +58,9 @@ // void BUILTIN_TYPE(Void, VoidTy) +#ifndef noCbC +BUILTIN_TYPE(__Code, __CodeTy) +#endif //===- Unsigned Types -----------------------------------------------------===// // 'bool' in C++, '_Bool' in C99
--- a/tools/clang/include/clang/AST/CanonicalType.h Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/include/clang/AST/CanonicalType.h Sat Jul 13 18:16:49 2013 +0900 @@ -267,6 +267,9 @@ LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isRealType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isArithmeticType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVoidType) +#ifndef noCbC + LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, is__CodeType) +#endif LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDerivedType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isScalarType) LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAggregateType)
--- a/tools/clang/include/clang/AST/Stmt.h Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/include/clang/AST/Stmt.h Sat Jul 13 18:16:49 2013 +0900 @@ -1325,6 +1325,9 @@ Stmt *RetExpr; SourceLocation RetLoc; const VarDecl *NRVOCandidate; +#ifndef noCbC + bool is__CodeFlag; +#endif public: ReturnStmt(SourceLocation RL) @@ -1366,6 +1369,17 @@ if (RetExpr) return child_range(&RetExpr, &RetExpr+1); return child_range(); } + + // accessor for __code flag. +#ifndef noCbC + void set__CodeFlag(bool f) { + is__CodeFlag = f; + } + + bool is__Code() { + return is__CodeFlag; + } +#endif }; /// AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
--- a/tools/clang/include/clang/AST/Type.h Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/include/clang/AST/Type.h Sat Jul 13 18:16:49 2013 +0900 @@ -1518,6 +1518,10 @@ bool isFundamentalType() const; bool isCompoundType() const; +#ifndef noCbC + bool is__CodeType() const; // C99 6.2.5p19 +#endif + // Type Predicates: Check to see if this type is structurally the specified // type, ignoring typedefs and qualifiers. bool isFunctionType() const; @@ -4973,10 +4977,22 @@ inline bool Type::isVoidType() const { if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) +#ifndef noCbC + return (BT->getKind() == BuiltinType::Void || BT->getKind() == BuiltinType::__Code); +#else return BT->getKind() == BuiltinType::Void; +#endif return false; } +#ifndef noCbC +inline bool Type::is__CodeType() const { + if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) + return BT->getKind() == BuiltinType::__Code; + return false; +} +#endif + inline bool Type::isHalfType() const { if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) return BT->getKind() == BuiltinType::Half; @@ -5008,8 +5024,14 @@ inline bool Type::isScalarType() const { if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) +#ifndef noCbC + return BT->getKind() > BuiltinType::Void && + BT->getKind() <= BuiltinType::NullPtr && + BT->getKind() != BuiltinType::__Code; +#else return BT->getKind() > BuiltinType::Void && BT->getKind() <= BuiltinType::NullPtr; +#endif if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) // Enums are scalar types, but only if they are defined. Incomplete enums // are not treated as scalar types.
--- a/tools/clang/include/clang/Serialization/ASTBitCodes.h Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/include/clang/Serialization/ASTBitCodes.h Sat Jul 13 18:16:49 2013 +0900 @@ -738,6 +738,10 @@ PREDEF_TYPE_EVENT_ID = 44, /// \brief OpenCL sampler type. PREDEF_TYPE_SAMPLER_ID = 45 +#ifndef noCbC + /// \brief The void type. + ,PREDEF_TYPE___CODE_ID = 46 +#endif }; /// \brief The number of predefined type IDs that are reserved for
--- a/tools/clang/lib/AST/ASTContext.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/AST/ASTContext.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -869,6 +869,11 @@ // C99 6.2.5p19. InitBuiltinType(VoidTy, BuiltinType::Void); +#ifndef noCbC + // CbC + InitBuiltinType(__CodeTy, BuiltinType::__Code); +#endif + // C99 6.2.5p2. InitBuiltinType(BoolTy, BuiltinType::Bool); // C99 6.2.5p3. @@ -1434,6 +1439,9 @@ default: llvm_unreachable("Unknown builtin type!"); case BuiltinType::Void: // GCC extension: alignof(void) = 8 bits. +#ifndef noCbC + case BuiltinType::__Code: +#endif Width = 0; Align = 8; break;
--- a/tools/clang/lib/AST/NSAPI.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/AST/NSAPI.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -333,6 +333,9 @@ return NSAPI::NSNumberWithBool; case BuiltinType::Void: +#ifndef noCbC + case BuiltinType::__Code: +#endif case BuiltinType::WChar_U: case BuiltinType::WChar_S: case BuiltinType::Char16:
--- a/tools/clang/lib/AST/Type.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/AST/Type.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -1501,6 +1501,9 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const { switch (getKind()) { case Void: return "void"; +#ifndef noCbC + case __Code: return "__code"; +#endif case Bool: return Policy.Bool ? "bool" : "_Bool"; case Char_S: return "char"; case Char_U: return "char";
--- a/tools/clang/lib/AST/TypeLoc.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/AST/TypeLoc.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -222,6 +222,10 @@ switch (getTypePtr()->getKind()) { case BuiltinType::Void: return TST_void; +#ifndef noCbC + case BuiltinType::__Code: + return TST___code; +#endif case BuiltinType::Bool: return TST_bool; case BuiltinType::Char_U:
--- a/tools/clang/lib/Analysis/FormatString.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Analysis/FormatString.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -315,11 +315,15 @@ QualType pointeeTy = PT->getPointeeType(); if (const BuiltinType *BT = pointeeTy->getAs<BuiltinType>()) switch (BT->getKind()) { + case BuiltinType::Void: case BuiltinType::Char_U: case BuiltinType::UChar: case BuiltinType::Char_S: case BuiltinType::SChar: +#ifndef noCbC + case BuiltinType::__Code: +#endif return true; default: break;
--- a/tools/clang/lib/CodeGen/CGCall.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/CodeGen/CGCall.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -892,6 +892,10 @@ case ABIArgInfo::Ignore: resultType = llvm::Type::getVoidTy(getLLVMContext()); +#ifndef noCbC + if (FI.getReturnType().getTypePtr()->is__CodeType()) + resultType->set__CodeFlag(true); +#endif break; }
--- a/tools/clang/lib/CodeGen/CGDebugInfo.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/CodeGen/CGDebugInfo.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -364,6 +364,9 @@ return DBuilder. createNullPtrType(BT->getName(CGM.getLangOpts())); case BuiltinType::Void: +#ifndef noCbC + case BuiltinType::__Code: +#endif return llvm::DIType(); case BuiltinType::ObjCClass: if (ClassTy.Verify())
--- a/tools/clang/lib/CodeGen/CGRTTI.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/CodeGen/CGRTTI.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -167,6 +167,9 @@ // half-precision floating point types. switch (Ty->getKind()) { case BuiltinType::Void: +#ifndef noCbC + case BuiltinType::__Code: +#endif case BuiltinType::NullPtr: case BuiltinType::Bool: case BuiltinType::WChar_S:
--- a/tools/clang/lib/CodeGen/CodeGenTypes.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/CodeGen/CodeGenTypes.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -315,6 +315,9 @@ case Type::Builtin: { switch (cast<BuiltinType>(Ty)->getKind()) { case BuiltinType::Void: +#ifndef noCbC + case BuiltinType::__Code: +#endif case BuiltinType::ObjCId: case BuiltinType::ObjCClass: case BuiltinType::ObjCSel:
--- a/tools/clang/lib/CodeGen/TargetInfo.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/CodeGen/TargetInfo.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -1397,7 +1397,11 @@ if (const BuiltinType *BT = Ty->getAs<BuiltinType>()) { BuiltinType::Kind k = BT->getKind(); +#ifndef noCbC + if (k == BuiltinType::Void || k == BuiltinType::__Code) { +#else if (k == BuiltinType::Void) { +#endif Current = NoClass; } else if (k == BuiltinType::Int128 || k == BuiltinType::UInt128) { Lo = Integer;
--- a/tools/clang/lib/Parse/ParseAST.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Parse/ParseAST.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -144,13 +144,6 @@ } while (!P.ParseTopLevelDecl(ADecl)); } -#ifndef noCbC - if(S.getLangOpts().HasCodeSegment && !S.getLangOpts().Optimize){ // If codes has code segments , set Optlevel to 2. - // S.getLangOpts().Optimize = 1; - // S.getCodeGenOpts().OptimizationLevel = 2; - } -#endif - // Process any TopLevelDecls generated by #pragma weak. for (SmallVector<Decl*,2>::iterator I = S.WeakTopLevelDecls().begin(),
--- a/tools/clang/lib/Parse/ParseDecl.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Parse/ParseDecl.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -2876,9 +2876,8 @@ break; #ifndef noCbC case tok::kw___code: - isInvalid = DS.SetTypeSpecType(DeclSpec::TST_void, Loc, PrevSpec, + isInvalid = DS.SetTypeSpecType(DeclSpec::TST___code, Loc, PrevSpec, DiagID); - // getLangOpts().HasCodeSegment = 1; break; #endif case tok::kw_char:
--- a/tools/clang/lib/Parse/ParseStmt.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Parse/ParseStmt.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -1659,7 +1659,7 @@ gotoRes = ParseExprStatement(); - // don't need return because it's not code segment to code segment jamp. + // don't need return because it's not code segment to code segment jump. if (!Actions.getCurFunctionDecl()->getResultType().getTypePtr()->isVoidType()) return gotoRes;
--- a/tools/clang/lib/Sema/DeclSpec.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Sema/DeclSpec.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -292,6 +292,9 @@ case TST_image3d_t: case TST_sampler_t: case TST_event_t: +#ifndef noCbC + case TST___code: +#endif return false; case TST_decltype_auto: @@ -452,6 +455,9 @@ case DeclSpec::TST_sampler_t: return "sampler_t"; case DeclSpec::TST_event_t: return "event_t"; case DeclSpec::TST_error: return "(error)"; +#ifndef noCbC + case DeclSpec::TST___code: return "__code"; +#endif } llvm_unreachable("Unknown typespec!"); }
--- a/tools/clang/lib/Sema/SemaCodeComplete.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Sema/SemaCodeComplete.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -588,6 +588,9 @@ case Type::Builtin: switch (cast<BuiltinType>(T)->getKind()) { case BuiltinType::Void: +#ifndef noCbC + case BuiltinType::__Code: +#endif return STC_Void; case BuiltinType::NullPtr:
--- a/tools/clang/lib/Sema/SemaStmt.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Sema/SemaStmt.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -2672,6 +2672,11 @@ } Result = new (Context) ReturnStmt(ReturnLoc, RetValExp, 0); +#ifndef noCbC + if (FnRetType->is__CodeType()) + Result->set__CodeFlag(true); +#endif + } else if (!RetValExp && !HasDependentReturnType) { unsigned DiagID = diag::warn_return_missing_expr; // C90 6.6.6.4p4 // C99 6.8.6.4p1 (ext_ since GCC warns)
--- a/tools/clang/lib/Sema/SemaTemplateVariadic.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Sema/SemaTemplateVariadic.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -738,6 +738,9 @@ case TST_sampler_t: case TST_event_t: case TST_error: +#ifndef noCbC + case TST___code: +#endif break; }
--- a/tools/clang/lib/Sema/SemaType.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Sema/SemaType.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -717,6 +717,11 @@ case DeclSpec::TST_void: Result = Context.VoidTy; break; +#ifndef noCbC + case DeclSpec::TST___code: + Result = Context.__CodeTy; + break; +#endif case DeclSpec::TST_char: if (DS.getTypeSpecSign() == DeclSpec::TSS_unspecified) Result = Context.CharTy;
--- a/tools/clang/lib/Serialization/ASTCommon.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Serialization/ASTCommon.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -71,6 +71,9 @@ case BuiltinType::OCLEvent: ID = PREDEF_TYPE_EVENT_ID; break; case BuiltinType::BuiltinFn: ID = PREDEF_TYPE_BUILTIN_FN; break; +#ifndef noCbC + case BuiltinType::__Code: ID = PREDEF_TYPE___CODE_ID; break; +#endif }
--- a/tools/clang/lib/Serialization/ASTReader.cpp Thu Jul 04 02:18:09 2013 +0900 +++ b/tools/clang/lib/Serialization/ASTReader.cpp Sat Jul 13 18:16:49 2013 +0900 @@ -5162,6 +5162,9 @@ switch ((PredefinedTypeIDs)Index) { case PREDEF_TYPE_NULL_ID: return QualType(); case PREDEF_TYPE_VOID_ID: T = Context.VoidTy; break; +#ifndef noCbC + case PREDEF_TYPE___CODE_ID: T = Context.__CodeTy; break; +#endif case PREDEF_TYPE_BOOL_ID: T = Context.BoolTy; break; case PREDEF_TYPE_CHAR_U_ID: