================
@@ -1749,17 +1739,29 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const
CXXNewExpr *E) {
allocator->isReservedGlobalPlacementOperator())
result = Builder.CreateLaunderInvariantGroup(result);
+ // Check what type of constructor call the sanitizer is checking
+ // Different UB can occour with custom overloads of operator new
+ TypeCheckKind checkKind = CodeGenFunction::TCK_ConstructorCall;
+ const TargetInfo &TI = getContext().getTargetInfo();
+ unsigned DefaultTargetAlignment = TI.getNewAlign() / TI.getCharWidth();
+ SourceManager &SM = getContext().getSourceManager();
+ SourceLocation Loc = E->getOperatorNew()->getLocation();
+ bool IsCustomOverload = !SM.isInSystemHeader(Loc);
----------------
gbMattN wrote:
If new somehow returns bad alignment without it being a user overload, it will
still be caught with the regular constructor-on error. The new error adds
information specific to cases when a user has erroneously returned a smaller
than allowed alignment in their overload, so I thought it best to only emit the
new error in those cases. I can certainly remove some of these checks if its
too overcomplicated though.
And do you mind explaining your second point some more? I don't understand it
yet!
https://github.com/llvm/llvm-project/pull/152532
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits