[llvm] 621023b - [AIX][TLS] Add assert check of valid csect type for the storage mapping class XCOFF::XMC_UL

Victor Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 8 12:23:02 PST 2021


Author: Victor Huang
Date: 2021-03-08T14:18:57-06:00
New Revision: 621023b21853d711e02a339e9452d78a8687f3d7

URL: https://github.com/llvm/llvm-project/commit/621023b21853d711e02a339e9452d78a8687f3d7
DIFF: https://github.com/llvm/llvm-project/commit/621023b21853d711e02a339e9452d78a8687f3d7.diff

LOG: [AIX][TLS] Add assert check of valid csect type for the storage mapping class XCOFF::XMC_UL

This patch adds the assert check inside the constructor for the csect (MCSectionXCOFF) to ensure
valid csect type used for the storage mappping class XCOFF:XMC_UL.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCSectionXCOFF.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCSectionXCOFF.h b/llvm/include/llvm/MC/MCSectionXCOFF.h
index 27c06a2c0877..1dafdd3ac500 100644
--- a/llvm/include/llvm/MC/MCSectionXCOFF.h
+++ b/llvm/include/llvm/MC/MCSectionXCOFF.h
@@ -51,6 +51,9 @@ class MCSectionXCOFF final : public MCSection {
         (ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM || ST == XCOFF::XTY_ER) &&
         "Invalid or unhandled type for csect.");
     assert(QualName != nullptr && "QualName is needed.");
+    if (SMC == XCOFF::XMC_UL)
+      assert((ST == XCOFF::XTY_CM || ST == XCOFF::XTY_ER) &&
+             "Invalid csect type for storage mapping class XCOFF::XMC_UL");
 
     QualName->setRepresentedCsect(this);
     QualName->setStorageClass(XCOFF::C_HIDEXT);


        


More information about the llvm-commits mailing list