blob: 53bc3059e9137734794fb186e3b244c5ae242019 [file] [log] [blame]
Carl Shapiro0e5d75d2011-07-06 18:28:37 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#include "src/dex_verifier.h"
4
Elliott Hughes1f359b02011-07-17 14:27:17 -07005#include <iostream>
6
7#include "logging.h"
8#include "stringpiece.h"
Carl Shapiro0e5d75d2011-07-06 18:28:37 -07009
10namespace art {
11
12bool DexVerify::VerifyClass(Class* klass) {
13 if (klass->IsVerified()) {
14 return true;
15 }
16 for (size_t i = 0; i < klass->NumDirectMethods(); ++i) {
17 Method* method = klass->GetDirectMethod(i);
18 if (!VerifyMethod(method)) {
Elliott Hughes1f359b02011-07-17 14:27:17 -070019 LOG(ERROR) << "Verifier rejected class " << klass->GetDescriptor();
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070020 return false;
21 }
22 }
23 for (size_t i = 0; i < klass->NumVirtualMethods(); ++i) {
24 Method* method = klass->GetVirtualMethod(i);
25 if (!VerifyMethod(method)) {
Elliott Hughes1f359b02011-07-17 14:27:17 -070026 LOG(ERROR) << "Verifier rejected class " << klass->GetDescriptor();
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070027 return false;
28 }
29 }
30 return true;
31}
32
33bool DexVerify::VerifyMethod(Method* method) {
34 return true; // TODO
35}
36
37} // namespace art