diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-24 22:11:32 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-24 22:11:32 +0000 | 
| commit | 8b67a9f01da8048d4ed0a3fefc890e684526cd6a (patch) | |
| tree | 3a477c21c59c764e17d8a794f3e240fc18bb740a /clang/lib/CodeGen | |
| parent | d225fe9c6746d065ebe184f96f2cfbafec025668 (diff) | |
Notes
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 17 | 
4 files changed, 18 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 09fd3087b494a..2d20f92fbb3d2 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -3222,6 +3222,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,          Builder.CreateZExt(EmitSignBit(*this, EmitScalarExpr(E->getArg(0))),                             ConvertType(E->getType())));    } +  case Builtin::BI__warn_memset_zero_len: +    return RValue::getIgnored();    case Builtin::BI__annotation: {      // Re-encode each wide string to UTF8 and make an MDString.      SmallVector<Metadata *, 1> Strings; diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 5aac7a8d54c77..60f1dba7c768a 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -111,6 +111,7 @@ void CodeGenFunction::EmitDecl(const Decl &D) {    case Decl::Empty:    case Decl::Concept:    case Decl::LifetimeExtendedTemporary: +  case Decl::RequiresExprBody:      // None of these decls require codegen support.      return; diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 3f23fe11e4f58..de5c3a03fb68d 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -680,6 +680,10 @@ public:      return Builder.getInt1(E->isSatisfied());    } +  Value *VisitRequiresExpr(const RequiresExpr *E) { +    return Builder.getInt1(E->isSatisfied()); +  } +    Value *VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *E) {      return llvm::ConstantInt::get(Builder.getInt32Ty(), E->getValue());    } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 2bf94f697e01c..648e6d9c214a8 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -820,13 +820,18 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,              llvm::itostr(CGM.getCodeGenOpts().XRayInstructionThreshold));      } +    unsigned Count, Offset;      if (const auto *Attr = D->getAttr<PatchableFunctionEntryAttr>()) { -      // Attr->getStart is currently ignored. -      Fn->addFnAttr("patchable-function-entry", -                    std::to_string(Attr->getCount())); -    } else if (unsigned Count = CGM.getCodeGenOpts().PatchableFunctionEntryCount) { -      Fn->addFnAttr("patchable-function-entry", -                    std::to_string(Count)); +      Count = Attr->getCount(); +      Offset = Attr->getOffset(); +    } else { +      Count = CGM.getCodeGenOpts().PatchableFunctionEntryCount; +      Offset = CGM.getCodeGenOpts().PatchableFunctionEntryOffset; +    } +    if (Count && Offset <= Count) { +      Fn->addFnAttr("patchable-function-entry", std::to_string(Count - Offset)); +      if (Offset) +        Fn->addFnAttr("patchable-function-prefix", std::to_string(Offset));      }    }  | 
