summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-05-19 12:03:34 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2017-05-19 12:03:34 +0000
commit8b9897fff444e884c59163a7ba4d93608753e924 (patch)
tree511755c194528081d204b00d428311336584d900 /clang/lib/CodeGen/CodeGenFunction.h
parenta1b2db7919e857885ff3035efae071804996bd62 (diff)
downloadbcm5719-llvm-8b9897fff444e884c59163a7ba4d93608753e924.tar.gz
bcm5719-llvm-8b9897fff444e884c59163a7ba4d93608753e924.zip
Restore and update documentation comment for EmitPointerWithAlignment
llvm-svn: 303419
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index ae73903d22b..526ef9a1e57 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -3746,12 +3746,23 @@ public:
unsigned ParamsToSkip = 0,
EvaluationOrder Order = EvaluationOrder::Default);
- /// EmitPointerWithAlignment - Given an expression with a pointer
- /// type, emit the value and compute our best estimate of the
- /// alignment of the pointee.
+ /// EmitPointerWithAlignment - Given an expression with a pointer type,
+ /// emit the value and compute our best estimate of the alignment of the
+ /// pointee.
///
- /// Note that this function will conservatively fall back on the type
- /// when it doesn't
+ /// \param BaseInfo - If non-null, this will be initialized with
+ /// information about the source of the alignment and the may-alias
+ /// attribute. Note that this function will conservatively fall back on
+ /// the type when it doesn't recognize the expression and may-alias will
+ /// be set to false.
+ ///
+ /// One reasonable way to use this information is when there's a language
+ /// guarantee that the pointer must be aligned to some stricter value, and
+ /// we're simply trying to ensure that sufficiently obvious uses of under-
+ /// aligned objects don't get miscompiled; for example, a placement new
+ /// into the address of a local variable. In such a case, it's quite
+ /// reasonable to just ignore the returned alignment when it isn't from an
+ /// explicit source.
Address EmitPointerWithAlignment(const Expr *Addr,
LValueBaseInfo *BaseInfo = nullptr);
OpenPOWER on IntegriCloud