[cfe-commits] r108234 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ lib/AST/ lib/Rewrite/ lib/Sema/ test/CodeGen/ test/Sema/ test/SemaCXX/ test/SemaTemplate/
Sebastian Redl
sebastian.redl at getdesigned.at
Tue Jul 13 09:49:06 PDT 2010
On Tue, 13 Jul 2010 08:18:22 -0000, Douglas Gregor <dgregor at apple.com>
wrote:
> Author: dgregor
> Date: Tue Jul 13 03:18:22 2010
> New Revision: 108234
>
> URL: http://llvm.org/viewvc/llvm-project?rev=108234&view=rev
> Log:
> When forming a function call or message send expression, be sure to
> strip cv-qualifiers from the expression's type when the language calls
> for it: in C, that's all the time, while C++ only does it for
> non-class types.
>
> Modified: cfe/trunk/lib/AST/Type.cpp
> URL:
>
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=108234&r1=108233&r2=108234&view=diff
>
==============================================================================
> --- cfe/trunk/lib/AST/Type.cpp (original)
> +++ cfe/trunk/lib/AST/Type.cpp Tue Jul 13 03:18:22 2010
> @@ -992,6 +992,22 @@
>
> void FunctionType::ANCHOR() {} // Key function for FunctionType.
>
> +QualType QualType::getCallResultType(ASTContext &Context) const {
> + if (const ReferenceType *RefType =
getTypePtr()->getAs<ReferenceType>())
> + return RefType->getPointeeType();
> +
> + // C++0x [basic.lval]:
> + // Class prvalues can have cv-qualified types; non-class prvalues
> always
> + // have cv-unqualified types.
> + //
> + // See also C99 6.3.2.1p2.
> + if (!Context.getLangOptions().CPlusPlus ||
> + !getTypePtr()->isDependentType() &&
!getTypePtr()->isRecordType())
> + return getUnqualifiedType();
> +
> + return *this;
> +}
GCC is going to complain about the lack of parentheses around the AND.
Sebastian
More information about the cfe-commits
mailing list