On Aug 30, 2011, at 10:36 PM, Julien Lerouge wrote:
> Here is the second revision of this patch. It should address all the
> previous comments. Thanks for all the feedback!

This is looking a lot better, thanks.

+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -456,7 +456,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl 
*FD,
   }
 
   case Builtin::BI__builtin_isfinite: {
-    // isfinite(x) --> x == x && fabs(x) != infinity; }
+    // isfinite(x) --> x == x && fabs(x) != infinity;

This is fine, but please commit it separately.

+  case Builtin::BI__builtin_annotation: {
+    llvm::Value *AnnVal = EmitScalarExpr(E->getArg(0));
+    llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::annotation,
+                                      AnnVal->getType());
+
+    // Get the annotation string, go through casts.
+    const Expr *AnnotationStrExpr = E->getArg(1)->IgnoreParenCasts();
+    llvm::StringRef Str = cast<StringLiteral>(AnnotationStrExpr)->getString();
+    return RValue::get(EmitAnnotationCall(F, AnnVal, Str, E->getExprLoc()));
+  }

Please have this comment say something like "Sema requires this to be a 
non-wide string literal, potentially casted", so that it's clear why this 
cast<> will always succeed.

And then you should make that true by adding the appropriate case to 
Sema::CheckBuiltinFunctionCall. :)

John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to