diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-28 19:48:30 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-12-28 19:48:30 +0000 |
commit | 5fab0c9e1ad172c0db6cc9f3169666e49b7864b6 (patch) | |
tree | a5682a764875540c534db1a6460792d4a599c6a3 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | e4a84c4f1f17a1e9b7f0e9a75f9d8ee1824feb33 (diff) | |
download | bcm5719-llvm-5fab0c9e1ad172c0db6cc9f3169666e49b7864b6.tar.gz bcm5719-llvm-5fab0c9e1ad172c0db6cc9f3169666e49b7864b6.zip |
Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.
llvm-svn: 147318
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index af6d25d363a..f48157f48c7 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1107,18 +1107,18 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { CollectCXXBases(CXXDecl, Unit, EltTys, FwdDecl); CollectVTableInfo(CXXDecl, Unit, EltTys); } - + // Collect static variables with initializers. for (RecordDecl::decl_iterator I = RD->decls_begin(), E = RD->decls_end(); I != E; ++I) if (const VarDecl *V = dyn_cast<VarDecl>(*I)) { - if (const Expr *Init = V->getInit()) { - Expr::EvalResult Result; - if (Init->EvaluateAsRValue(Result, CGM.getContext()) && - Result.Val.isInt()) { - llvm::ConstantInt *CI - = llvm::ConstantInt::get(CGM.getLLVMContext(), Result.Val.getInt()); - + llvm::SmallVector<PartialDiagnosticAt, 8> Notes; + if (V->getInit() && V->evaluateValue(Notes)) { + APValue *Value = V->getEvaluatedValue(); + if (Value && Value->isInt()) { + llvm::ConstantInt *CI + = llvm::ConstantInt::get(CGM.getLLVMContext(), Value->getInt()); + // Create the descriptor for static variable. llvm::DIFile VUnit = getOrCreateFile(V->getLocation()); StringRef VName = V->getName(); |