[PATCH] Implement the __builtin_call_with_static_chain GNU extension.

Richard Smith richard at metafoo.co.uk
Mon Dec 8 15:15:15 PST 2014


================
Comment at: include/clang/AST/Expr.h:4880
@@ +4879,3 @@
+      : Expr(CallWithStaticChainExprClass, Call->getType(),
+             Call->getValueKind(), OK_Ordinary, Call->isTypeDependent(),
+             Call->isValueDependent(), Call->isInstantiationDependent() ||
----------------
It would seem better to inherit the object kind from `Call` here, even though in practice a call should always be `OK_Ordinary`.

================
Comment at: include/clang/Basic/TokenKinds.def:366
@@ -365,2 +365,3 @@
 KEYWORD(__PRETTY_FUNCTION__         , KEYALL)
+KEYWORD(__builtin_call_with_static_chain, KEYALL)
 
----------------
Why is this modeled as a keyword rather than as a builtin function?

================
Comment at: include/clang/CodeGen/CGFunctionInfo.h:366
@@ -362,3 +365,3 @@
   unsigned HasRegParm : 1;
-  unsigned RegParm : 4;
+  unsigned RegParm : 3;
 
----------------
Is this large enough? What happens if we overflow?

================
Comment at: lib/CodeGen/CGCall.cpp:86
@@ -85,3 +85,3 @@
   return arrangeLLVMFunctionInfo(FTNP->getReturnType().getUnqualifiedType(),
-                                 false, None, FTNP->getExtInfo(),
+                                 false, false, None, FTNP->getExtInfo(),
                                  RequiredArgs(0));
----------------
Please add an enum for this flag rather than having two mysterious bool flags in a row.

================
Comment at: test/CodeGenCXX/cwsc.cpp:1
@@ +1,2 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck -check-prefix=CHECK64 %s
----------------
Please use a less abbreviated file name for these test files.

http://reviews.llvm.org/D6332






More information about the cfe-commits mailing list