[cfe-commits] r132737 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/Basic/Targets.cpp lib/CodeGen/CGStmt.cpp test/CodeGen/arm-asm.c

John McCall rjmccall at apple.com
Tue Jun 7 22:29:26 PDT 2011


On Jun 7, 2011, at 4:45 PM, Stuart Hastings wrote:
> Author: stuart
> Date: Tue Jun  7 18:45:05 2011
> New Revision: 132737
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=132737&view=rev
> Log:
> Clang support for ARM Uv/Uy/Uq inline-asm constraints.
> rdar://problem/9037836
> 
> Added:
>    cfe/trunk/test/CodeGen/arm-asm.c
> Modified:
>    cfe/trunk/include/clang/Basic/TargetInfo.h
>    cfe/trunk/lib/Basic/Targets.cpp
>    cfe/trunk/lib/CodeGen/CGStmt.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=132737&r1=132736&r2=132737&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
> +++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Jun  7 18:45:05 2011
> @@ -368,11 +368,11 @@
>                            ConstraintInfo *OutputConstraints,
>                            unsigned NumOutputs, unsigned &Index) const;
> 
> -  virtual std::string convertConstraint(const char Constraint) const {
> +  virtual std::string convertConstraint(const char *&Constraint) const {

Please add a comment describing the expectation here.  In particular,
it looks like the referent is advanced to point to the last character
consumed (i.e. it is not advanced for single-character constraints).

> +  std::string
> +  virtual convertConstraint(const char *&Constraint) const {
> +    std::string R;
> +    switch (*Constraint) {
> +    case 'U':   // Two-character constraint; add "^" hint for later parsing.
> +      R = std::string("^") + Constraint;
> +      Constraint++;
> +      break;

Do you really want to add the entire input string here?  It seems like you really just want the next two characters.

John.



More information about the cfe-commits mailing list