diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-10-01 07:13:18 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-10-01 07:13:18 +0000 |
| commit | 847333910017a3618b1ad0bfc07c9fe0cc78a611 (patch) | |
| tree | 1475461bb1ae4b7b9b99b7459a47006b43505d80 /clang/lib/AST/ASTContext.cpp | |
| parent | 1750cb037ddcc5a025f0b24b880f7b87d7fbb1c1 (diff) | |
| download | bcm5719-llvm-847333910017a3618b1ad0bfc07c9fe0cc78a611.tar.gz bcm5719-llvm-847333910017a3618b1ad0bfc07c9fe0cc78a611.zip | |
Various builtins a require an integer constant. Not providing
one results in an obscure error from the backend that doesn't make
sense. Capture this information in the .def files for builtins with
a new "I" modifier letter indicating the an argument needs to be an ICE.
Nothing uses this yet, but sema will eventually enforce this (eliminating
some special cases from semachecking.cpp) and codegen will use this to
force an ICE value, preventing backend error messages.
llvm-svn: 115302
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 57780ef981c..ce76fcd9ba4 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/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; } |

