[clang] 21cf2e6 - Handle unknown OSes in DarwinTargetInfo::getExnObjectAlignment

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 16:05:34 PDT 2020


Author: Akira Hatanaka
Date: 2020-09-30T16:05:17-07:00
New Revision: 21cf2e6c263d7a50654653bce4e83ab463fae580

URL: https://github.com/llvm/llvm-project/commit/21cf2e6c263d7a50654653bce4e83ab463fae580
DIFF: https://github.com/llvm/llvm-project/commit/21cf2e6c263d7a50654653bce4e83ab463fae580.diff

LOG: Handle unknown OSes in DarwinTargetInfo::getExnObjectAlignment

rdar://problem/69727650

Added: 
    

Modified: 
    clang/lib/Basic/Targets/OSTargets.h
    clang/test/SemaCXX/warn-overaligned-type-thrown.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index e07067693054..9b96690f413c 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -154,7 +154,8 @@ class LLVM_LIBRARY_VISIBILITY DarwinTargetInfo : public OSTargetInfo<Target> {
       MinVersion = llvm::VersionTuple(5U);
       break;
     default:
-      llvm_unreachable("Unexpected OS");
+      // Conservatively return 8 bytes if OS is unknown.
+      return 64;
     }
 
     unsigned Major, Minor, Micro;

diff  --git a/clang/test/SemaCXX/warn-overaligned-type-thrown.cpp b/clang/test/SemaCXX/warn-overaligned-type-thrown.cpp
index d7468445f8b7..9f2386ddc3c6 100644
--- a/clang/test/SemaCXX/warn-overaligned-type-thrown.cpp
+++ b/clang/test/SemaCXX/warn-overaligned-type-thrown.cpp
@@ -3,6 +3,7 @@
 // RUN: %clang_cc1 -triple arm64-apple-tvos10 -verify -fsyntax-only -std=c++11 -fcxx-exceptions -fexceptions -DUNDERALIGNED %s
 // RUN: %clang_cc1 -triple arm64-apple-watchos4 -verify -fsyntax-only -std=c++11 -fcxx-exceptions -fexceptions -DUNDERALIGNED %s
 // RUN: %clang_cc1 -triple arm-linux-gnueabi -verify -fsyntax-only -std=c++11 -fcxx-exceptions -fexceptions  -DUNDERALIGNED %s
+// RUN: %clang_cc1 -triple thumbv7em-apple-unknown-macho -verify -fsyntax-only -std=c++11 -fcxx-exceptions -fexceptions -DUNDERALIGNED %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.14 -verify -fsyntax-only -std=c++11 -fcxx-exceptions -fexceptions %s
 // RUN: %clang_cc1 -triple arm64-apple-ios12 -verify -fsyntax-only -std=c++11 -fcxx-exceptions -fexceptions %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos12 -verify -fsyntax-only -std=c++11 -fcxx-exceptions -fexceptions %s


        


More information about the cfe-commits mailing list