[PATCH] D55132: [CTU] Add asserts to protect invariants

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 7 04:24:49 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348586: [CTU] Add asserts to protect invariants (authored by martong, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55132?vs=176151&id=177177#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55132/new/

https://reviews.llvm.org/D55132

Files:
  cfe/trunk/lib/CrossTU/CrossTranslationUnit.cpp


Index: cfe/trunk/lib/CrossTU/CrossTranslationUnit.cpp
===================================================================
--- cfe/trunk/lib/CrossTU/CrossTranslationUnit.cpp
+++ cfe/trunk/lib/CrossTU/CrossTranslationUnit.cpp
@@ -160,6 +160,7 @@
 CrossTranslationUnitContext::getCrossTUDefinition(const FunctionDecl *FD,
                                                   StringRef CrossTUDir,
                                                   StringRef IndexName) {
+  assert(FD && "FD is missing, bad call to this function!");
   assert(!FD->hasBody() && "FD has a definition in current translation unit!");
   ++NumGetCTUCalled;
   const std::string LookupFnName = getLookupName(FD);
@@ -258,6 +259,8 @@
 
 llvm::Expected<const FunctionDecl *>
 CrossTranslationUnitContext::importDefinition(const FunctionDecl *FD) {
+  assert(FD->hasBody() && "Functions to be imported should have body.");
+
   ASTImporter &Importer = getOrCreateASTImporter(FD->getASTContext());
   auto *ToDecl =
       cast<FunctionDecl>(Importer.Import(const_cast<FunctionDecl *>(FD)));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55132.177177.patch
Type: text/x-patch
Size: 1061 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181207/a49f982a/attachment.bin>


More information about the cfe-commits mailing list