diff options
-rw-r--r-- | include/clang/Basic/Builtins.def | 5 | ||||
-rw-r--r-- | include/clang/Basic/BuiltinsX86.def | 8 | ||||
-rw-r--r-- | lib/AST/ASTContext.cpp | 9 |
3 files changed, 15 insertions, 7 deletions
diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index d0459101c0..ca710423d9 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -38,12 +38,13 @@ // SJ -> sigjmp_buf // . -> "...". This may only occur at the end of the function list. // -// Types maybe prefixed with the following modifiers: +// Types may be prefixed with the following modifiers: // L -> long (e.g. Li for 'long int') // LL -> long long // LLL -> __int128_t (e.g. LLLi) // S -> signed // U -> unsigned +// I -> Required to constant fold to an integer constant expression. // // Types may be postfixed with the following modifiers: // * -> pointer (optionally followed by an address space number) @@ -367,7 +368,7 @@ BUILTIN(__builtin___vfprintf_chk, "iP*icC*a", "FP:2:") BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:") BUILTIN(__builtin_expect, "LiLiLi" , "nc") -BUILTIN(__builtin_prefetch, "vvC*.", "nc") +BUILTIN(__builtin_prefetch, "vvC*.", "nIc") BUILTIN(__builtin_trap, "v", "nr") BUILTIN(__builtin_unreachable, "v", "nr") BUILTIN(__builtin_shufflevector, "v." , "nc") diff --git a/include/clang/Basic/BuiltinsX86.def b/include/clang/Basic/BuiltinsX86.def index 025e7b60c2..8a730a836b 100644 --- a/include/clang/Basic/BuiltinsX86.def +++ b/include/clang/Basic/BuiltinsX86.def @@ -97,7 +97,7 @@ BUILTIN(__builtin_ia32_pcmpgtd, "V2iV2iV2i", "") BUILTIN(__builtin_ia32_maskmovq, "vV8cV8cc*", "") BUILTIN(__builtin_ia32_pmovmskb, "iV8c", "") BUILTIN(__builtin_ia32_movntq, "vV1LLi*V1LLi", "") -BUILTIN(__builtin_ia32_palignr, "V8cV8cV8cc", "") +BUILTIN(__builtin_ia32_palignr, "V8cV8cV8cIc", "") BUILTIN(__builtin_ia32_vec_init_v2si, "V2iii", "") BUILTIN(__builtin_ia32_vec_init_v4hi, "V4sssss", "") BUILTIN(__builtin_ia32_vec_init_v8qi, "V8ccccccccc", "") @@ -255,8 +255,8 @@ BUILTIN(__builtin_ia32_psraw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psrad128, "V4iV4iV4i", "") BUILTIN(__builtin_ia32_psrlw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_psrld128, "V4iV4iV4i", "") -BUILTIN(__builtin_ia32_pslldqi128, "V2LLiV2LLii", "") -BUILTIN(__builtin_ia32_psrldqi128, "V2LLiV2LLii", "") +BUILTIN(__builtin_ia32_pslldqi128, "V2LLiV2LLiIi", "") +BUILTIN(__builtin_ia32_psrldqi128, "V2LLiV2LLiIi", "") BUILTIN(__builtin_ia32_psrlq128, "V2LLiV2LLiV2LLi", "") BUILTIN(__builtin_ia32_psllw128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_pslld128, "V4iV4iV4i", "") @@ -273,7 +273,7 @@ BUILTIN(__builtin_ia32_pmaddwd128, "V8sV8sV8s", "") BUILTIN(__builtin_ia32_monitor, "vv*UiUi", "") BUILTIN(__builtin_ia32_mwait, "vUiUi", "") BUILTIN(__builtin_ia32_lddqu, "V16ccC*", "") -BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cc", "") // FIXME: Correct type? +BUILTIN(__builtin_ia32_palignr128, "V16cV16cV16cIc", "") // FIXME: Correct type? BUILTIN(__builtin_ia32_insertps128, "V4fV4fV4fi", "") BUILTIN(__builtin_ia32_storelv4si, "vV2i*V2LLi", "") diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 57780ef981..ce76fcd9ba 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -5187,12 +5187,16 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context, // Modifiers. int HowLong = 0; bool Signed = false, Unsigned = false; - + bool RequiresIntegerConstant = false; + // Read the modifiers first. bool Done = false; while (!Done) { switch (*Str++) { default: Done = true; --Str; break; + case 'I': + RequiresIntegerConstant = true; + break; case 'S': assert(!Unsigned && "Can't use both 'S' and 'U' modifiers!"); assert(!Signed && "Can't use 'S' modifier multiple times!"); @@ -5362,6 +5366,9 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context, break; } } + + assert((!RequiresIntegerConstant || Type->isIntegralOrEnumerationType()) && + "Integer constant 'I' type must be an integer"); return Type; } |