diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-04-05 15:49:53 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-04-05 15:49:53 +0000 |
| commit | 56382aa890f9abc917feb5e5f2f26ef5af43ff07 (patch) | |
| tree | a3b6e2a4699ca481e36b7172e72d8023d389fdbf | |
| parent | d231f8a5923d02ee208da45bb2e001e33403fc32 (diff) | |
| download | llvm-56382aa890f9abc917feb5e5f2f26ef5af43ff07.zip llvm-56382aa890f9abc917feb5e5f2f26ef5af43ff07.tar.gz llvm-56382aa890f9abc917feb5e5f2f26ef5af43ff07.tar.bz2 | |
in va_arg diagnostics, print out the unpromoted type. This makes the
diagnostic use the va_list typedef more often, see the difference in the
changed testcase.
llvm-svn: 68441
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 9 | ||||
| -rw-r--r-- | clang/test/Sema/varargs-x86-64.c | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index a4335ea..99afd32 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -4710,7 +4710,9 @@ Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, ExprArg expr, TypeTy *type, SourceLocation RPLoc) { QualType T = QualType::getFromOpaquePtr(type); - + Expr *E = static_cast<Expr*>(expr.get()); + Expr *OrigExpr = E; + InitBuiltinVaListType(); // Get the va_list type @@ -4721,7 +4723,6 @@ Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, if (VaListType->isArrayType()) VaListType = Context.getArrayDecayedType(VaListType); // Make sure the input expression also decays appropriately. - Expr *E = static_cast<Expr*>(expr.get()); UsualUnaryConversions(E); AssignConvertType ConvResult = @@ -4730,13 +4731,13 @@ Sema::OwningExprResult Sema::ActOnVAArg(SourceLocation BuiltinLoc, case Compatible: break; // Everything good. case CompatiblePointerDiscardsQualifiers: Diag(E->getLocStart(), diag::warn_va_arg_with_qualified_va_list) - << E->getType() << E->getSourceRange(); + << OrigExpr->getType() << E->getSourceRange(); break; default: return ExprError(Diag(E->getLocStart(), diag::err_first_argument_to_va_arg_not_of_type_va_list) - << E->getType() << E->getSourceRange()); + << OrigExpr->getType() << E->getSourceRange()); } // FIXME: Check that type is complete/non-abstract diff --git a/clang/test/Sema/varargs-x86-64.c b/clang/test/Sema/varargs-x86-64.c index 7953ead..5afcda2 100644 --- a/clang/test/Sema/varargs-x86-64.c +++ b/clang/test/Sema/varargs-x86-64.c @@ -3,6 +3,6 @@ // rdar://6726818 void f1() { const __builtin_va_list args2; - (void)__builtin_va_arg(args2, int); // expected-warning {{va_arg applied to va_list type 'struct __va_list_tag const *' with unexpected qualifiers}} + (void)__builtin_va_arg(args2, int); // expected-warning {{va_arg applied to va_list type '__builtin_va_list const' with unexpected qualifiers}} } |
