[llvm-commits] [llvm] r57020 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp
Devang Patel
dpatel at apple.com
Fri Oct 3 10:50:00 PDT 2008
Author: dpatel
Date: Fri Oct 3 12:50:00 2008
New Revision: 57020
URL: http://llvm.org/viewvc/llvm-project?rev=57020&view=rev
Log:
Verify function attributes.
Modified:
llvm/trunk/include/llvm/Attributes.h
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=57020&r1=57019&r2=57020&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Fri Oct 3 12:50:00 2008
@@ -53,8 +53,8 @@
/// @brief Attributes that only apply to function parameters.
const Attributes ParameterOnly = ByVal | Nest | StructRet;
-/// @brief Attributes that only apply to function return values.
-const Attributes ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly;
+/// @brief Attributes that only apply to function.
+const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly;
/// @brief Parameter attributes that do not apply to vararg call arguments.
const Attributes VarArgsIncompatible = StructRet;
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=57020&r1=57019&r2=57020&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Fri Oct 3 12:50:00 2008
@@ -416,7 +416,7 @@
Assert1(!RetI, "Attribute " + Attribute::getAsString(RetI) +
" does not apply to return values!", V);
} else {
- Attributes ParmI = Attrs & Attribute::ReturnOnly;
+ Attributes ParmI = Attrs & Attribute::FunctionOnly;
Assert1(!ParmI, "Attribute " + Attribute::getAsString(ParmI) +
" only applies to return values!", V);
}
@@ -477,6 +477,10 @@
}
Attributes FAttrs = Attrs.getFnAttributes();
+ Assert1(!(FAttrs & (!Attribute::FunctionOnly)),
+ "Attribute " + Attribute::getAsString(FAttrs) +
+ " does not apply to function!", V);
+
for (unsigned i = 0;
i < array_lengthof(Attribute::MutuallyIncompatible); ++i) {
Attributes MutI = FAttrs & Attribute::MutuallyIncompatible[i];
More information about the llvm-commits
mailing list