[llvm] r185408 - IRVerifier: Correctly check attribute types

Tobias Grosser grosser at fim.uni-passau.de
Mon Jul 1 20:28:10 PDT 2013


Author: grosser
Date: Mon Jul  1 22:28:10 2013
New Revision: 185408

URL: http://llvm.org/viewvc/llvm-project?rev=185408&view=rev
Log:
IRVerifier: Correctly check attribute types

Add missing parenthesis such that all and not only the very first attribute
is checked.

Testing this piece of code is not possible with an LLVM-IR test file, as the
LLVM-IR parser has a similar check such that the wrong IR does not even arrive
at the verifier.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=185408&r1=185407&r2=185408&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Mon Jul  1 22:28:10 2013
@@ -695,10 +695,11 @@ void Verifier::VerifyAttributeTypes(Attr
         I->getKindAsEnum() == Attribute::Builtin ||
         I->getKindAsEnum() == Attribute::NoBuiltin ||
         I->getKindAsEnum() == Attribute::Cold) {
-      if (!isFunction)
+      if (!isFunction) {
           CheckFailed("Attribute '" + I->getAsString() +
                       "' only applies to functions!", V);
           return;
+      }
     } else if (isFunction) {
         CheckFailed("Attribute '" + I->getAsString() +
                     "' does not apply to functions!", V);





More information about the llvm-commits mailing list