aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Sema/Initialization.h
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2011-07-26 23:20:30 +0000
committerJeffrey Yasskin <jyasskin@google.com>2011-07-26 23:20:30 +0000
commit191591336f639dad1504e863733fb831645c1644 (patch)
tree37cb1ccfc5b0a823b8e41faf0ef5ec91c3467b2a /include/clang/Sema/Initialization.h
parent3e23d68e2e642db107b78aac2bb27585ed0ef337 (diff)
This patch implements as much of the narrowing conversion error specified by
[dcl.init.list] as is possible without generalized initializer lists or full constant expression support, and adds a c++0x-compat warning in C++98 mode. The FixIt currently uses a typedef's basename without qualification, which is likely to be incorrect on some code. If it's incorrect on too much code, we should write a function to get the string that refers to a type from a particular context. The warning is currently off by default. I'll fix LLVM and clang before turning it on. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136181 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/Initialization.h')
-rw-r--r--include/clang/Sema/Initialization.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h
index 3b100ce257..fd677ef601 100644
--- a/include/clang/Sema/Initialization.h
+++ b/include/clang/Sema/Initialization.h
@@ -732,7 +732,18 @@ public:
/// \brief Determine whether this initialization is direct call to a
/// constructor.
bool isConstructorInitialization() const;
-
+
+ // \brief Returns whether the last step in this initialization sequence is a
+ // narrowing conversion, defined by C++0x [dcl.init.list]p7.
+ //
+ // If this function returns true, *isInitializerConstant will be set to
+ // describe whether *Initializer was a constant expression. If
+ // *isInitializerConstant is set to true, *ConstantValue will be set to the
+ // evaluated value of *Initializer.
+ bool endsWithNarrowing(ASTContext &Ctx, const Expr *Initializer,
+ bool *isInitializerConstant,
+ APValue *ConstantValue) const;
+
/// \brief Add a new step in the initialization that resolves the address
/// of an overloaded function to a specific function declaration.
///