llvm-project/clang/test/ASTMerge/codegen-body.c

7 lines
249 B
C
Raw Normal View History

// XFAIL: hexagon
Implemented ASTImporter support for Stmts and fixed some bugs in the ASTImporter that this exposed: - When importing functions, the body (if any) was previously ignored. This patch ensures that the body is imported also. - When a function-local Decl is imported, the first thing the ASTImporter does is import its context (via ImportDeclParts()). This can trigger importing the Decl again as part of the body of the function (but only once, since the function's Decl has been added to ImportedDecls). This patch fixes that problem by extending ImportDeclParts() to return the imported Decl if it was imported as part of importing its context, and the patch adds ASTImporter::GetAlreadyImportedOrNull() to support this query. All callers of ImportDeclParts return the imported version of the Decl if ImportDeclParts() returns it. - When creating functions, InnerLocStart of the source function was re-used without importing. This is a straight up bug, and this patch makes ASTImporter import the InnerLocStart and use the imported version. - When importing FileIDs, the ASTImporter previously always tried to re-load the file for the corresponding CacheEntry from disk. This doesn't work if the CacheEntry corresponds to a named memory buffer. This patch changes the code so that if the UniqueID for the cache entry is invalid (i.e., it is not a disk file) the whole entry is treated as if it were invalid, which forces an in-memory copy of the buffer. Also added test cases, using the new support committed in 236011. llvm-svn: 236012
2015-04-29 02:41:46 +08:00
// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/body1.c
// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/body2.c
// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s
// expected-no-diagnostics