[PATCH] D31981: Fix warning in Attributes.cpp

Konstantin Zhuravlyov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 09:40:49 PDT 2017


kzhuravl created this revision.
Herald added a subscriber: wdng.

Compiling Attributes.cpp ...
../../../Attributes.cpp: In member function 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> > llvm::AttributeSet::getAllocSizeArgs() const':
../../../Attributes.cpp:542:69: error: operands to ?: have different types 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> >' and 'std::__1::pair<int, int>'

  return SetNode ? SetNode->getAllocSizeArgs() : std::make_pair(0, 0);
                                                                    ^

../../../Attributes.cpp:543:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^


https://reviews.llvm.org/D31981

Files:
  lib/IR/Attributes.cpp


Index: lib/IR/Attributes.cpp
===================================================================
--- lib/IR/Attributes.cpp
+++ lib/IR/Attributes.cpp
@@ -539,7 +539,8 @@
 }
 
 std::pair<unsigned, Optional<unsigned>> AttributeSet::getAllocSizeArgs() const {
-  return SetNode ? SetNode->getAllocSizeArgs() : std::make_pair(0, 0);
+  return SetNode ? SetNode->getAllocSizeArgs()
+                 : std::make_pair<unsigned, Optional<unsigned>>(0, 0);
 }
 
 std::string AttributeSet::getAsString(bool InAttrGrp) const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31981.94984.patch
Type: text/x-patch
Size: 516 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170412/466bb466/attachment.bin>


More information about the llvm-commits mailing list