diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2014-06-24 06:40:51 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2014-06-24 06:40:51 +0000 |
| commit | 11a54c3465a71c027841b83bc7f5f9df647618ff (patch) | |
| tree | 4948cf053f5fe7e2159531e451fbfb51d588238f /clang/lib | |
| parent | b17604535c9a18e440eca465f707aec4c4fc5854 (diff) | |
| download | bcm5719-llvm-11a54c3465a71c027841b83bc7f5f9df647618ff.tar.gz bcm5719-llvm-11a54c3465a71c027841b83bc7f5f9df647618ff.zip | |
AST: Address of dllimport functions isn't constant
The address of dllimport functions can be accessed one of two ways:
- Through the IAT which is symbolically referred to with a symbol
starting with __imp_.
- Via the wrapper-function which ends up calling through the __imp_
symbol.
The problem with using the wrapper-function is that it's address will
not compare as equal in all translation units. Specifically, it will
compare unequally with the translation unit which defines the function.
This fixes PR19955.
llvm-svn: 211570
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index d25ecd043d1..c57a802512b 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -4373,8 +4373,11 @@ static bool EvaluateLValue(const Expr *E, LValue &Result, EvalInfo &Info) { } bool LValueExprEvaluator::VisitDeclRefExpr(const DeclRefExpr *E) { - if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(E->getDecl())) + if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(E->getDecl())) { + if (FD->hasAttr<DLLImportAttr>()) + return ZeroInitialization(E); return Success(FD); + } if (const VarDecl *VD = dyn_cast<VarDecl>(E->getDecl())) return VisitVarDecl(E, VD); return Error(E); |

