diff options
| author | Alexey Samsonov <vonosmas@gmail.com> | 2014-08-28 22:59:39 +0000 |
|---|---|---|
| committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-08-28 22:59:39 +0000 |
| commit | 5afc294ba4884f8c7e2bf4bea0da454f4ff0b75b (patch) | |
| tree | f35a471373bc7c6fcde1357850903e535448e304 /clang | |
| parent | febb279c9c24936375d0e514808bab6da011a082 (diff) | |
| download | bcm5719-llvm-5afc294ba4884f8c7e2bf4bea0da454f4ff0b75b.tar.gz bcm5719-llvm-5afc294ba4884f8c7e2bf4bea0da454f4ff0b75b.zip | |
Properly align inline space for ImplicitConversionSequences in OverloadSet.
This bug was reported by UBSan.
llvm-svn: 216694
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Sema/Overload.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h index 7c221a2336c..b04b996b7fb 100644 --- a/clang/include/clang/Sema/Overload.h +++ b/clang/include/clang/Sema/Overload.h @@ -25,6 +25,7 @@ #include "clang/Sema/TemplateDeduction.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Support/AlignOf.h" #include "llvm/Support/Allocator.h" namespace clang { @@ -718,7 +719,8 @@ namespace clang { CandidateSetKind Kind; unsigned NumInlineSequences; - char InlineSpace[16 * sizeof(ImplicitConversionSequence)]; + llvm::AlignedCharArray<llvm::AlignOf<ImplicitConversionSequence>::Alignment, + 16 * sizeof(ImplicitConversionSequence)> InlineSpace; OverloadCandidateSet(const OverloadCandidateSet &) LLVM_DELETED_FUNCTION; void operator=(const OverloadCandidateSet &) LLVM_DELETED_FUNCTION; @@ -759,7 +761,7 @@ namespace clang { // available. if (NumConversions + NumInlineSequences <= 16) { ImplicitConversionSequence *I = - (ImplicitConversionSequence*)InlineSpace; + (ImplicitConversionSequence *)InlineSpace.buffer; C.Conversions = &I[NumInlineSequences]; NumInlineSequences += NumConversions; } else { |

