Which compiler/what warning was flagging this?
It doesn't look like Clang builds by default with
-Wconditional-uninitialized on, so I'm surprised if Clang was diagnosing
anything here.
In any case - it's probably better to omit the "WasAmbiguous" flag.
Optional already has a flag that says whether it has a value, so either you
can rely on that or assert against it explicitly:
assert(SavedAK);
Ambiguity = *SavedAK;
But I'd probably skip adding the assertion here - especially since it
currently doesn't have a message, so it's probably no better than the
assert that Optional's operator* will do anyway.
On Fri, Jun 30, 2017 at 2:25 AM Vassil Vassilev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:
> Author: vvassilev
> Date: Fri Jun 30 02:25:43 2017
> New Revision: 306809
>
> URL: http://llvm.org/viewvc/llvm-project?rev=306809=rev
> Log:
> Ambiguity might be also uninitialized. Use llvm::Optional.
>
>
> Modified:
> cfe/trunk/include/clang/Sema/Lookup.h
>
> Modified: cfe/trunk/include/clang/Sema/Lookup.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=306809=306808=306809=diff
>
> ==
> --- cfe/trunk/include/clang/Sema/Lookup.h (original)
> +++ cfe/trunk/include/clang/Sema/Lookup.h Fri Jun 30 02:25:43 2017
> @@ -18,6 +18,8 @@
> #include "clang/AST/DeclCXX.h"
> #include "clang/Sema/Sema.h"
>
> +#include "llvm/ADT/Optional.h"
> +
> namespace clang {
>
> /// @brief Represents the results of name lookup.
> @@ -465,9 +467,10 @@ public:
> Paths = nullptr;
>}
> } else {
> - AmbiguityKind SavedAK = Ambiguity;
> + llvm::Optional SavedAK;
>bool WasAmbiguous = false;
>if (ResultKind == Ambiguous) {
> +SavedAK = Ambiguity;
> WasAmbiguous = true;
>}
>ResultKind = Found;
> @@ -478,7 +481,7 @@ public:
>if (ResultKind == Ambiguous) {
> (void)WasAmbiguous;
> assert(WasAmbiguous);
> -Ambiguity = SavedAK;
> +Ambiguity = SavedAK.getValue();
>} else if (Paths) {
> deletePaths(Paths);
> Paths = nullptr;
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits