Skip to content

Commit 76fe494

Browse files
committed
[clang] constexpr atomic builtins (__c11_atomic_OP and __atomic_OP)
1 parent 3b7a7f4 commit 76fe494

File tree

4 files changed

+1352
-42
lines changed

4 files changed

+1352
-42
lines changed

clang/include/clang/Basic/Builtins.td

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,97 +1682,97 @@ def SyncSwapN : Builtin, SyncBuiltinsTemplate {
16821682
// C11 _Atomic operations for <stdatomic.h>.
16831683
def C11AtomicInit : AtomicBuiltin {
16841684
let Spellings = ["__c11_atomic_init"];
1685-
let Attributes = [CustomTypeChecking];
1685+
let Attributes = [CustomTypeChecking, Constexpr];
16861686
let Prototype = "void(...)";
16871687
}
16881688

16891689
def C11AtomicLoad : AtomicBuiltin {
16901690
let Spellings = ["__c11_atomic_load"];
1691-
let Attributes = [CustomTypeChecking];
1691+
let Attributes = [CustomTypeChecking, Constexpr];
16921692
let Prototype = "void(...)";
16931693
}
16941694

16951695
def C11AtomicStore : AtomicBuiltin {
16961696
let Spellings = ["__c11_atomic_store"];
1697-
let Attributes = [CustomTypeChecking];
1697+
let Attributes = [CustomTypeChecking, Constexpr];
16981698
let Prototype = "void(...)";
16991699
}
17001700

17011701
def C11AtomicExchange : AtomicBuiltin {
17021702
let Spellings = ["__c11_atomic_exchange"];
1703-
let Attributes = [CustomTypeChecking];
1703+
let Attributes = [CustomTypeChecking, Constexpr];
17041704
let Prototype = "void(...)";
17051705
}
17061706

17071707
def C11AtomicCompareExchangeStrong : AtomicBuiltin {
17081708
let Spellings = ["__c11_atomic_compare_exchange_strong"];
1709-
let Attributes = [CustomTypeChecking];
1709+
let Attributes = [CustomTypeChecking, Constexpr];
17101710
let Prototype = "void(...)";
17111711
}
17121712

17131713
def C11AtomicCompareExchangeWeak : AtomicBuiltin {
17141714
let Spellings = ["__c11_atomic_compare_exchange_weak"];
1715-
let Attributes = [CustomTypeChecking];
1715+
let Attributes = [CustomTypeChecking, Constexpr];
17161716
let Prototype = "void(...)";
17171717
}
17181718

17191719
def C11AtomicFetchAdd : AtomicBuiltin {
17201720
let Spellings = ["__c11_atomic_fetch_add"];
1721-
let Attributes = [CustomTypeChecking];
1721+
let Attributes = [CustomTypeChecking, Constexpr];
17221722
let Prototype = "void(...)";
17231723
}
17241724

17251725
def C11AtomicFetchSub : AtomicBuiltin {
17261726
let Spellings = ["__c11_atomic_fetch_sub"];
1727-
let Attributes = [CustomTypeChecking];
1727+
let Attributes = [CustomTypeChecking, Constexpr];
17281728
let Prototype = "void(...)";
17291729
}
17301730

17311731
def C11AtomicFetchAnd : AtomicBuiltin {
17321732
let Spellings = ["__c11_atomic_fetch_and"];
1733-
let Attributes = [CustomTypeChecking];
1733+
let Attributes = [CustomTypeChecking, Constexpr];
17341734
let Prototype = "void(...)";
17351735
}
17361736

17371737
def C11AtomicFetchOr : AtomicBuiltin {
17381738
let Spellings = ["__c11_atomic_fetch_or"];
1739-
let Attributes = [CustomTypeChecking];
1739+
let Attributes = [CustomTypeChecking, Constexpr];
17401740
let Prototype = "void(...)";
17411741
}
17421742

17431743
def C11AtomicFetchXor : AtomicBuiltin {
17441744
let Spellings = ["__c11_atomic_fetch_xor"];
1745-
let Attributes = [CustomTypeChecking];
1745+
let Attributes = [CustomTypeChecking, Constexpr];
17461746
let Prototype = "void(...)";
17471747
}
17481748

17491749
def C11AtomicFetchNand : AtomicBuiltin {
17501750
let Spellings = ["__c11_atomic_fetch_nand"];
1751-
let Attributes = [CustomTypeChecking];
1751+
let Attributes = [CustomTypeChecking, Constexpr];
17521752
let Prototype = "void(...)";
17531753
}
17541754

17551755
def C11AtomicFetchMax : AtomicBuiltin {
17561756
let Spellings = ["__c11_atomic_fetch_max"];
1757-
let Attributes = [CustomTypeChecking];
1757+
let Attributes = [CustomTypeChecking, Constexpr];
17581758
let Prototype = "void(...)";
17591759
}
17601760

17611761
def C11AtomicFetchMin : AtomicBuiltin {
17621762
let Spellings = ["__c11_atomic_fetch_min"];
1763-
let Attributes = [CustomTypeChecking];
1763+
let Attributes = [CustomTypeChecking, Constexpr];
17641764
let Prototype = "void(...)";
17651765
}
17661766

17671767
def C11AtomicThreadFence : Builtin {
17681768
let Spellings = ["__c11_atomic_thread_fence"];
1769-
let Attributes = [NoThrow];
1769+
let Attributes = [NoThrow, Constexpr];
17701770
let Prototype = "void(int)";
17711771
}
17721772

17731773
def C11AtomicSignalFence : Builtin {
17741774
let Spellings = ["__c11_atomic_signal_fence"];
1775-
let Attributes = [NoThrow];
1775+
let Attributes = [NoThrow, Constexpr];
17761776
let Prototype = "void(int)";
17771777
}
17781778

@@ -1785,157 +1785,157 @@ def C11AtomicIsLockFree : Builtin {
17851785
// GNU atomic builtins.
17861786
def AtomicLoad : AtomicBuiltin {
17871787
let Spellings = ["__atomic_load"];
1788-
let Attributes = [CustomTypeChecking];
1788+
let Attributes = [CustomTypeChecking, Constexpr];
17891789
let Prototype = "void(...)";
17901790
}
17911791

17921792
def AtomicLoadN : AtomicBuiltin {
17931793
let Spellings = ["__atomic_load_n"];
1794-
let Attributes = [CustomTypeChecking];
1794+
let Attributes = [CustomTypeChecking, Constexpr];
17951795
let Prototype = "void(...)";
17961796
}
17971797

17981798
def AtomicStore : AtomicBuiltin {
17991799
let Spellings = ["__atomic_store"];
1800-
let Attributes = [CustomTypeChecking];
1800+
let Attributes = [CustomTypeChecking, Constexpr];
18011801
let Prototype = "void(...)";
18021802
}
18031803

18041804
def AtomicStoreN : AtomicBuiltin {
18051805
let Spellings = ["__atomic_store_n"];
1806-
let Attributes = [CustomTypeChecking];
1806+
let Attributes = [CustomTypeChecking, Constexpr];
18071807
let Prototype = "void(...)";
18081808
}
18091809

18101810
def AtomicExchange : AtomicBuiltin {
18111811
let Spellings = ["__atomic_exchange"];
1812-
let Attributes = [CustomTypeChecking];
1812+
let Attributes = [CustomTypeChecking, Constexpr];
18131813
let Prototype = "void(...)";
18141814
}
18151815

18161816
def AtomicExchangeN : AtomicBuiltin {
18171817
let Spellings = ["__atomic_exchange_n"];
1818-
let Attributes = [CustomTypeChecking];
1818+
let Attributes = [CustomTypeChecking, Constexpr];
18191819
let Prototype = "void(...)";
18201820
}
18211821

18221822
def AtomicCompareExchange : AtomicBuiltin {
18231823
let Spellings = ["__atomic_compare_exchange"];
1824-
let Attributes = [CustomTypeChecking];
1824+
let Attributes = [CustomTypeChecking, Constexpr];
18251825
let Prototype = "void(...)";
18261826
}
18271827

18281828
def AtomicCompareExchangeN : AtomicBuiltin {
18291829
let Spellings = ["__atomic_compare_exchange_n"];
1830-
let Attributes = [CustomTypeChecking];
1830+
let Attributes = [CustomTypeChecking, Constexpr];
18311831
let Prototype = "void(...)";
18321832
}
18331833

18341834
def AtomicFetchAdd : AtomicBuiltin {
18351835
let Spellings = ["__atomic_fetch_add"];
1836-
let Attributes = [CustomTypeChecking];
1836+
let Attributes = [CustomTypeChecking, Constexpr];
18371837
let Prototype = "void(...)";
18381838
}
18391839

18401840
def AtomicFetchSub : AtomicBuiltin {
18411841
let Spellings = ["__atomic_fetch_sub"];
1842-
let Attributes = [CustomTypeChecking];
1842+
let Attributes = [CustomTypeChecking, Constexpr];
18431843
let Prototype = "void(...)";
18441844
}
18451845

18461846
def AtomicFetchAnd : AtomicBuiltin {
18471847
let Spellings = ["__atomic_fetch_and"];
1848-
let Attributes = [CustomTypeChecking];
1848+
let Attributes = [CustomTypeChecking, Constexpr];
18491849
let Prototype = "void(...)";
18501850
}
18511851

18521852
def AtomicFetchOr : AtomicBuiltin {
18531853
let Spellings = ["__atomic_fetch_or"];
1854-
let Attributes = [CustomTypeChecking];
1854+
let Attributes = [CustomTypeChecking, Constexpr];
18551855
let Prototype = "void(...)";
18561856
}
18571857

18581858
def AtomicFetchXor : AtomicBuiltin {
18591859
let Spellings = ["__atomic_fetch_xor"];
1860-
let Attributes = [CustomTypeChecking];
1860+
let Attributes = [CustomTypeChecking, Constexpr];
18611861
let Prototype = "void(...)";
18621862
}
18631863

18641864
def AtomicFetchNand : AtomicBuiltin {
18651865
let Spellings = ["__atomic_fetch_nand"];
1866-
let Attributes = [CustomTypeChecking];
1866+
let Attributes = [CustomTypeChecking, Constexpr];
18671867
let Prototype = "void(...)";
18681868
}
18691869

18701870
def AtomicAddFetch : AtomicBuiltin {
18711871
let Spellings = ["__atomic_add_fetch"];
1872-
let Attributes = [CustomTypeChecking];
1872+
let Attributes = [CustomTypeChecking, Constexpr];
18731873
let Prototype = "void(...)";
18741874
}
18751875

18761876
def AtomicSubFetch : AtomicBuiltin {
18771877
let Spellings = ["__atomic_sub_fetch"];
1878-
let Attributes = [CustomTypeChecking];
1878+
let Attributes = [CustomTypeChecking, Constexpr];
18791879
let Prototype = "void(...)";
18801880
}
18811881

18821882
def AtomicAndFetch : AtomicBuiltin {
18831883
let Spellings = ["__atomic_and_fetch"];
1884-
let Attributes = [CustomTypeChecking];
1884+
let Attributes = [CustomTypeChecking, Constexpr];
18851885
let Prototype = "void(...)";
18861886
}
18871887

18881888
def AtomicOrFetch : AtomicBuiltin {
18891889
let Spellings = ["__atomic_or_fetch"];
1890-
let Attributes = [CustomTypeChecking];
1890+
let Attributes = [CustomTypeChecking, Constexpr];
18911891
let Prototype = "void(...)";
18921892
}
18931893

18941894
def AtomicXorFetch : AtomicBuiltin {
18951895
let Spellings = ["__atomic_xor_fetch"];
1896-
let Attributes = [CustomTypeChecking];
1896+
let Attributes = [CustomTypeChecking, Constexpr];
18971897
let Prototype = "void(...)";
18981898
}
18991899

19001900
def AtomicMaxFetch : AtomicBuiltin {
19011901
let Spellings = ["__atomic_max_fetch"];
1902-
let Attributes = [CustomTypeChecking];
1902+
let Attributes = [CustomTypeChecking, Constexpr];
19031903
let Prototype = "void(...)";
19041904
}
19051905

19061906
def AtomicMinFetch : AtomicBuiltin {
19071907
let Spellings = ["__atomic_min_fetch"];
1908-
let Attributes = [CustomTypeChecking];
1908+
let Attributes = [CustomTypeChecking, Constexpr];
19091909
let Prototype = "void(...)";
19101910
}
19111911

19121912
def AtomicNandFetch : AtomicBuiltin {
19131913
let Spellings = ["__atomic_nand_fetch"];
1914-
let Attributes = [CustomTypeChecking];
1914+
let Attributes = [CustomTypeChecking, Constexpr];
19151915
let Prototype = "void(...)";
19161916
}
19171917

19181918
def AtomicTestAndSet : Builtin {
19191919
let Spellings = ["__atomic_test_and_set"];
1920-
let Attributes = [NoThrow];
1920+
let Attributes = [NoThrow, Constexpr];
19211921
let Prototype = "bool(void volatile*, int)";
19221922
}
19231923

19241924
def AtomicClear : Builtin {
19251925
let Spellings = ["__atomic_clear"];
1926-
let Attributes = [NoThrow];
1926+
let Attributes = [NoThrow, Constexpr];
19271927
let Prototype = "void(void volatile*, int)";
19281928
}
19291929

19301930
def AtomicThreadFence : Builtin {
19311931
let Spellings = ["__atomic_thread_fence"];
1932-
let Attributes = [NoThrow];
1932+
let Attributes = [NoThrow, Constexpr];
19331933
let Prototype = "void(int)";
19341934
}
19351935

19361936
def AtomicSignalFence : Builtin {
19371937
let Spellings = ["__atomic_signal_fence"];
1938-
let Attributes = [NoThrow];
1938+
let Attributes = [NoThrow, Constexpr];
19391939
let Prototype = "void(int)";
19401940
}
19411941

0 commit comments

Comments
 (0)