diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2017-07-19 17:17:50 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2017-07-19 17:17:50 +0000 |
commit | 3e40c30188ad4fda54a242cf3be693f7efa86ff8 (patch) | |
tree | 9e5fe025e90ddba75fc4420fe98a4786286ac4b3 /clang/lib/Sema/SemaExprCXX.cpp | |
parent | 8b8058072f54cc1978dabc025f10b8849d6607a2 (diff) | |
download | bcm5719-llvm-3e40c30188ad4fda54a242cf3be693f7efa86ff8.tar.gz bcm5719-llvm-3e40c30188ad4fda54a242cf3be693f7efa86ff8.zip |
[Sema] Improve diagnostic message for unavailable C++17 aligned
allocation functions.
This changes the error message Sema prints when an unavailable C++17
aligned allocation function is selected.
Original message: "... possibly unavailable on x86_64-apple-macos10.12"
New message: "... only available on macOS 10.13 or newer"
This is a follow-up to r306722.
rdar://problem/32664169
Differential Revision: https://reviews.llvm.org/D35520
llvm-svn: 308496
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index a9cf3ec7990..9c0bd6fedd1 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -24,6 +24,7 @@ #include "clang/AST/ExprObjC.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/TypeLoc.h" +#include "clang/Basic/AlignedAllocation.h" #include "clang/Basic/PartialDiagnostic.h" #include "clang/Basic/TargetInfo.h" #include "clang/Lex/Preprocessor.h" @@ -1660,9 +1661,13 @@ static void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, bool IsAligned = false; if (FD.isReplaceableGlobalAllocationFunction(&IsAligned) && IsAligned) { + const llvm::Triple &T = S.getASTContext().getTargetInfo().getTriple(); + StringRef OSName = AvailabilityAttr::getPlatformNameSourceSpelling( + S.getASTContext().getTargetInfo().getPlatformName()); + S.Diag(Loc, diag::warn_aligned_allocation_unavailable) - << IsDelete << FD.getType().getAsString() - << S.getASTContext().getTargetInfo().getTriple().str(); + << IsDelete << FD.getType().getAsString() << OSName + << alignedAllocMinVersion(T.getOS()).getAsString(); S.Diag(Loc, diag::note_silence_unligned_allocation_unavailable); } } |