diff options
| author | Andrey Bokhanko <andreybokhanko@gmail.com> | 2015-08-03 10:38:10 +0000 |
|---|---|---|
| committer | Andrey Bokhanko <andreybokhanko@gmail.com> | 2015-08-03 10:38:10 +0000 |
| commit | d9eab9cc130d4c2840923c5345ea8d591e083be1 (patch) | |
| tree | 3e1bf882cdbc1a4cdd9490c03fe1ead47342662d /clang/lib/AST/Expr.cpp | |
| parent | 6967e5e4a394fc3ef783f171b076ad357b52759f (diff) | |
| download | bcm5719-llvm-d9eab9cc130d4c2840923c5345ea8d591e083be1.tar.gz bcm5719-llvm-d9eab9cc130d4c2840923c5345ea8d591e083be1.zip | |
Additional fix for PR14269: Crash on vector elements / global register vars in inline assembler.
Compiler crashed when vector elements / global register vars were used in inline assembler with "m" restriction. This patch fixes this.
Differential Revision: http://reviews.llvm.org/D10476
llvm-svn: 243870
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 4882f536d52..89f47f980c9 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -3437,6 +3437,18 @@ bool Expr::refersToVectorElement() const { return false; } +bool Expr::refersToGlobalRegisterVar() const { + const Expr *E = this->IgnoreParenImpCasts(); + + if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) + if (const auto *VD = dyn_cast<VarDecl>(DRE->getDecl())) + if (VD->getStorageClass() == SC_Register && + VD->hasAttr<AsmLabelAttr>() && !VD->isLocalVarDecl()) + return true; + + return false; +} + /// isArrow - Return true if the base expression is a pointer to vector, /// return false if the base expression is a vector. bool ExtVectorElementExpr::isArrow() const { |

