aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-01-26 22:48:42 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-01-26 22:48:42 +0000
commit013af39d2a6a2e684f5a458c97890c52cddb7157 (patch)
tree9111e25cdcdbaf011bbb68a55e6f26d1e3a68008
parent852f5ce688eb90543f72f1012edce8d12a319216 (diff)
Patch to add 'volatile' to first argument of all
sync compare_and_swap to match them with gcc. It also fixes a few incorrect argument defitions. (fixes radar 7540291). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94607 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/Builtins.def21
-rw-r--r--lib/AST/ASTContext.cpp3
2 files changed, 14 insertions, 10 deletions
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def
index 375cd69962..a1a0469b8e 100644
--- a/include/clang/Basic/Builtins.def
+++ b/include/clang/Basic/Builtins.def
@@ -52,6 +52,7 @@
// * -> pointer
// & -> reference
// C -> const
+// D -> volatile
// The third value provided to the macro specifies information about attributes
// of the function. These must be kept in sync with the predicates in the
@@ -439,18 +440,18 @@ BUILTIN(__sync_nand_and_fetch_16, "LLLiLLLi*LLLi.", "n")
BUILTIN(__sync_bool_compare_and_swap, "v.", "")
-BUILTIN(__sync_bool_compare_and_swap_1, "bc*cc.", "n")
-BUILTIN(__sync_bool_compare_and_swap_2, "bs*ss.", "n")
-BUILTIN(__sync_bool_compare_and_swap_4, "bi*ii.", "n")
-BUILTIN(__sync_bool_compare_and_swap_8, "bLLi*LLi.", "n")
-BUILTIN(__sync_bool_compare_and_swap_16, "bLLLi*LLLiLLLi.", "n")
+BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "n")
+BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "n")
+BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "n")
+BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "n")
+BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "n")
BUILTIN(__sync_val_compare_and_swap, "v.", "")
-BUILTIN(__sync_val_compare_and_swap_1, "cc*cc.", "n")
-BUILTIN(__sync_val_compare_and_swap_2, "ss*ss.", "n")
-BUILTIN(__sync_val_compare_and_swap_4, "ii*ii.", "n")
-BUILTIN(__sync_val_compare_and_swap_8, "LLiLLi*LLi.", "n")
-BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLi*LLLiLLLi.", "n")
+BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "n")
+BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "n")
+BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "n")
+BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "n")
+BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "n")
BUILTIN(__sync_lock_test_and_set, "v.", "")
BUILTIN(__sync_lock_test_and_set_1, "cc*c.", "n")
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index c2eddcb76e..4c4e77a625 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -4793,6 +4793,9 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context,
case 'C':
Type = Type.withConst();
break;
+ case 'D':
+ Type = Context.getVolatileType(Type);
+ break;
}
}